// Module included in the following assemblies:
//
// * extensions/ce/olmv1-configuring-extensions.adoc

:_mod-docs-content-type: REFERENCE
[id="olmv1-deployment-config-examples_{context}"]
= `deploymentConfig` examples

[role="_abstract"]
Customize Operator deployments using resource limits, node placement, custom volumes, environment variables, and combined configurations.

:FeatureName: {olmv1} `deploymentConfig` API
include::snippets/technology-preview.adoc[]

[id="olmv1-deployment-config-env-vars_{context}"]
== Environment variables

Add environment variables for runtime configuration.

.Adding environment variables
[source,yaml]
----
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
  name: kmm-operator
spec:
  namespace: openshift-kmm
  serviceAccount:
    name: kmm-operator-sa
  config:
    configType: Inline
    inline:
      deploymentConfig:
        env:
        - name: KMM_MANAGED
          value: "1"
  source:
    sourceType: Catalog
    catalog:
      packageName: kernel-module-management
----
where:
--
`KMM_MANAGED`:: Specifies the environment variable used when deploying the Kernel Module Management Operator in a hub-and-spoke configuration.
--

[id="olmv1-deployment-config-volumes_{context}"]
== Custom volumes

Mount a custom CA certificate for HTTPS communication through a proxy.

.Mounting a custom CA certificate
[source,yaml]
----
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
  name: my-operator
spec:
  namespace: my-operator-ns
  serviceAccount:
    name: my-operator-sa
  config:
    configType: Inline
    inline:
      deploymentConfig:
        volumes:
        - name: trusted-ca
          configMap:
            name: trusted-ca
            items:
            - key: ca-bundle.crt
              path: tls-ca-bundle.pem
        volumeMounts:
        - name: trusted-ca
          mountPath: /etc/pki/ca-trust/extracted/pem
          readOnly: true
  source:
    sourceType: Catalog
    catalog:
      packageName: my-operator
----
where:
--
`volumes:`:: Specifies a volume created from the `trusted-ca` config map.
`volumeMounts:`:: Specifies the volume mount to the Operator container at the specified path.
`mountPath:`:: Specifies the path where the certificate bundle is available inside the container.
--

[id="olmv1-deployment-config-affinity_{context}"]
== Pod anti-affinity

Spread Operator pods across nodes for high availability.

.Pod anti-affinity for high availability
[source,yaml]
----
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
  name: my-operator
spec:
  namespace: my-operator-ns
  serviceAccount:
    name: my-operator-sa
  config:
    configType: Inline
    inline:
      deploymentConfig:
        affinity:
          podAntiAffinity:
            preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                  - key: app.kubernetes.io/name
                    operator: In
                    values:
                    - my-operator
                topologyKey: kubernetes.io/hostname
  source:
    sourceType: Catalog
    catalog:
      packageName: my-operator
----
where:
--
`podAntiAffinity:`:: Specifies anti-affinity rules for the Operator pod.
`preferredDuringSchedulingIgnoredDuringExecution:`:: Specifies soft constraints that the scheduler tries to enforce but does not guarantee.
`topologyKey`:: Specifies the topology key that groups nodes by hostname to ensure pods are spread across different nodes.
--

[id="olmv1-deployment-config-combined_{context}"]
== Multiple customizations

Combine multiple deployment customizations.

.Production Operator with combined customizations
[source,yaml]
----
apiVersion: olm.operatorframework.io/v1
kind: ClusterExtension
metadata:
  name: production-operator
spec:
  namespace: production-operators
  serviceAccount:
    name: production-operator-installer
  config:
    configType: Inline
    inline:
      deploymentConfig:
        resources:
          requests:
            cpu: 200m
            memory: 256Mi
          limits:
            cpu: 1000m
            memory: 1Gi
        env:
        - name: LOG_LEVEL
          value: info
        - name: ENABLE_METRICS
          value: "true"
        nodeSelector:
          node-role.kubernetes.io/infra: ""
        tolerations:
        - key: node-role.kubernetes.io/infra
          operator: Exists
          effect: NoSchedule
        annotations:
          monitoring.openshift.io/scrape: "true"
          monitoring.openshift.io/port: "8080"
  source:
    sourceType: Catalog
    catalog:
      packageName: production-operator
      version: 2.1.0
----
where:
--
`resources:`:: Specifies memory and CPU requests and limits for the Operator pod.
`env:`:: Specifies environment variables for the Operator.
`nodeSelector:`:: Specifies that the pod runs on infrastructure nodes.
`tolerations:`:: Specifies pod tolerations that allow scheduling on nodes with the specified taint.
`annotations:`:: Specifies Prometheus monitoring annotations for the pod.
--
