Skip to content

csv-generator: Support additional images as env vars#158

Merged
tiraboschi merged 2 commits intoopenshift-virtualization:mainfrom
nirdothan:network-resources-injector-image
May 7, 2026
Merged

csv-generator: Support additional images as env vars#158
tiraboschi merged 2 commits intoopenshift-virtualization:mainfrom
nirdothan:network-resources-injector-image

Conversation

@nirdothan
Copy link
Copy Markdown
Contributor

@nirdothan nirdothan commented May 5, 2026

Add --additional-images flag to csv-generator to pass multiple image
references to the virt-platform-autopilot operator via environment
variables using comma-separated ENVKEY:image pairs.

The flag format is: ENVKEY1:image1,ENVKEY2:image2,...

Each pair is parsed and injected as an environment variable in the
manager container's CSV deployment spec. Invalid pairs (missing colon,
empty key or value) are logged as warnings and skipped.

The csv-generator now also outputs a relatedImages section in the CSV
containing the operator image and all additional images. This allows
csv-merger in the HCO build pipeline to automatically merge relatedImages
from the autopilot CSV without manual intervention in Tekton tasks.

This provides a reusable mechanism for passing operator-managed image
references from the build pipeline to the operator runtime, enabling
air-gapped deployments with digest-resolved images. The parsing logic
lives in cmd/csv-generator/parser/ with comprehensive unit tests.

Testing

csv-generator \
  --csv-version=0.1.0 \
  --operator-image=quay.io/test/autopilot@sha256:abc123 \
  --additional-images=NETWORK_RESOURCES_INJECTOR_IMAGE:registry.redhat.io/openshift4/ose-sriov-dp-admission-controller-rhel9@sha256:def456

Output includes:

spec:
  install:
    spec:
      deployments:
      - spec:
          template:
            spec:
              containers:
              - env:
                - Name: NETWORK_RESOURCES_INJECTOR_IMAGE
                  Value: registry.redhat.io/openshift4/ose-sriov-dp-admission-controller-rhel9@sha256:def456
  relatedImages:
  - image: quay.io/test/autopilot@sha256:abc123
  - image: registry.redhat.io/openshift4/ose-sriov-dp-admission-controller-rhel9@sha256:def456

Dependencies

This PR enables the downstream hco-bundle-registry pipeline to:

  1. Pass resolved image digests to the operator via environment variables
  2. Have csv-merger automatically merge relatedImages from the autopilot CSV

@nirdothan
Copy link
Copy Markdown
Contributor Author

/cc @tiraboschi

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Generated Files Verification Failed

One or more generated files in this PR are out of sync:

  • CRDs: Run make update-crds if CRD verification failed
  • RBAC: Run make generate-rbac if RBAC verification failed

Please regenerate the files locally and commit the changes.

@nirdothan nirdothan force-pushed the network-resources-injector-image branch 2 times, most recently from 994b382 to 4db7417 Compare May 6, 2026 11:40
@nirdothan nirdothan changed the title csv-generator: Add network-resources-injector image support csv-generator: Support custom environment varibales May 6, 2026
@nirdothan nirdothan changed the title csv-generator: Support custom environment varibales csv-generator: Support additional images as env vars May 6, 2026
@nirdothan nirdothan force-pushed the network-resources-injector-image branch 2 times, most recently from 0cf9492 to 9415b97 Compare May 7, 2026 14:02
nirdothan added 2 commits May 7, 2026 17:13
Add --additional-images flag to csv-generator to pass multiple image
references to the virt-platform-autopilot operator via environment
variables using comma-separated ENVKEY:image pairs.

The flag format is: ENVKEY1:image1,ENVKEY2:image2,...

Each pair is parsed and injected as an environment variable in the
manager container's CSV deployment spec. Invalid pairs (missing colon,
empty key or value) are logged as warnings and skipped.

This provides a reusable mechanism for passing operator-managed image
references from the build pipeline to the operator runtime, enabling
air-gapped deployments with digest-resolved images. The parsing logic
lives in cmd/csv-generator/parser/ with comprehensive unit tests.

Signed-off-by: Nir Dothan <ndothan@redhat.com>
Assisted by: Claude Sonnet 4.5 <noreply@anthropic.com>
Add relatedImages section to the generated CSV containing the operator
image and any additional images passed via --additional-images. This
allows csv-merger to automatically merge the relatedImages from the
autopilot CSV without manual intervention in the Tekton pipeline.

The buildRelatedImages function constructs the list from:
1. The operator image (--operator-image)
2. All additional images from --additional-images (ENVKEY:image pairs)

Signed-off-by: Nir Dothan <ndothan@redhat.com>
@nirdothan nirdothan force-pushed the network-resources-injector-image branch from 9415b97 to c9ef85b Compare May 7, 2026 14:13
@tiraboschi tiraboschi merged commit ff89c80 into openshift-virtualization:main May 7, 2026
5 checks passed
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.

2 participants