Skip to content

feat: add proxy env var support for EDA containers#341

Open
jamesmarshall24 wants to merge 2 commits intoansible:mainfrom
jamesmarshall24:AAP-71680
Open

feat: add proxy env var support for EDA containers#341
jamesmarshall24 wants to merge 2 commits intoansible:mainfrom
jamesmarshall24:AAP-71680

Conversation

@jamesmarshall24
Copy link
Copy Markdown
Contributor

@jamesmarshall24 jamesmarshall24 commented Apr 14, 2026

Add http_proxy, https_proxy, and no_proxy CRD fields to the EDA spec.

Add the proxy-aware OLM annotation to the CSV so that OLM injects cluster proxy configuration into the operator manager pod.

Summary by CodeRabbit

  • New Features

    • Added proxy configuration options: http_proxy, https_proxy, and no_proxy (including bypass list).
    • Containers now receive proxy environment variables (both upper- and lowercase) when configured.
    • Operator metadata marked as proxy-aware.
    • Sample config includes commented proxy examples.
  • Chores

    • Added defaults that resolve proxy values from environment variables.
  • Tests

    • Added tests to validate proxy env var injection across deployments.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 20122b10-05bd-4b5c-bfdd-831d6bc3d41b

📥 Commits

Reviewing files that changed from the base of the PR and between 383659a and 34b9ca2.

📒 Files selected for processing (9)
  • config/crd/bases/eda.ansible.com_edas.yaml
  • config/manifests/bases/eda-server-operator.clusterserviceversion.yaml
  • config/samples/eda_v1alpha1_eda.yaml
  • molecule/default/tasks/proxy_env_var_test.yml
  • roles/eda/defaults/main.yml
  • roles/eda/templates/eda-activation-worker.deployment.yaml.j2
  • roles/eda/templates/eda-api.deployment.yaml.j2
  • roles/eda/templates/eda-default-worker.deployment.yaml.j2
  • roles/eda/templates/eda-event-stream.deployment.yaml.j2
✅ Files skipped from review due to trivial changes (3)
  • config/samples/eda_v1alpha1_eda.yaml
  • config/crd/bases/eda.ansible.com_edas.yaml
  • molecule/default/tasks/proxy_env_var_test.yml
🚧 Files skipped from review as they are similar to previous changes (5)
  • roles/eda/templates/eda-default-worker.deployment.yaml.j2
  • roles/eda/defaults/main.yml
  • config/manifests/bases/eda-server-operator.clusterserviceversion.yaml
  • roles/eda/templates/eda-api.deployment.yaml.j2
  • roles/eda/templates/eda-event-stream.deployment.yaml.j2

📝 Walkthrough

Walkthrough

Adds three optional proxy fields (http_proxy, https_proxy, no_proxy) to the EDA CRD and sample, marks the operator as proxy-aware, provides role defaults reading env vars, injects proxy env vars (upper/lowercase) into multiple deployment templates, and adds a Molecule test validating env injection.

Changes

Cohort / File(s) Summary
CRD Schema
config/crd/bases/eda.ansible.com_edas.yaml
Added three optional string spec properties: http_proxy, https_proxy, no_proxy.
CSV / Operator Metadata
config/manifests/bases/eda-server-operator.clusterserviceversion.yaml
Added annotation operators.openshift.io/infrastructure-features: '["proxy-aware"]' and specDescriptors for http_proxy, https_proxy, no_proxy (advanced text fields).
Role Defaults
roles/eda/defaults/main.yml
Added default variables http_proxy, https_proxy, no_proxy that resolve from env (http_proxy/HTTP_PROXY, etc.) or empty string.
Deployment Templates
roles/eda/templates/eda-api.deployment.yaml.j2, roles/eda/templates/eda-default-worker.deployment.yaml.j2, roles/eda/templates/eda-activation-worker.deployment.yaml.j2, roles/eda/templates/eda-event-stream.deployment.yaml.j2
Conditionally inject proxy env vars (both uppercase and lowercase forms) into init and main containers' env lists when template vars are set.
Sample
config/samples/eda_v1alpha1_eda.yaml
Added commented example block showing http_proxy, https_proxy, no_proxy under spec.
Molecule Tests
molecule/default/tasks/proxy_env_var_test.yml
New test patches the sample CR with proxy values, waits for Deployments to update, and asserts presence and exact values of HTTP_PROXY/http_proxy, HTTPS_PROXY/https_proxy, NO_PROXY/no_proxy across target deployments, then clears them.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant K8s as Kubernetes API
    participant Operator
    participant Templates as Template Engine
    participant Deploy as Deployments/Pods

    User->>K8s: Apply/Patch EDA CR (includes proxy fields)
    K8s->>Operator: Notify CR create/update
    Operator->>Templates: Render manifests using CR values/defaults
    Templates->>K8s: Apply Deployments with injected env vars
    K8s->>Deploy: Schedule Pods from Deployments
    Deploy->>Deploy: Containers receive HTTP_PROXY/https_proxy/NO_PROXY env vars
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and concisely summarizes the main change: adding proxy environment variable support for EDA containers, which is reflected across CRD updates, deployment templates, and test additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
config/manifests/bases/eda-server-operator.clusterserviceversion.yaml (1)

7-7: Add CSV specDescriptors for the proxy configuration fields.

The CRD exposes http_proxy, https_proxy, and no_proxy fields, but the CSV lacks matching specDescriptors in the EDA spec section. This makes the proxy configuration options invisible in the OpenShift Console form.

Suggested CSV entries
- displayName: HTTP Proxy
  path: http_proxy
  x-descriptors:
  - urn:alm:descriptor:com.tectonic.ui:advanced
  - urn:alm:descriptor:com.tectonic.ui:text
- displayName: HTTPS Proxy
  path: https_proxy
  x-descriptors:
  - urn:alm:descriptor:com.tectonic.ui:advanced
  - urn:alm:descriptor:com.tectonic.ui:text
- displayName: No Proxy
  path: no_proxy
  x-descriptors:
  - urn:alm:descriptor:com.tectonic.ui:advanced
  - urn:alm:descriptor:com.tectonic.ui:text
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/manifests/bases/eda-server-operator.clusterserviceversion.yaml` at
line 7, The CSV is missing specDescriptors for the CRD proxy fields so the
OpenShift Console form doesn't show http_proxy, https_proxy, and no_proxy;
update the ClusterServiceVersion spec (the EDA spec section) to add
specDescriptor entries for path: http_proxy, path: https_proxy, and path:
no_proxy, each with displayName ("HTTP Proxy", "HTTPS Proxy", "No Proxy") and
x-descriptors including urn:alm:descriptor:com.tectonic.ui:advanced and
urn:alm:descriptor:com.tectonic.ui:text so the fields become visible/editable in
the console.
roles/eda/defaults/main.yml (1)

151-155: Consider whether operand proxy config should auto-inherit from the operator pod environment.

Currently, http_proxy, https_proxy, and no_proxy default to empty strings. Since templates use {% if http_proxy %} conditionals (which treat empty strings as falsy), these variables only render proxy env settings when explicitly set in the EDA CR. No mechanism exists to inherit proxy configuration from the operator pod environment—there are no lookup('env', ...) calls in the codebase.

In proxied clusters, this means operand workloads will not automatically get the same proxy settings as the operator pod unless the CR is updated. This design is safe and allows independent proxy configuration, but it may be worth clarifying in documentation or considering whether auto-inheritance via lookup() would improve usability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@roles/eda/defaults/main.yml` around lines 151 - 155, The defaults currently
set http_proxy, https_proxy, and no_proxy to empty strings so template
conditionals like {% if http_proxy %} skip rendering unless the EDA CR
explicitly sets them; to enable auto-inheritance from the operator pod
environment, change the defaults to read the env via lookup('env', ...) (e.g.,
set http_proxy: "{{ lookup('env','http_proxy') | default('') }}", and similarly
for https_proxy and no_proxy) so templates will render proxy env vars when the
operator has them while still allowing CR overrides; update the variables named
http_proxy, https_proxy, and no_proxy in defaults/main.yml and ensure templates
keep their existing {% if http_proxy %} checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@config/manifests/bases/eda-server-operator.clusterserviceversion.yaml`:
- Line 7: The CSV is missing specDescriptors for the CRD proxy fields so the
OpenShift Console form doesn't show http_proxy, https_proxy, and no_proxy;
update the ClusterServiceVersion spec (the EDA spec section) to add
specDescriptor entries for path: http_proxy, path: https_proxy, and path:
no_proxy, each with displayName ("HTTP Proxy", "HTTPS Proxy", "No Proxy") and
x-descriptors including urn:alm:descriptor:com.tectonic.ui:advanced and
urn:alm:descriptor:com.tectonic.ui:text so the fields become visible/editable in
the console.

In `@roles/eda/defaults/main.yml`:
- Around line 151-155: The defaults currently set http_proxy, https_proxy, and
no_proxy to empty strings so template conditionals like {% if http_proxy %} skip
rendering unless the EDA CR explicitly sets them; to enable auto-inheritance
from the operator pod environment, change the defaults to read the env via
lookup('env', ...) (e.g., set http_proxy: "{{ lookup('env','http_proxy') |
default('') }}", and similarly for https_proxy and no_proxy) so templates will
render proxy env vars when the operator has them while still allowing CR
overrides; update the variables named http_proxy, https_proxy, and no_proxy in
defaults/main.yml and ensure templates keep their existing {% if http_proxy %}
checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0f2aa86-3077-4951-a2ee-f8f87130b124

📥 Commits

Reviewing files that changed from the base of the PR and between c069798 and b9e4d45.

📒 Files selected for processing (7)
  • config/crd/bases/eda.ansible.com_edas.yaml
  • config/manifests/bases/eda-server-operator.clusterserviceversion.yaml
  • roles/eda/defaults/main.yml
  • roles/eda/templates/eda-activation-worker.deployment.yaml.j2
  • roles/eda/templates/eda-api.deployment.yaml.j2
  • roles/eda/templates/eda-default-worker.deployment.yaml.j2
  • roles/eda/templates/eda-event-stream.deployment.yaml.j2

@jamesmarshall24 jamesmarshall24 force-pushed the AAP-71680 branch 2 times, most recently from 551b2bb to d484073 Compare April 16, 2026 23:26
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
roles/eda/templates/eda-api.deployment.yaml.j2 (1)

324-341: Proxy vars not injected for init containers (run-migrations, eda-initial-data).

Same note as event-stream: create_initial_data and collectstatic in eda-initial-data could in some environments need outbound access. If that’s intentionally excluded, ignore; otherwise consider mirroring the same conditional block into those init container env lists.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@roles/eda/templates/eda-api.deployment.yaml.j2` around lines 324 - 341, The
init containers run-migrations and eda-initial-data are missing the conditional
proxy environment variables block, so create_initial_data and collectstatic
inside eda-initial-data (and any network-using logic in run-migrations) may not
be able to reach external endpoints; copy the same conditional env block (the
HTTP_PROXY/https_proxy/NO_PROXY entries currently present for the main
container) into the env lists for the init containers named run-migrations and
eda-initial-data so those init containers receive HTTP_PROXY, http_proxy,
HTTPS_PROXY, https_proxy, NO_PROXY and no_proxy when the corresponding variables
(http_proxy, https_proxy, no_proxy) are defined.
molecule/default/tasks/proxy_env_var_test.yml (1)

33-129: Heavy duplication across four assert blocks — consider a loop.

The four wait/assert blocks are near-identical apart from the component label and register var. A single loop: over a list of {component, expected_http, expected_no_proxy} dicts would cut ~100 lines and make future additions trivial. Non-blocking.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@molecule/default/tasks/proxy_env_var_test.yml` around lines 33 - 129, Replace
the four nearly identical "Wait for proxy vars" + "Assert all 6 proxy vars"
blocks with a single pair of tasks that iterate over a list of component
definitions (e.g., items with keys component and fail_msg or name) — use one
kubernetes.core.k8s_info task with loop over the components (registering a
single variable like deployment_result per item) and one ansible.builtin.assert
task that also loops over the same list and asserts the six env vars against the
expected values using item.component to index into
deployment_result.resources[0].spec.template.spec.containers[0].env; keep the
same filter expressions (selectattr('name','equalto') | map(attribute='value') |
first == 'http://localhost:3128' and for NO_PROXY/no_proxy) and reuse the
original fail messages by referencing item.fail_msg so behavior and checks for
api_deployment, default_worker_deployment, activation_worker_deployment, and
event_stream_deployment are preserved but deduplicated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@molecule/default/tasks/proxy_env_var_test.yml`:
- Around line 2-13: The test currently patches the EDA CR in the task named
"Patch EDA CR to set proxy env vars" leaving spec.http_proxy, spec.https_proxy
and spec.no_proxy set to localhost:3128, which breaks later tasks; add a
follow-up cleanup task (e.g. "Revert proxy env vars on EDA CR") that uses
kubernetes.core.k8s with state: patched against the same
api_version/kind/name/namespace and sets spec.http_proxy: '', spec.https_proxy:
'' and spec.no_proxy: '' so the CR is restored after the test; ensure the
cleanup task runs after the patch (append to the same playbook or mark as last).

---

Nitpick comments:
In `@molecule/default/tasks/proxy_env_var_test.yml`:
- Around line 33-129: Replace the four nearly identical "Wait for proxy vars" +
"Assert all 6 proxy vars" blocks with a single pair of tasks that iterate over a
list of component definitions (e.g., items with keys component and fail_msg or
name) — use one kubernetes.core.k8s_info task with loop over the components
(registering a single variable like deployment_result per item) and one
ansible.builtin.assert task that also loops over the same list and asserts the
six env vars against the expected values using item.component to index into
deployment_result.resources[0].spec.template.spec.containers[0].env; keep the
same filter expressions (selectattr('name','equalto') | map(attribute='value') |
first == 'http://localhost:3128' and for NO_PROXY/no_proxy) and reuse the
original fail messages by referencing item.fail_msg so behavior and checks for
api_deployment, default_worker_deployment, activation_worker_deployment, and
event_stream_deployment are preserved but deduplicated.

In `@roles/eda/templates/eda-api.deployment.yaml.j2`:
- Around line 324-341: The init containers run-migrations and eda-initial-data
are missing the conditional proxy environment variables block, so
create_initial_data and collectstatic inside eda-initial-data (and any
network-using logic in run-migrations) may not be able to reach external
endpoints; copy the same conditional env block (the
HTTP_PROXY/https_proxy/NO_PROXY entries currently present for the main
container) into the env lists for the init containers named run-migrations and
eda-initial-data so those init containers receive HTTP_PROXY, http_proxy,
HTTPS_PROXY, https_proxy, NO_PROXY and no_proxy when the corresponding variables
(http_proxy, https_proxy, no_proxy) are defined.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 40da8f3a-1984-42d0-b947-57a66b464c5a

📥 Commits

Reviewing files that changed from the base of the PR and between 85bd194 and d484073.

📒 Files selected for processing (9)
  • config/crd/bases/eda.ansible.com_edas.yaml
  • config/manifests/bases/eda-server-operator.clusterserviceversion.yaml
  • config/samples/eda_v1alpha1_eda.yaml
  • molecule/default/tasks/proxy_env_var_test.yml
  • roles/eda/defaults/main.yml
  • roles/eda/templates/eda-activation-worker.deployment.yaml.j2
  • roles/eda/templates/eda-api.deployment.yaml.j2
  • roles/eda/templates/eda-default-worker.deployment.yaml.j2
  • roles/eda/templates/eda-event-stream.deployment.yaml.j2
✅ Files skipped from review due to trivial changes (2)
  • config/samples/eda_v1alpha1_eda.yaml
  • config/crd/bases/eda.ansible.com_edas.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • roles/eda/templates/eda-default-worker.deployment.yaml.j2
  • roles/eda/defaults/main.yml

Comment thread molecule/default/tasks/proxy_env_var_test.yml
Add http_proxy, https_proxy, and no_proxy CRD fields to the EDA spec.

Add the proxy-aware OLM annotation to the CSV so that OLM injects
cluster proxy configuration into the operator manager pod.

Assisted by: Claude

Signed-off-by: James Marshall <jamarsha@redhat.com>
Add the proxy env block to all init containers that may make outbound
network calls in proxy-required environments:

- eda-api: run-migrations and eda-initial-data (collectstatic)
- eda-event-stream: wait-for-migrations
- eda-default-worker: wait-for-migrations
- eda-activation-worker: wait-for-migrations

The configure-bundle-ca-cert init container is intentionally excluded
as it does not make network calls.

Assisted by: Claude

Signed-off-by: James Marshall <jamarsha@redhat.com>
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant