Add support for configuring environment variables for operators#1718
Add support for configuring environment variables for operators#1718lmiccini wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lmiccini The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
787001c to
0515f90
Compare
This change allows users to specify custom environment variables for
operator containers through the operatorOverrides field in the OpenStack
CR.
Changes:
- Add Env field to ContainerSpec in the API types
- Implement mergeEnvVars() to merge custom environment variables with defaults
- Update SetOverrides() to apply environment variable overrides
- Enhance operator deployment templates to support both Value and ValueFrom
for environment variables (supporting secrets, configmaps, and field refs)
Usage example - Configure OPERATOR_SCOPE_NAMESPACE for rabbitmq-cluster-operator:
apiVersion: operator.openstack.org/v1beta1
kind: OpenStack
metadata:
name: openstack
spec:
operatorOverrides:
- name: rabbitmq-cluster
controllerManager:
env:
- name: OPERATOR_SCOPE_NAMESPACE
value: "namespace1,namespace2,namespace3"
Co-Authored-By: Claude <noreply@anthropic.com>
0515f90 to
478deb4
Compare
|
@lmiccini: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
| fieldPath: metadata.namespace | ||
| {{- range .RabbitmqOperator.Deployment.Manager.Env }} | ||
| - name: '{{ .Name }}' | ||
| {{- if .Value }} |
There was a problem hiding this comment.
I guess we want the same in config/operator/managers.yaml for the other operator deployments?
|
@lmiccini as a generate feature what you have here is good. and we could add it. I'm not sure about the use case mentioned in the PR for rabbitmq/cluster-operator. If the intent is to allow multiple rabbit operators within a cluster that would be dangerous due to there being only 1 CRD per OCP cluster (the CRDs could be different version, etc). |
This change allows users to specify custom environment variables for operator containers through the operatorOverrides field in the OpenStack CR.
Changes:
Usage example - Configure OPERATOR_SCOPE_NAMESPACE for rabbitmq-cluster-operator:
Co-Authored-By: Claude noreply@anthropic.com