Skip to content

feat(must-gather): allow passing extra env vars to the must-gather container#345

Merged
rm3l merged 1 commit intoredhat-developer:mainfrom
rm3l:feat/allow_passing_extra_env_vars_to_the_must_gather
Mar 31, 2026
Merged

feat(must-gather): allow passing extra env vars to the must-gather container#345
rm3l merged 1 commit intoredhat-developer:mainfrom
rm3l:feat/allow_passing_extra_env_vars_to_the_must_gather

Conversation

@rm3l
Copy link
Copy Markdown
Member

@rm3l rm3l commented Mar 31, 2026

Description of the change

Allow passing extra env vars to the must-gather container. Can be useful for additional configuration options.

Which issue(s) does this PR fix or relate to

How to test changes / Special notes to the reviewer

Checklist

  • For each Chart updated, version bumped in the corresponding Chart.yaml according to Semantic Versioning.
  • For each Chart updated, variables are documented in the values.yaml and added to the corresponding README.md. The pre-commit utility can be used to generate the necessary content. Run pre-commit run --all-files to run the hooks and then push any resulting changes. The pre-commit Workflow will enforce this and warn you if needed.
  • JSON Schema template updated and re-generated the raw schema via the pre-commit hook.
  • Tests pass using the Chart Testing tool and the ct lint command.
  • If you updated the orchestrator-infra chart, make sure the versions of the Knative CRDs are aligned with the versions of the CRDs installed by the OpenShift Serverless operators declared in the values.yaml file. See Installing Knative Eventing and Knative Serving CRDs for more details.

@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge bot commented Mar 31, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Schema omits extraEnvVars 🐞 Bug ⚙ Maintainability
Description
The chart renders .Values.gather.extraEnvVars into the gather initContainer, but
gather.extraEnvVars is not defined in values.schema.tmpl.json (and thus not present in the
generated values.schema.json). As a result, schema-driven UIs/validators won’t know about this new
value even though it is documented and used by templates.
Code

charts/must-gather/values.yaml[R99-112]

+  # -- Additional environment variables to pass to the gather init container.<br/>
+  # Example:<br/>
+  # ```
+  # extraEnvVars:
+  #   - name: MY_VAR
+  #     value: "my-value"
+  #   - name: MY_SECRET_VAR
+  #     valueFrom:
+  #       secretKeyRef:
+  #         name: my-secret
+  #         key: secret-key
+  # ```
+  extraEnvVars: []
+
Evidence
The deployment template consumes .Values.gather.extraEnvVars, and values.yaml
introduces/document this new value; however the schema template and generated schema do not contain
an extraEnvVars property under gather. The repo’s schema generation hook
(jsonschema-dereference.py) generates values.schema.json from values.schema.tmpl.json, so the
omission must be fixed in the template and then regenerated.

charts/must-gather/templates/deployment.yaml[42-73]
charts/must-gather/values.yaml[66-112]
charts/must-gather/values.schema.tmpl.json[253-269]
charts/must-gather/values.schema.json[821-922]
.pre-commit/jsonschema-dereference.py[13-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`gather.extraEnvVars` is added to `values.yaml` and used in the deployment template, but it is not defined in `values.schema.tmpl.json`, so it will not appear in the generated `values.schema.json`.

### Issue Context
This repo generates `charts/*/values.schema.json` from `values.schema.tmpl.json` via `.pre-commit/jsonschema-dereference.py`. The fix must go into the schema *template* and then regenerate/commit the resulting `values.schema.json`.

### Fix Focus Areas
- charts/must-gather/values.schema.tmpl.json[253-269]
- charts/must-gather/values.schema.json[821-922]

### What to change
1. Add a `gather.extraEnvVars` schema entry in `values.schema.tmpl.json`, ideally typed as an array of Kubernetes EnvVar objects, e.g. using the same upstream ref used elsewhere in the repo:
  - items `$ref`: `https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.33.4/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar`
2. Run `pre-commit run --all-files` (or run the jsonschema dereference hook) to regenerate `charts/must-gather/values.schema.json` and commit the updated generated file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Grey Divider

Previous review results

Review updated until commit 6cc0a2e

Results up to commit f061988


🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider
Action required
1. Schema omits extraEnvVars 🐞 Bug ⚙ Maintainability
Description
The chart renders .Values.gather.extraEnvVars into the gather initContainer, but
gather.extraEnvVars is not defined in values.schema.tmpl.json (and thus not present in the
generated values.schema.json). As a result, schema-driven UIs/validators won’t know about this new
value even though it is documented and used by templates.
Code

charts/must-gather/values.yaml[R99-112]

+  # -- Additional environment variables to pass to the gather init container.<br/>
+  # Example:<br/>
+  # ```
+  # extraEnvVars:
+  #   - name: MY_VAR
+  #     value: "my-value"
+  #   - name: MY_SECRET_VAR
+  #     valueFrom:
+  #       secretKeyRef:
+  #         name: my-secret
+  #         key: secret-key
+  # ```
+  extraEnvVars: []
+
Evidence
The deployment template consumes .Values.gather.extraEnvVars, and values.yaml
introduces/document this new value; however the schema template and generated schema do not contain
an extraEnvVars property under gather. The repo’s schema generation hook
(jsonschema-dereference.py) generates values.schema.json from values.schema.tmpl.json, so the
omission must be fixed in the template and then regenerated.

charts/must-gather/templates/deployment.yaml[42-73]
charts/must-gather/values.yaml[66-112]
charts/must-gather/values.schema.tmpl.json[253-269]
charts/must-gather/values.schema.json[821-922]
.pre-commit/jsonschema-dereference.py[13-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`gather.extraEnvVars` is added to `values.yaml` and used in the deployment template, but it is not defined in `values.schema.tmpl.json`, so it will not appear in the generated `values.schema.json`.

### Issue Context
This repo generates `charts/*/values.schema.json` from `values.schema.tmpl.json` via `.pre-commit/jsonschema-dereference.py`. The fix must go into the schema *template* and then regenerate/commit the resulting `values.schema.json`.

### Fix Focus Areas
- charts/must-gather/values.schema.tmpl.json[253-269]
- charts/must-gather/values.schema.json[821-922]

### What to change
1. Add a `gather.extraEnvVars` schema entry in `values.schema.tmpl.json`, ideally typed as an array of Kubernetes EnvVar objects, e.g. using the same upstream ref used elsewhere in the repo:
  - items `$ref`: `https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.33.4/_definitions.json#/definitions/io.k8s.api.core.v1.EnvVar`
2. Run `pre-commit run --all-files` (or run the jsonschema dereference hook) to regenerate `charts/must-gather/values.schema.json` and commit the updated generated file.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider Grey Divider

Qodo Logo

@rhdh-qodo-merge
Copy link
Copy Markdown

Review Summary by Qodo

Add extra environment variables support to must-gather chart

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add support for passing extra environment variables to must-gather container
• Enable flexible configuration through gather.extraEnvVars parameter
• Support both direct values and secret references for env vars
• Bump chart version from 0.1.0 to 0.2.0
Diagram
flowchart LR
  A["values.yaml<br/>extraEnvVars config"] -- "template rendering" --> B["deployment.yaml<br/>env vars injection"]
  B -- "applied to" --> C["must-gather container<br/>with custom env vars"]
Loading

Grey Divider

File Changes

1. charts/must-gather/Chart.yaml ⚙️ Configuration changes +1/-1

Update chart version to 0.2.0

• Bumped chart version from 0.1.0 to 0.2.0 following semantic versioning

charts/must-gather/Chart.yaml


2. charts/must-gather/README.md 📝 Documentation +4/-3

Update documentation for extraEnvVars feature

• Updated version badge from 0.1.0 to 0.2.0
• Updated installation command example to use new version
• Added documentation for new gather.extraEnvVars parameter with examples
• Documented support for both direct values and secret references

charts/must-gather/README.md


3. charts/must-gather/templates/deployment.yaml ✨ Enhancement +3/-0

Inject extra environment variables into deployment

• Added template block to inject gather.extraEnvVars into container environment
• Uses toYaml filter to properly format environment variable definitions
• Positioned after existing MUST_GATHER environment variables

charts/must-gather/templates/deployment.yaml


View more (1)
4. charts/must-gather/values.yaml ✨ Enhancement +14/-0

Add extraEnvVars configuration parameter

• Added new gather.extraEnvVars parameter with default empty list
• Included comprehensive documentation with usage examples
• Demonstrated both direct value assignment and secret reference patterns

charts/must-gather/values.yaml


Grey Divider

Qodo Logo

@rhdh-qodo-merge rhdh-qodo-merge bot added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 31, 2026
@rm3l rm3l force-pushed the feat/allow_passing_extra_env_vars_to_the_must_gather branch 3 times, most recently from 65a6aeb to 6cc0a2e Compare March 31, 2026 11:22
@rm3l
Copy link
Copy Markdown
Member Author

rm3l commented Mar 31, 2026

/agentic_review

@rhdh-qodo-merge
Copy link
Copy Markdown

rhdh-qodo-merge bot commented Mar 31, 2026

Persistent review updated to latest commit 6cc0a2e

@rm3l rm3l force-pushed the feat/allow_passing_extra_env_vars_to_the_must_gather branch from 6cc0a2e to 9178925 Compare March 31, 2026 11:35
@sonarqubecloud
Copy link
Copy Markdown

@rm3l rm3l added the lgtm label Mar 31, 2026
@rm3l rm3l merged commit d8ce35a into redhat-developer:main Mar 31, 2026
5 of 6 checks passed
@rm3l rm3l deleted the feat/allow_passing_extra_env_vars_to_the_must_gather branch March 31, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request lgtm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant