forked from open-cluster-management-io/policy-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolicy-managedclusterinfo-templatized.yaml
44 lines (41 loc) · 1.92 KB
/
policy-managedclusterinfo-templatized.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
# This sample policy demonstrates building a configmap with managedcluster specific info using managed-cluster templates
# such configmap can later be referenced in other policies to configure target cluster specific values.
# NOTES
# All cluster labels are available on the managed cluster env as clusterclaim resources.
# fromClusterClaim() can be used to retrive the values of DEFAULT LABELS like id.openshift.io, version.openshift.io etc are available on all managed clusters.
# In the below policy,
# a configmap is created with the cluster specific info like id, version retrieved through fromClusterClaim func
apiVersion: policy.open-cluster-management.io/v1
kind: Policy
metadata:
name: policy-managedclusterinfo-templatized
annotations:
policy.open-cluster-management.io/standards: NIST 800-53
policy.open-cluster-management.io/categories: CM Configuration Management
policy.open-cluster-management.io/controls: CM-2 Baseline Configuration
spec:
disabled: false
remediationAction: enforce
policy-templates:
- objectDefinition:
apiVersion: policy.open-cluster-management.io/v1
kind: ConfigurationPolicy
metadata:
name: policy-build-clusterinfo
spec:
object-templates:
- complianceType: musthave
objectDefinition:
apiVersion: v1
data:
clusterid: '{{ fromClusterClaim "id.openshift.io" }} '
clustername: '{{ fromClusterClaim "name" }}'
ocpversion: '{{ fromClusterClaim "version.openshift.io" }}'
platform: '{{ fromClusterClaim "platform.open-cluster-management.io" }}'
product: '{{ fromClusterClaim "product.open-cluster-management.io" }}'
kind: ConfigMap
metadata:
name: clusterinfo
namespace: default
remediationAction: inform
severity: low