Customizing the External Secrets Operator for Red Hat OpenShift
After the External Secrets Operator for Red Hat OpenShift is installed, you can customize its behavior by editing the ExternalSecretsConfig custom resource (CR). This lets you modify components like the external-secrets controller, the cert-controller, the webhook, and the bitwardenSecretManagerProvider plugin and also lets you set environment variables for the Operator pod.
Setting a log level for the External Secrets Operator for Red Hat OpenShift
Set the log level for the External Secrets Operator for Red Hat OpenShift to control the detail of log messages. By adjusting the verbosity, you can troubleshoot issues effectively and manage the volume of log data.
-
You have access to the cluster with
cluster-adminprivileges. -
You have created the
ExternalSecretsConfigcustom resource.
-
Update the subscription object for the External Secrets Operator for Red Hat OpenShift to provide the verbosity level for the operator logs by running the following command:
$ oc -n <external_secrets_operator_namespace> patch subscription openshift-external-secrets-operator --type='merge' -p '{"spec":{"config":{"env":[{"name":"OPERATOR_LOG_LEVEL","value":"<log_level>"}]}}}'where:
- external_secrets_operator_namespace
-
Specifies the namespace where the Operator is installed.
- log_level
-
Specifies the level of log detail. Values range from 1-5. The default is 2.
-
The External Secrets Operator pod is redeployed. Verify that the log level of the External Secrets Operator for Red Hat OpenShift is updated by running the following command:
$ oc set env deploy/external-secrets-operator-controller-manager -n external-secrets-operator --list | grep -e OPERATOR_LOG_LEVEL -e containerThe following example verifies that the log level of the External Secrets Operator for Red Hat OpenShift is updated.
# deployments/external-secrets-operator-controller-manager, container manager OPERATOR_LOG_LEVEL=2 -
Verify that the log level of the External Secrets Operator for Red Hat OpenShift is updated by running the
oc logscommand:$ oc logs -n external-secrets-operator -f deployments/external-secrets-operator-controller-manager -c manager
Setting a log level for the External Secrets Operator for Red Hat OpenShift operand
Set the log level for the External Secrets Operator for Red Hat OpenShift operand to control the verbosity of log messages. By doing this task, you can adjust the amount of detail recorded for troubleshooting or monitoring purposes.
-
You have access to the cluster with
cluster-adminprivileges. -
You have created the
ExternalSecretsConfigcustom resource.
-
Edit the
ExternalSecretsConfigCR by running the following command:$ oc edit externalsecretsconfigs.operator.openshift.io cluster -
Set the log level value by editing the
spec.appConfig.logLevelsection:apiVersion: operator.openshift.io/v1alpha1 kind: ExternalSecretsConfig ... spec: appConfig: logLevel: <log_level>- Supports the value range of 1-5. The log level gets mapped to the following operand support levels:
-
1 - warnings
-
2 - error logs
-
3 - info logs
-
4 and 5 - debug logs
-
- Supports the value range of 1-5. The log level gets mapped to the following operand support levels:
-
Save your changes and exit the editor.
Configuring cert-manager for the external-secrets certificate requirements
Configure cert-manager to handle certificate management for the external-secrets webhook and plugins. This optional configuration automates certificate generation for plugins and eliminates the need for manual configuration.
When cert-manager is not used, external-secrets defaults to its own certificate management. In this mode, it automatically generates the required certificates for the webhook, while you are responsible for manually configuring certificates for the plugins.
-
You have access to the cluster with
cluster-adminprivileges. -
You have created the
ExternalSecretsConfigcustom resource. -
You have installed the cert-manager Operator for Red Hat OpenShift. For more information, see "Installing the cert-manager Operator for Red Hat OpenShift"
-
Edit the
ExternalSecretsConfigcustom resource by running the following command:$ oc edit externalsecretsconfigs.operator.openshift.io cluster -
Configure
cert-managerby editing thespec.controllerConfig.certProvider.certManagersection as follows:apiVersion: operator.openshift.io/v1alpha1 kind: ExternalSecretsConfig ... spec: controllerConfig: certProvider: certManager: injectAnnotations: "true" issuerRef: name: <issuer_name> kind: <issuer_kind> group: <issuer_group> mode: Enabledwhere:
- injectAnnotation
-
Must be set to
truewhen enabled. - name
-
Specifies the name of the issuer object referenced in
ExternalSecretsConfig. - kind
-
Specifies the API issuer. Can be set to either
IssuerorClusterIssuer. - group
-
Specifies the API issuer group. The group name must be
cert-manager.io. - mode
-
Must be set to
Enabled. This is an immutable field and cannot be modified once it is configured.
-
Save your changes.
-
After you update the
cert-managerconfigurations in theexternalsecretsconfig.operator.openshift.ioobject, you must manually deleteexternal-secrets-cert-controllerdeployment by running the following command. This prevents performance degradation of theexternal-secretsapplication.$ oc delete deployments.apps external-secrets-cert-controller -n external-secrets -
Optionally, you can delete other resources created for the
cert-controllerby running the following commands:$ oc delete clusterrolebindings.rbac.authorization.k8s.io external-secrets-cert-controller$ oc delete clusterroles.rbac.authorization.k8s.io external-secrets-cert-controller$ oc delete serviceaccounts external-secrets-cert-controller -n external-secrets$ oc delete secrets external-secrets-webhook -n external-secrets
Configuring the bitwardenSecretManagerProvider plugin
Configure the bitwardenSecretManagerProvider plugin to use Bitwarden Secrets Manager as a source for your secrets. By using this integration, you can sync external secrets to your OpenShift Container Platform cluster.
-
You have access to the cluster with
cluster-adminprivileges. -
You have created the
ExternalSecretsConfigcustom resource.
-
Edit the
ExternalSecretsConfigcustom resource by running the following command:$ oc edit externalsecretsconfigs.operator.openshift.io cluster -
Edit the
spec.plugins.bitwardenSecretManagerProvidersection as follows to enable the Bitwarden Secrets Manager:apiVersion: operator.openshift.io/v1alpha1 kind: ExternalSecretsConfig ... spec: plugins: bitwardenSecretManagerProvider: mode: Enabled secretRef: name: <secret_object_name>where:
- name
-
The name of the secret containing the certificate key pair for the plugin. The key name in the secret for the certificate must be
tls.crt. The key name for the private key must betls.key. The key name for the Certificate Authority (CA) certificate key name must beca.crt. Configuring the secret is optional when the cert-manager certificate provider is configured.
-
Save your changes and exit the editor.
-
If you disable the plugin the following resources must be deleted manually by running the following commands:
$ oc delete deployments.apps bitwarden-sdk-server -n external-secrets
$ oc delete certificates.cert-manager.io bitwarden-tls-certs -n external-secrets
$ oc delete service bitwarden-sdk-server -n external-secrets
$ oc delete serviceaccounts bitwarden-sdk-server -n external-secrets