Chapter 3. Policy controllers overview


Policy controllers monitor and report whether your cluster is compliant with a policy. Use the Red Hat Advanced Cluster Management for Kubernetes policy framework by using the supported policy templates to apply policies managed by these controllers. The policy controllers manage Kubernetes custom resource definition instances.

Policy controllers check for policy violations, and can make the cluster status compliant if the controller supports the enforcement feature. View the following topics to learn more about the following Red Hat Advanced Cluster Management for Kubernetes policy controllers:

  • Kubernetes configuration policy controller
  • Certificate policy controller
  • Policy set controller
  • Operator policy controller

3.1. Configuration policy controller

Use the configuration policy controller to configure any Kubernetes resource and apply security policies across your clusters. The configuration policy controller communicates with the local Kubernetes API server so that you can get a list of your configurations that are in your cluster.

During installation, the configuration policy controller is created on the managed cluster. The configuration policy is provided in the policy-templates field of the policy on the hub cluster, and is propagated to the selected managed clusters by the governance framework.

When the remediationAction for the configuration policy controller is set to InformOnly, the parent policy does not enforce the configuration policy, even if the remediationAction in the parent policy is set to enforce.

If you have existing Kubernetes manifests that you want to put in a policy, use the Policy Generator.

3.2. Configuration policy YAML structure

Review the structural YAML file structure and parameter definitions required to configure custom resource definitions for the configuration policy.

  • Find the description of a field on your managed cluster.

    Run the following command and replace <field-path> with the path to the field that you need:

    oc explain --api-version=policy.open-cluster-management.io/v1 ConfigurationPolicy.<field-path>
  • Configuration policy YAML file structure:

    apiVersion: policy.open-cluster-management.io/v1
    kind: ConfigurationPolicy
    metadata:
      name: policy-config
    spec:
      namespaceSelector:
        include: ["default"]
        exclude: []
        matchExpressions: []
        matchLabels: {}
      remediationAction: inform
      customMessage:
        compliant: {}
        noncompliant: {}
      severity: low
      evaluationInterval:
        compliant: ""
        noncompliant: ""
      object-templates-raw: ""
      object-templates:
       - complianceType: musthave
         metadataComplianceType:
         recordDiff: ""
         recreateOption: ""
         objectSelector:
           matchLabels: {}
           matchExpressions: []
         objectDefinition:
           apiVersion: v1
           kind: Pod
           metadata:
             name: pod
           spec:
             containers:
              - image: pod-image
                name: pod-name
                ports:
                 - containerPort: 80
       - complianceType: mustonlyhave
         objectDefinition:
           apiVersion: v1
           kind: ConfigMap
           metadata:
             name: myconfig
             namespace: default
             data:
               testData: hello
  • When the remediationAction for the configuration policy is set to enforce, the controller applies the specified configuration to the target managed cluster. However, configuration policies that specify an object without a name can only be set to inform, unless the objectSelector is also configured.
  • A Kubernetes object is defined in the object-templates array in the configuration policy, where fields of the configuration policy controller is compared with objects on the managed cluster. You can also use templated values within configuration policies. For more advanced use cases, specify a string in object-templates-raw to create the object-templates that you want. For more information, see Template processing.
  • Configuration policy YAML table
Table 3.1. Parameter table
FieldOptional or requiredDescription

apiVersion

Required

Set the value to policy.open-cluster-management.io/v1.

kind

Required

Set the value to ConfigurationPolicy to indicate the type of policy.

metadata.name

Required

The name of the policy.

spec.namespaceSelector

Required for namespaced objects that do not have a namespace specified

Determines namespaces in the managed cluster that the object is applied to. The include and exclude parameters accept file path expressions to include and exclude namespaces by name. The matchExpressions and matchLabels parameters specify namespaces to include by label. See the Kubernetes labels and selectors documentation. The resulting list is compiled by using the intersection of results from all parameters.

spec.remediationAction

Required

Specifies the action to take when the policy is non-compliant. Use the following parameter values: inform, InformOnly, or enforce.

spec.customMessage

Optional

Configure the compliance message sent by the configuration policy based on the current compliance. Each message configuration is a string that can contain Go templates. The .DefaultMessage and .Policy context variables are available for use in the templates. You can access the default message by using the .DefaultMessage parameter. The .Policy context variable contains the current policy object, including its status. For example, you can access the state of each related object by specifying the .Policy.status.relatedObjects[*].object field. If you set a value for the evaluationInterval field other than watch, only the kind, name, and namespace of the related objects are available.

spec.customMessage.compliant

Optional

Configure custom messages for configuration policies that are compliant. Go templates and UTF-8 encoded characters, including emoji and foreign characters, are supported values.

spec.customMessage.noncompliant

Optional

Configure custom messages for configuration policies that are non-compliant. Go templates and UTF-8 encoded characters, including emoji and foreign characters, are supported values.

spec.severity

Required

Specifies the severity when the policy is non-compliant. Use the following parameter values: low, medium, high, or critical.

spec.evaluationInterval

Optional

Specifies the frequency for a policy to be evaluated when it is in a particular compliance state. Use the parameters compliant and noncompliant. The default value for the compliant and noncompliant parameters is watch to leverage Kubernetes API watches instead of polling the Kubernetes API server.

When managed clusters have low resources, the evaluation interval can be set to long polling intervals to reduce CPU and memory usage on the Kubernetes API and policy controller. These are in the format of durations. For example, 1h25m3s represents 1 hour, 25 minutes, and 3 seconds. These can also be set to never to avoid evaluating the policy after it is in a particular compliance state.

spec.evaluationInterval.compliant

Optional

Specifies the evaluation frequency for a compliant policy. To enable the previous polling behavior, set this parameter to 10s.

spec.evaluationInterval.noncompliant

Optional

Specifies the evaluation frequency for a non-compliant policy. To enable the previous polling behavior, set this parameter to 10s.

spec.object-templates

Optional

The array of Kubernetes objects (either fully defined or containing a subset of fields) for the controller to compare with objects on the managed cluster. Note: While spec.object-templates and spec.object-templates-raw are listed as optional, exactly one of the two parameter fields must be set.

spec.object-templates-raw

Optional

Used to set object templates with a raw YAML string. Specify conditions for the object templates, where advanced functions like if-else statements and the range function are supported values. For example, add the following value to avoid duplication in your object-templates definition:

{{- if eq .metadata.name "policy-grc-your-meta-data-name" }} replicas: 2 {{- else }} replicas: 1 {{- end }}

Note: While spec.object-templates and spec.object-templates-raw are listed as optional, exactly one of the two parameter fields must be set.

spec.object-templates[].complianceType

Required

Use this parameter to define the desired state of the Kubernetes object on your managed clusters. Use one of the following verbs as the parameter value:

  • mustonlyhave: Indicates that an object must exist with the exact fields and values as defined in the objectDefinition.
  • musthave: Indicates an object must exist with the same fields as specified in the objectDefinition. Any existing fields on the object that are not specified in the object-template are ignored. In general, array values are appended. The exception for the array to be patched is when the item contains a name key with a value that matches an existing item. Use a fully defined objectDefinition using the mustonlyhave compliance type, if you want to replace the array.
  • mustnothave: Indicates that an object with the same fields as specified in the objectDefinition cannot exist.

spec.object-templates[].metadataComplianceType

Optional

Overrides spec.object-templates[].complianceType when comparing the manifest’s metadata section to objects on the cluster ("musthave", "mustonlyhave"). Default is unset to not override complianceType for metadata.

spec.object-templates[].recordDiff

Optional

Use this parameter to specify if and where to display the difference between the object on the cluster and the objectDefinition in the policy. The following options are supported:

  • Set to InStatus to store the difference in the ConfigurationPolicy status.
  • Set to Log to log the difference in the controller logs.
  • Set to None to not log the difference.

By default, this parameter is set to InStatus if the controller does not detect sensitive data in the difference. Otherwise, the default is None. If sensitive data is detected, the ConfigurationPolicy status displays a message to set recordDiff to view the difference.

spec.object-templates[].recreateOption

Optional

Describes when to delete and recreate an object when an update is required. When you set the object to IfRequired, the policy recreates the object when updating an immutable field. When you set the parameter to Always, the policy recreates the object on any update. When you set the remediationAction to inform, the parameter value, recreateOption, has no effect on the object. The IfRequired value has no effect on clusters without dry-run update support. The default value is None.

spec.object-templates[].objectSelector

Optional

ObjectSelector defines a label selector to select names of objects that are defined in an unnamed objectDefinition. The matchExpressions and matchLabels parameters specify objects to include by label. If there is an object name that is defined in the objectDefinition, the objectSelector is ignored. For more information, see Kubernetes labels and selectors.

spec.object-templates[].objectDefinition

Required

A Kubernetes object (either fully defined or containing a subset of fields) for the controller to compare with objects on the managed cluster.

spec.pruneObjectBehavior

Optional

Determines whether to clean up resources related to the policy when the policy is removed from a managed cluster.

Additional resources

3.3. Object selectors and raw templates

Configuration policies support advanced parameters like objectSelector and object-templates-raw to filter objects or process complex logic, such as loops and conditionals.

  • Configuration policy objectSelector:

    To iterate over multiple objects filtered by a label within a ConfigurationPolicy resource, use the objectSelector parameter and specify the object kind in the objectDefinition parameter. The objectSelector parameter operates similarly to namespaceSelector but does not support name filtering. To filter by name, use the skipObject Go template function. Referencing {{ skipObject }} excludes that specific object from the selection.

    • Object selection configuration example
    ...
    object-templates:
      - objectSelector:
          matchExpressions:
          - key: foo
            operator: In
            values:
            - bar
        objectDefinition:
          apiVersion: v1
          kind: ConfigMap
          data:
            key: '{{ if (hasSuffix "-prod" .ObjectName) }}{{ skipObject }}{{ end }}{{ hasNodesWithExactRoles "infra" }}'
  • Raw template processing

    The optional object-templates-raw parameter supports advanced templating use cases, such as the if conditional function and the range loop function. The object-templates-raw parameter accepts a string containing Go templates that must resolve to an object-templates array.

    Note: You must set exactly one of either spec.object-templates or spec.object-templates-raw.

    • Raw template configuration example with conditional labels

      object-templates-raw: |
        {{- range (lookup "v1" "ConfigMap" "default" "").items }}
        {{- if eq .data.name "Sea Otter" }}
        - complianceType: musthave
          objectDefinition:
            kind: ConfigMap
            apiVersion: v1
            metadata:
              name: {{ .metadata.name }}
              namespace: {{ .metadata.namespace }}
              labels:
                species-category: mammal
        {{- end }}
        {{- end }}
    • Policy configuration example creating infrastructure MachineSet objects
    apiVersion: policy.open-cluster-management.io/v1
    kind: ConfigurationPolicy
    metadata:
      name: create-infra-machineset
    spec:
      remediationAction: enforce
      severity: low
      object-templates-raw: |
        {{- /* Specify the parameters needed to create the MachineSet  */ -}}
        {{- $machineset_role := "infra" }}
        {{- $region := "ap-southeast-1" }}
        {{- $zones := list "ap-southeast-1a" "ap-southeast-1b" "ap-southeast-1c" }}
        {{- $infrastructure_id := (lookup "config.openshift.io/v1" "Infrastructure" "" "cluster").status.infrastructureName }}
        {{- $worker_ms := (index (lookup "machine.openshift.io/v1beta1" "MachineSet" "openshift-machine-api" "").items 0) }}
        {{- /* Generate the MachineSet for each zone as specified  */ -}}
        {{- range $zone := $zones }}
        - complianceType: musthave
          objectDefinition:
            apiVersion: machine.openshift.io/v1beta1
            kind: MachineSet
            metadata:
              labels:
                machine.openshift.io/cluster-api-cluster: {{ $infrastructure_id }}
              name: {{ $infrastructure_id }}-{{ $machineset_role }}-{{ $zone }}
              namespace: openshift-machine-api
            spec:
              replicas: 1
              selector:
                matchLabels:
                  machine.openshift.io/cluster-api-cluster: {{ $infrastructure_id }}
                  machine.openshift.io/cluster-api-machineset: {{ $infrastructure_id }}-{{ $machineset_role }}-{{ $zone }}
              template:
                metadata:
                  labels:
                    machine.openshift.io/cluster-api-cluster: {{ $infrastructure_id }}
                    machine.openshift.io/cluster-api-machine-role: {{ $machineset_role }}
                    machine.openshift.io/cluster-api-machine-type: {{ $machineset_role }}
                    machine.openshift.io/cluster-api-machineset: {{ $infrastructure_id }}-{{ $machineset_role }}-{{ $zone }}
                spec:
                  metadata:
                    labels:
                      node-role.kubernetes.io/{{ $machineset_role }}: ""
                  taints:
                    - key: node-role.kubernetes.io/{{ $machineset_role }}
                      effect: NoSchedule
                  providerSpec:
                    value:
                      ami:
                        id: {{ $worker_ms.spec.template.spec.providerSpec.value.ami.id }}
                      apiVersion: awsproviderconfig.openshift.io/v1beta1
                      blockDevices:
                        - ebs:
                            encrypted: true
                            iops: 2000
                            kmsKey:
                              arn: ''
                            volumeSize: 500
                            volumeType: io1
                      credentialsSecret:
                        name: aws-cloud-credentials
                      deviceIndex: 0
                      instanceType: {{ $worker_ms.spec.template.spec.providerSpec.value.instanceType }}
                      iamInstanceProfile:
                        id: {{ $infrastructure_id }}-worker-profile
                      kind: AWSMachineProviderConfig
                      placement:
                        availabilityZone: {{ $zone }}
                        region: {{ $region }}
                      securityGroups:
                        - filters:
                            - name: tag:Name
                              values:
                                - {{ $infrastructure_id }}-worker-sg
                      subnet:
                        filters:
                          - name: tag:Name
                            values:
                              - {{ $infrastructure_id }}-private-{{ $zone }}
                      tags:
                        - name: kubernetes.io/cluster/{{ $infrastructure_id }}
                          value: owned
                      userDataSecret:
                        name: worker-user-data
        {{- end }}

3.4. Certificate policy controller

You can use the certificate policy controller to detect certificates that are close to expiring, time durations (hours) that are too long, or contain DNS names that fail to match specified patterns. You can add the certificate policy to the policy-templates field of the policy on the hub cluster, which propagates to the selected managed clusters by using the governance framework.

When you create the certificate policy controller on your hub cluster, a replicated policy is created on your managed cluster.

  • Non-compliant scernarios

    A policy status changes to non-compliant when either of these situations occurs:

  • When a certificate expires in less than the minimum duration of time or exceeds the maximum time.
  • When DNS names fail to match the specified pattern.

The certificate policy controller runs on your managed cluster. The controller communicates with the local Kubernetes API server to get the list of secrets that contain certificates and find all non-compliant certificates.

Notes:

  • Certificate policy controller does not support the enforce feature.
  • The certificate policy controller automatically looks for a certificate in a secret in only the tls.crt key. If you store a secret in a different key, define the certificate_key_name parameter. For example, if you have a secret that contains a sensor-cert.pem certificate, add the following label to the secret: certificate_key_name: sensor-cert.pem.

Review the structural YAML file composition and parameter definitions required to configure custom resource definitions for the certificate policy controller.

  • Certificate policy YAML file structure

    apiVersion: policy.open-cluster-management.io/v1
    kind: CertificatePolicy
    metadata:
      name: certificate-policy-example
    spec:
      namespaceSelector:
        include: ["default"]
        exclude: []
        matchExpressions: []
        matchLabels: {}
      labelSelector:
        myLabelKey: myLabelValue
      remediationAction:
      severity:
      minimumDuration:
      minimumCADuration:
      maximumDuration:
      maximumCADuration:
      allowedSANPattern:
      disallowedSANPattern:
  • Certificate policy controller YAML file table
Table 3.2. Certificate policy controller parameters table
FieldOptional or requiredDescription

apiVersion

Required

Set the value to policy.open-cluster-management.io/v1.

kind

Required

Set the value to CertificatePolicy to indicate the type of policy.

metadata.name

Required

The name to identify the policy.

metadata.labels

Optional

In a certificate policy, the category=system-and-information-integrity label categorizes the policy and facilitates querying the certificate policies. If there is a different value for the category key in your certificate policy, the value is overridden by the certificate controller.

spec.namespaceSelector

Required

Determines namespaces in the managed cluster where secrets are monitored. The include and exclude parameters accept file path expressions to include and exclude namespaces by name. The matchExpressions and matchLabels parameters specify namespaces to be included by label. See the Kubernetes labels and selectors documentation. The resulting list is compiled by using the intersection of results from all parameters.

Note: If the namespaceSelector for the certificate policy controller does not match any namespace, the policy is considered compliant.

spec.labelSelector

Optional

Specifies identifying attributes of objects. See the Kubernetes labels and selectors documentation.

spec.remediationAction

Required

Specifies the remediation of your policy. Set the parameter value to inform. Certificate policy controller only supports inform feature.

spec.severity

Optional

Informs the user of the severity when the policy is non-compliant. Use the following parameter values: low, medium, high, or critical.

spec.minimumDuration

Required

When a value is not specified, the default value is 100h. This parameter specifies the smallest duration (in hours) before a certificate is considered non-compliant. The parameter value uses the Golang Parse Duration format.

spec.minimumCADuration

Optional

Set a value to identify signing certificates that might expire soon with a different value from other certificates. If the parameter value is not specified, the CA certificate expiration is the value used for the minimumDuration. The parameter value uses the Golang Parse Duration format.

spec.maximumDuration

Optional

Set a value to identify certificates that have been created with a duration that exceeds your desired limit. The parameter uses the Golang Parse Duration format.

spec.maximumCADuration

Optional

Set a value to identify signing certificates that have been created with a duration that exceeds your defined limit. The parameter uses the Golang Parse Duration format.

spec.allowedSANPattern

Optional

A regular expression that must match every SAN entry that you have defined in your certificates. This parameter checks DNS names against patterns. See the Golang Regular Expression syntax documentation.

spec.disallowedSANPattern

Optional

A regular expression that must not match any SAN entries you have defined in your certificates. This parameter checks DNS names against patterns.

Note: To detect wild-card certificate, use the following SAN pattern: disallowedSANPattern: "[\\*]"

See the Golang Regular Expression syntax documentation.

3.6. Policy set controller

The policy set controller aggregates the policy status scoped to policies that are defined in the same namespace. Create a policy set (PolicySet) to group policies that are in the same namespace. All policies in the PolicySet are placed together in a selected cluster by creating a PlacementBinding to bind the PolicySet and Placement. The policy set is deployed to the hub cluster.

Additionally, when a policy is a part of multiple policy sets, existing and new Placement resources remain in the policy. When a user removes a policy from the policy set, the policy is not applied to the cluster that is selected in the policy set, but the placements remain. The policy set controller only checks for violations in clusters that include the policy set placement.

Notes:

  • The Red Hat Advanced Cluster Management sample policy set uses cluster placement. If you use cluster placement, bind the namespace containing the policy to the managed cluster set. See Deploying policies to your cluster for more details on using cluster placement.
  • To use a Placement resource, bind a ManagedClusterSet resource to the namespace of the Placement resource with a ManagedClusterSetBinding resource. See Creating a ManagedClusterSetBinding resource for additional details.
  • Policy set YAML structure

    Your policy set might resemble the following YAML file:

apiVersion: policy.open-cluster-management.io/v1beta1
kind: PolicySet
metadata:
  name: demo-policyset
spec:
  policies:
  - policy-demo

---
apiVersion: policy.open-cluster-management.io/v1
kind: PlacementBinding
metadata:
  name: demo-policyset-pb
placementRef:
  apiGroup: cluster.open-cluster-management.io
  kind: Placement
  name: demo-policyset-pr
subjects:
- apiGroup: policy.open-cluster-management.io
  kind: PolicySet
  name: demo-policyset
---
apiVersion: cluster.open-cluster-management.io/v1beta1
kind: Placement
metadata:
  name: demo-policyset-pr
spec:
  predicates:
  - requiredClusterSelector:
      labelSelector:
        matchExpressions:
          - key: name
            operator: In
            values:
              - local-cluster
    tolerations:
        - key: cluster.open-cluster-management.io/unavailable
          operator: Exists
        - key: cluster.open-cluster-management.io/unreachable
          operator: Exists
  • Policy set table

    View the following parameter table for descriptions:

Table 3.3. Parameter table
FieldOptional or requiredDescription

apiVersion

Required

Set the value to policy.open-cluster-management.io/v1beta1.

kind

Required

Set the value to PolicySet to indicate the type of policy.

metadata.name

Required

The name for identifying the policy resource.

spec

Required

Add configuration details for your policy.

spec.policies

Optional

The list of policies that you want to group together in the policy set.

  • Policy set sample

    apiVersion: policy.open-cluster-management.io/v1beta1
    kind: PolicySet
    metadata:
      name: pci
      namespace: default
    spec:
      description: Policies for PCI compliance
      policies:
      - policy-pod
      - policy-namespace
    status:
      compliant: NonCompliant
      placement:
      - placementBinding: binding1
        placement: placement1
        policySet: policyset-ps

3.7. Operator policy controller

The operator policy controller allows you to monitor and install Operator Lifecycle Manager operators across your clusters. Use the operator policy controller to monitor the health of various pieces of the operator and to specify how you want to automatically handle updates to the operator.

You can also distribute an operator policy to managed clusters by using the governance framework and adding the policy to the policy-templates field of a policy on the hub cluster.

You can also use template values within the operatorGroup and subscription fields of an operator policy. For more information, see Template processing.

Notes:

  • Operator Lifecycle Manager must be available on your managed cluster. This is enabled by default on Red Hat OpenShift Container Platform.
  • Required access: Cluster administrator
  • Operator policy YAML table

    FieldOptional or requiredDescription

    apiVersion

    Required

    Set the value to policy.open-cluster-management.io/v1beta1.

    kind

    Required

    Set the value to OperatorPolicy to indicate the type of policy.

    metadata.name

    Required

    The name for identifying the policy resource.

    spec.remediationAction

    Required

    If the remediationAction for the operator policy is set to enforce, the controller creates resources on the target managed cluster to communicate to OLM to install the operator and approve updates based on the versions specified in the policy. + If the remediationAction set to inform, the controller only reports the status of the operator, including if any upgrades are available.

    spec.operatorGroup

    Optional

    By default, if the operatorGroup field is not specified, the controller generates an AllNamespaces type OperatorGroup resource in the same namespace as the subscription, if supported. The operator policy controller produces this resource. View the following parameter descriptions:

    • name: The name of the OperatorGroup resource.
    • namespace: The namespace of the OperatorGroup resource. This parameter must match the namespace where you install the operator.
    • targetNamespaces: A list of namespaces that the operator is configured to watch and operate.

    spec.complianceType

    Required

    Specifies the desired state of the operator on the cluster. If set to musthave, the policy is compliant when the operator is found. If set to mustnothave, the policy is compliant when the operator is not found.

    spec.removalBehavior

    Optional

    Determines which resource types need to be kept or removed when you enforce an OperatorPolicy resource with complianceType: mustnothave defined. There is no effect when complianceType is set to musthave. View the following parameter descriptions:

    • operatorGroups can be set to Keep or DeleteIfUnused. The default value is DeleteIfUnusued which only removes the OperatorGroup resource if it is not used by any other operators.
    • subscriptions can be set to Keep or Delete. The default value is Delete.
    • clusterServiceVersions can be set to Keep or Delete. The default value is Delete.
    • customResourceDefinitions can be set to Keep or Delete. The default value is Keep. If you set this to Delete, the CustomResourceDefintion resources on the managed cluster are removed and can cause data loss.

    spec.subscription

    Required

    Define the configurations to create an operator subscription. Add information in the following fields to create an operator subscription. View the following parameter descriptions:

    • channel: If not specified, the default channel is selected from the operator catalog. The default can be different on different OpenShift Container Platform versions.
    • name: Specify the package name of the operator.
    • namespace: If not specified, the default namespaced that is used for OpenShift Container Platform managed clusters is openshift-operators.
    • source: If not specified, the catalog that contains the operator is chosen.
    • sourceNamespace: If not specified, the namespace of the catalog that contains the operator is chosen.
    • config: Optional. Specify extra configuration details for the operator subscription.

    The name field is the only required field. The other fields are populated based on the catalog information within the managed cluster.

    Note: If you define a value for the installPlanApproval field in this parameter section, the policy becomes non-compliant. Use spec.upgradeApproval in the OperatorPolicy resource.

    spec.complianceConfig

    Optional

    Use this parameter to define the compliance behavior for specific scenarios that are associated with operators. You can set each of the following options individually, where the supported values are Compliant and NonCompliant:

    • catalogSourceUnhealthy: Define the compliance when the catalog source for the operator is unhealthy. The default value is Compliant because this only affects possible upgrades.
    • deploymentsUnavailable: Define the compliance when at least one deployment of the operator is not fully available. The default value is NonCompliant because this reflects the availability of the service that the operator provides.
    • upgradesAvailable: Define the compliance when there is an upgrade available for the operator. The default value is Compliant because the existing operator installation might be running correctly.
    • deprecationsPresent: Specifies that the compliance of the policy is affected by the deprecations. For example, the default value is Compliant, but if the deprecationsPresent=NonCompliant configuration detects the deprecations, then the policy compliance status is set to NonCompliant.
    • minorChannelUpgradeAvailable: Detects if a minor version upgrade is available for the operator on different channels. The default value is Compliant.

    spec.upgradeApproval

    Required

    If the upgradeApproval field is set to Automatic, version upgrades on the cluster are approved by the policy when the policy is set to enforce. If you set the field to None, version upgrades to the specific operator are not approved when the policy is set to enforce.

    spec.versions

    Optional

    Declare which versions of the operator are compliant. The versions parameter is a list of templatable strings that specifies which installed ClusterServiceVersion names are compliant when in inform mode, and which InstallPlans are approved when in enforce mode. To give different versions in one entry, separate the versions with commas. If the field is empty, the strings are ignored and all ClusterServiceVersion names are approved. The default value is empty.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat Documentation

Legal Notice

Theme

© 2026 Red Hat
Back to top