forked from stolostron/policy-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
policy-oc-client-cronjob.yaml
112 lines (112 loc) · 3.79 KB
/
policy-oc-client-cronjob.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
name: policy-oc-client
annotations:
policy.open-cluster-management.io/standards: CM-2 Baseline Configuration
policy.open-cluster-management.io/categories: NIST SP 800-53
policy.open-cluster-management.io/controls: CM Configuration Management
spec:
remediationAction: inform
disabled: false
policy-templates:
- objectDefinition:
apiVersion: policy.open-cluster-management.io/v1
kind: ConfigurationPolicy
metadata:
name: policy-oc-client
spec:
object-templates:
- complianceType: musthave
objectDefinition:
kind: Namespace # must have namespace 'jobnamespace'
apiVersion: v1
metadata:
name: jobnamespace
- complianceType: musthave
objectDefinition:
apiVersion: v1
kind: ServiceAccount
metadata:
name: occlient
namespace: jobnamespace
- complianceType: musthave
objectDefinition:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cluster-admin-occlient-sa-crb
roleRef:
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
subjects:
- name: occlient
kind: ServiceAccount
namespace: jobnamespace
- complianceType: musthave
objectDefinition:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: basic-oc-client
namespace: jobnamespace
labels:
purpose: basic-oc-client
spec:
concurrencyPolicy: Forbid
jobTemplate:
spec:
backoffLimit: 0
template:
spec:
activeDeadlineSeconds: 200
containers:
- name: occlient
image: 'registry.redhat.io/openshift4/ose-cli:v4.10'
command: ["/bin/bash"]
args: ["-c", "oc version"]
securityContext:
privileged: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: FallbackToLogsOnError
nodeSelector:
node-role.kubernetes.io/master: ''
restartPolicy: Never
serviceAccount: occlient
serviceAccountName: occlient
tolerations:
- effect: NoSchedule
operator: Exists
- effect: NoExecute
operator: Exists
schedule: '* * * * *'
startingDeadlineSeconds: 200
suspend: false
remediationAction: inform
severity: low
---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
name: binding-oc-client
placementRef:
name: placement-oc-client
kind: PlacementRule
apiGroup: apps.open-cluster-management.io
subjects:
- name: policy-oc-client
kind: Policy
apiGroup: policy.open-cluster-management.io
---
apiVersion: apps.open-cluster-management.io/v1
kind: PlacementRule
metadata:
name: placement-oc-client
spec:
clusterConditions:
- status: "True"
type: ManagedClusterConditionAvailable
clusterSelector:
matchExpressions:
- {key: vendor, operator: In, values: ["OpenShift"]}