Skip to content

Add support for configuring environment variables for operators#1718

Open
lmiccini wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
lmiccini:operator_env_vars
Open

Add support for configuring environment variables for operators#1718
lmiccini wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
lmiccini:operator_env_vars

Conversation

@lmiccini
Copy link
Copy Markdown
Contributor

@lmiccini lmiccini commented Dec 3, 2025

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:

    apiVersion: operator.openstack.org/v1beta1
    kind: OpenStack
    metadata:
      name: openstack
    spec:
      operatorOverrides:
      - name: infra
        controllerManager:
          env:
          - name: SOME_ENV_VAR
            value: "some-value"

Co-Authored-By: Claude noreply@anthropic.com

@openshift-ci openshift-ci bot requested review from fultonj and rabi December 3, 2025 06:45
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Dec 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lmiccini
Once this PR has been reviewed and has the lgtm label, please assign abays for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lmiccini lmiccini requested review from abays and stuggi and removed request for fultonj and rabi December 3, 2025 06:49
Comment thread config/operator/deployment/kustomization.yaml
Comment thread config/operator/rabbit.yaml Outdated
@dprince
Copy link
Copy Markdown
Contributor

dprince commented Jan 26, 2026

@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).

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 9, 2026

@lmiccini: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/openstack-operator-build-deploy-kuttl 478deb4 link true /test openstack-operator-build-deploy-kuttl

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

OpenStackControlPlane CRD Size Report

Metric Value
CRD JSON size 322326 bytes (315KB)
Base branch size 322326 bytes
Change +0.00%
Status yellow — growing
Threshold reference
Color Range Meaning
🟢 green < 300KB Comfortable
🟡 yellow 300–400KB Growing
🟠 orange 400–750KB Concerning
🔴 red > 750KB Approaching 1.5MB etcd limit (cut in half to allow space for update)

@lmiccini
Copy link
Copy Markdown
Contributor Author

@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).

indeed, removed references to the rabbitmq cluster operator and made this generic.

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/a7b40406b88d450eb96700b7e4978017

openstack-k8s-operators-content-provider FAILURE in 3m 56s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ adoption-standalone-to-crc-ceph-provider SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-edpm-baremetal-minor-update SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

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:

apiVersion: operator.openstack.org/v1beta1
kind: OpenStack
metadata:
  name: openstack
spec:
  operatorOverrides:
  - name: infra
    controllerManager:
      env:
      - name: SOME_ENV_VAR
        value: "some-value"

Co-Authored-By: Claude <noreply@anthropic.com>
@lmiccini lmiccini force-pushed the operator_env_vars branch from 929f330 to a7cbd9b Compare April 14, 2026 04:45
@softwarefactory-project-zuul
Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/1b82d221e84546d09d8ac09deeb598fd

openstack-k8s-operators-content-provider FAILURE in 3m 53s
⚠️ podified-multinode-edpm-deployment-crc SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cifmw-crc-podified-edpm-baremetal SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ adoption-standalone-to-crc-ceph-provider SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-tempest-multinode SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ openstack-operator-edpm-baremetal-minor-update SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants