Skip to content

OCPBUGS-99288: Add proxy env vars to AWS cloud-controller-manager deployment#9053

Open
PoornimaSingour wants to merge 2 commits into
openshift:mainfrom
PoornimaSingour:OCPBUGS-99288-ccm-proxy-env-vars
Open

OCPBUGS-99288: Add proxy env vars to AWS cloud-controller-manager deployment#9053
PoornimaSingour wants to merge 2 commits into
openshift:mainfrom
PoornimaSingour:OCPBUGS-99288-ccm-proxy-env-vars

Conversation

@PoornimaSingour

@PoornimaSingour PoornimaSingour commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The AWS Cloud Controller Manager (CCM) deployment was missing HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables when the management cluster is configured with a proxy. This was a regression from the v1 to v2 component framework migration where the proxy.SetEnvVars() call was not carried over.

This PR adds an adaptDeployment function that calls proxy.SetEnvVars() on the CCM container, following the same pattern used by other components (cloud-credential-operator, konnectivity, etc.).

Which issue(s) this PR fixes:

Fixes: https://redhat.atlassian.net/browse/OCPBUGS-99288

Special notes for your reviewer:

  • proxy.SetEnvVars() reads from os.Getenv("HTTP_PROXY") etc., which are inherited from the management cluster's proxy configuration. When no proxy is configured, the function is a no-op.
  • Verified on a live cluster (5.0.0-ec.4) that proxy env vars are correctly injected into the CCM container when the CPO process has proxy env vars set.
  • All 22 guest cluster operators were healthy after the change.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features
    • Added proxy environment variable support to the AWS cloud-controller-manager deployment, automatically configuring HTTP, HTTPS, and no-proxy behavior based on provided values.
  • Bug Fixes
    • Ensured cloud-controller-manager is updated with the correct proxy environment variables (including expected AWS-related proxy configuration behavior).
  • Tests
    • Added unit coverage validating proxy environment variables are applied or omitted correctly across multiple proxy scenarios.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@PoornimaSingour: This pull request references Jira Issue OCPBUGS-99288, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

The CCM deployment was missing HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables when the management cluster is configured with a proxy. This was a regression from the v1 to v2 component framework migration where the proxy.SetEnvVars() call was not carried over.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes : https://redhat.atlassian.net/browse/OCPBUGS-99288

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The AWS cloud-controller-manager component now registers a deployment adapter. The adapter targets the cloud-controller-manager container and injects proxy environment variables using proxy.SetEnvVars. Tests cover HTTP, HTTPS, NO_PROXY, and no-proxy configurations.

Suggested reviewers: clebs, sdminonne, muraee

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The new test mixes proxy injection checks with AWS env-var preservation in one subcase and most Expectations are bare, so diagnostics and single-responsibility are weak. Split AWS-env preservation into its own test/subtest, add meaningful messages to key Expectations, and keep each case focused on one behavior.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding proxy environment variables to the AWS cloud-controller-manager deployment.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The added test names are static t.Run strings; I found no fmt.Sprintf, random values, timestamps, or other dynamic title construction in the touched test file.
Topology-Aware Scheduling Compatibility ✅ Passed The PR only adds proxy env injection to the CCM container; it introduces no replicas, nodeSelectors, anti-affinity, or spread constraints.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only a unit test was added; no Ginkgo e2e test, IPv4-only networking, or external connectivity is present in the changed files.
No-Weak-Crypto ✅ Passed The new code only injects proxy env vars; no weak algorithms, custom crypto, or secret/token comparisons appear in the touched files or package.
Container-Privileges ✅ Passed AWS CCM manifest and new adaptDeployment only add proxy env vars; no privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation settings found.
No-Sensitive-Data-In-Logs ✅ Passed No logging was added in the changed files; the PR only wires proxy env vars into the CCM container and adds tests.
✨ 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.

@openshift-ci openshift-ci Bot added area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform and removed do-not-merge/needs-area labels Jul 22, 2026
@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: PoornimaSingour
Once this PR has been reviewed and has the lgtm label, please assign csrwng 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

@PoornimaSingour
PoornimaSingour marked this pull request as draft July 22, 2026 11:23
@openshift-ci
openshift-ci Bot requested review from jparrill and sdminonne July 22, 2026 11:23
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 22, 2026
@PoornimaSingour
PoornimaSingour force-pushed the OCPBUGS-99288-ccm-proxy-env-vars branch from 89370dd to 747e029 Compare July 22, 2026 11:34
@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 22, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@PoornimaSingour: This pull request references Jira Issue OCPBUGS-99288, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

The CCM deployment was missing HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables when the management cluster is configured with a proxy. This was a regression from the v1 to v2 component framework migration where the proxy.SetEnvVars() call was not carried over.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes : https://redhat.atlassian.net/browse/OCPBUGS-99288

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features

  • Added proxy environment variable support to the AWS cloud-controller-manager deployment.

  • Automatically configures HTTP, HTTPS, and no-proxy settings when provided.

  • Bug Fixes

  • Ensured local and Kubernetes API addresses remain excluded from proxy routing.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot

Copy link
Copy Markdown

@PoornimaSingour: This pull request references Jira Issue OCPBUGS-99288, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

The CCM deployment was missing HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables when the management cluster is configured with a proxy. This was a regression from the v1 to v2 component framework migration where the proxy.SetEnvVars() call was not carried over.

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes : https://redhat.atlassian.net/browse/OCPBUGS-99288

Special notes for your reviewer:

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features

  • Added proxy environment variable support to the AWS cloud-controller-manager deployment.

  • Automatically configures HTTP, HTTPS, and no-proxy settings when provided.

  • Bug Fixes

  • Ensured local and Kubernetes API addresses remain excluded from proxy routing.

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 openshift-eng/jira-lifecycle-plugin repository.

@PoornimaSingour

Copy link
Copy Markdown
Contributor Author

OCPBUGS-99288 — Complete Summary

Problem

AWS Cloud Controller Manager (CCM) deployment was missing HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables when the management cluster uses a proxy. Other components (CCO, CAPA, konnectivity) already had this — CCM was the gap.

Fix:

  1. component.go — Added .WithAdaptFunction(adaptDeployment) to the AWS CCM component builder chain
  2. deployment.go (new file) — adaptDeployment() calls proxy.SetEnvVars() on the cloud-controller-manager container, which reads proxy config from the CPO process environment and injects it into the container's env vars

Verified on Cluster:
Hosted Cluster

  • Name: proxy-test
  • Namespace: clusters
  • HCP Namespace: clusters-proxy-test
  • Branch: OCPBUGS-99288-ccm-proxy-env-vars
  • CPO image: quay.io/rhn_support_psingour/hypershift:OCPBUGS-99288-v3
  • Release image: 5.0.0-ec.4 (quay.io/openshift-release-dev/ocp-release@sha256:a6ba8...)
    Fix (2 files changed)

Testing Done

  • Unit test (deployment_test.go) — Proxy vars injected when set, not injected when absent. PASS.
  • On-cluster: CCM healthy — adaptDeployment wired in correctly, CCM runs 2/2 with no crashes. PASS.
  • On-cluster: Full cluster healthy — All 22 guest cluster operators Available, 2/2 nodes Ready, cluster Completed. PASS.
  • On-cluster: Proxy vars verified — Patched CPO with fake proxy env vars, CCM container got HTTP_PROXY, HTTPS_PROXY, NO_PROXY injected. PASS.

@PoornimaSingour
PoornimaSingour marked this pull request as ready for review July 23, 2026 08:38
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.51%. Comparing base (b5f3906) to head (4afcef2).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...plane/v2/cloud_controller_manager/aws/component.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9053      +/-   ##
==========================================
+ Coverage   44.50%   44.51%   +0.01%     
==========================================
  Files         774      775       +1     
  Lines       96980    97003      +23     
==========================================
+ Hits        43164    43184      +20     
- Misses      50828    50831       +3     
  Partials     2988     2988              
Files with missing lines Coverage Δ
...lane/v2/cloud_controller_manager/aws/deployment.go 100.00% <100.00%> (ø)
...plane/v2/cloud_controller_manager/aws/component.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

Flag Coverage Δ
cmd-support 38.39% <ø> (ø)
cpo-hostedcontrolplane 47.23% <83.33%> (+0.04%) ⬆️
cpo-other 45.25% <ø> (ø)
hypershift-operator 54.45% <ø> (+<0.01%) ⬆️
other 32.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-ci
openshift-ci Bot requested review from clebs and muraee July 23, 2026 08:38
…r deployment

  The CCM deployment was missing HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
  environment variables when the management cluster is configured with a
  proxy. This was a regression from the v1 to v2 component framework
  migration where the proxy.SetEnvVars() call was not carried over.
@PoornimaSingour
PoornimaSingour force-pushed the OCPBUGS-99288-ccm-proxy-env-vars branch from 747e029 to ec5ae7a Compare July 23, 2026 08:54

@jparrill jparrill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dropped a comment, please let me know for tagging. Thanks

httpsProxy string
noProxy string
validate func(*WithT, *corev1.Container)
}{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The two test cases cover the main paths well. A couple of optional suggestions if you want to strengthen coverage:

  1. Partial proxy: What happens when only HTTP_PROXY is set but HTTPS_PROXY is empty? proxy.SetEnvVars has a branch for this (if httpProxy != "" || httpsProxy != "").

  2. Existing env vars preserved: The CCM manifest already defines AWS_SHARED_CREDENTIALS_FILE, AWS_SDK_LOAD_CONFIG, and AWS_EC2_METADATA_DISABLED. Might be worth asserting those survive after adaptDeployment runs — the CCO tests do something similar.

Neither is blocking, the current coverage is reasonable for a bug fix.

…cases

Add test coverage for partial proxy configurations (HTTP_PROXY-only and
HTTPS_PROXY-only) and assert that existing AWS env vars are preserved
after proxy injection, addressing review feedback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@control-plane-operator/controllers/hostedcontrolplane/v2/cloud_controller_manager/aws/deployment_test.go`:
- Around line 51-83: Update the proxy test cases using the noProxy fixture to
include a distinct user-supplied entry such as api.internal.example.com, and
extend their validate callbacks to assert that entry remains in the generated
NO_PROXY value alongside localhost, 127.0.0.1, and kube-apiserver. Ensure the
assertions cover preservation of custom bypass entries, not only adapter-added
defaults.
🪄 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: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c5376068-fb8a-496a-92c3-ca9d1efef780

📥 Commits

Reviewing files that changed from the base of the PR and between ec5ae7a and 4afcef2.

📒 Files selected for processing (1)
  • control-plane-operator/controllers/hostedcontrolplane/v2/cloud_controller_manager/aws/deployment_test.go

Comment on lines +51 to +83
name: "When only HTTP_PROXY is set, it should add HTTP_PROXY and NO_PROXY but not HTTPS_PROXY",
httpProxy: "http://proxy.example.com:8080",
noProxy: "localhost,127.0.0.1",
validate: func(g *WithT, container *corev1.Container) {
httpProxy := podspec.FindEnvVar("HTTP_PROXY", container.Env)
g.Expect(httpProxy).ToNot(BeNil())
g.Expect(httpProxy.Value).To(Equal("http://proxy.example.com:8080"))

g.Expect(podspec.FindEnvVar("HTTPS_PROXY", container.Env)).To(BeNil())

noProxy := podspec.FindEnvVar("NO_PROXY", container.Env)
g.Expect(noProxy).ToNot(BeNil())
g.Expect(noProxy.Value).To(ContainSubstring("localhost"))
g.Expect(noProxy.Value).To(ContainSubstring("127.0.0.1"))
g.Expect(noProxy.Value).To(ContainSubstring("kube-apiserver"))
},
},
{
name: "When only HTTPS_PROXY is set, it should add HTTPS_PROXY and NO_PROXY but not HTTP_PROXY",
httpsProxy: "https://proxy.example.com:8443",
noProxy: "localhost,127.0.0.1",
validate: func(g *WithT, container *corev1.Container) {
g.Expect(podspec.FindEnvVar("HTTP_PROXY", container.Env)).To(BeNil())

httpsProxy := podspec.FindEnvVar("HTTPS_PROXY", container.Env)
g.Expect(httpsProxy).ToNot(BeNil())
g.Expect(httpsProxy.Value).To(Equal("https://proxy.example.com:8443"))

noProxy := podspec.FindEnvVar("NO_PROXY", container.Env)
g.Expect(noProxy).ToNot(BeNil())
g.Expect(noProxy.Value).To(ContainSubstring("localhost"))
g.Expect(noProxy.Value).To(ContainSubstring("127.0.0.1"))
g.Expect(noProxy.Value).To(ContainSubstring("kube-apiserver"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Test preservation of a user-supplied NO_PROXY entry.

The current values only contain defaults (localhost and 127.0.0.1) that the adapter adds itself. A regression dropping a custom bypass could therefore pass. Add a distinct entry such as api.internal.example.com and assert it remains alongside the required defaults.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@control-plane-operator/controllers/hostedcontrolplane/v2/cloud_controller_manager/aws/deployment_test.go`
around lines 51 - 83, Update the proxy test cases using the noProxy fixture to
include a distinct user-supplied entry such as api.internal.example.com, and
extend their validate callbacks to assert that entry remains in the generated
NO_PROXY value alongside localhost, 127.0.0.1, and kube-apiserver. Ensure the
assertions cover preservation of custom bypass entries, not only adapter-added
defaults.

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@PoornimaSingour: all tests passed!

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.

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

Labels

area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants