Skip to content

[WIP] Add optional cluster-wide proxy support for snc.sh#1237

Open
praveenkumar wants to merge 1 commit into
crc-org:release-4.21from
praveenkumar:add_proxy
Open

[WIP] Add optional cluster-wide proxy support for snc.sh#1237
praveenkumar wants to merge 1 commit into
crc-org:release-4.21from
praveenkumar:add_proxy

Conversation

@praveenkumar
Copy link
Copy Markdown
Member

@praveenkumar praveenkumar commented Jun 4, 2026

Allow provisioning behind an HTTP/HTTPS proxy via SNC_USE_PROXY, SNC_HTTP_PROXY, and SNC_HTTPS_PROXY. When enabled, patch install-config with proxy URLs and a noProxy list that includes the internal API (api-int..) plus standard cluster-local entries.

Summary by CodeRabbit

  • New Features
    • Introduced cluster-wide proxy configuration support during bundle and cluster installation via environment variables
    • New settings: SNC_USE_PROXY (enable/disable), SNC_HTTP_PROXY, and SNC_HTTPS_PROXY for configuring HTTP/HTTPS proxy endpoints
    • Users can set these variables before running installation to apply proxy settings
    • Documentation updated with proxy configuration examples and guidance

Allow provisioning behind an HTTP/HTTPS proxy via SNC_USE_PROXY,
SNC_HTTP_PROXY, and SNC_HTTPS_PROXY. When enabled, patch install-config
with proxy URLs and a noProxy list that includes the internal API
(api-int.<cluster>.<baseDomain>) plus standard cluster-local entries.
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 4, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Walkthrough

This PR adds HTTP/HTTPS proxy configuration support to the cluster installation pipeline. A new configure_install_config_proxy function conditionally applies proxy settings to the OpenShift installer configuration when enabled, environment variables control proxy behavior in the main script, and documentation describes the new configuration options.

Changes

HTTP/HTTPS Proxy Configuration

Layer / File(s) Summary
Proxy configuration function implementation
snc-library.sh
New configure_install_config_proxy function conditionally injects HTTP/HTTPS proxy settings and noProxy exceptions into install-config.yaml using yq, with validation of required environment variables when proxy usage is enabled.
Proxy environment variables and provisioning flow integration
snc.sh
Proxy environment variables (SNC_USE_PROXY, SNC_HTTP_PROXY, SNC_HTTPS_PROXY) are declared with defaults, and the proxy configuration function is invoked early in the provisioning flow, immediately after base install-config mutations and before manifest creation.
Documentation of proxy configuration
README.md
README documents the three new environment variables, their defaults, when they are required, and provides a usage example showing how to set and run the installation with proxy enabled.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A rabbit configures proxy hops,
Through install-config, the traffic stops,
HTTP and HTTPS now flow with grace,
Past localhost in their rightful place! 🌐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding optional cluster-wide proxy support to snc.sh, which aligns with the changeset's core objective.
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.

✏️ 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.

Actionable comments posted: 2

🤖 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 `@snc-library.sh`:
- Around line 127-129: The three YQ invocations (${YQ} eval --inplace
".proxy.httpProxy = \"${SNC_HTTP_PROXY}\"" "${install_config}", etc.) are
executed under global xtrace so embedded proxy credentials can leak to CI logs;
wrap these updates in a temporary xtrace-suppressed section (turn off xtrace
before the three ${YQ} calls and re-enable it afterwards) or use a safe write
method that reads proxy values from a file or environment without echoing (e.g.,
pass masked values via stdin or a here-doc) so that SNC_HTTP_PROXY,
SNC_HTTPS_PROXY and no_proxy are never printed; ensure you modify the script
around the ${YQ} eval lines (reference the ${YQ} eval, SNC_HTTP_PROXY,
SNC_HTTPS_PROXY, no_proxy and install_config symbols) to disable tracing only
for the sensitive operations and then restore the original xtrace state.
- Around line 118-120: The current check treats any non-"enabled" value as
silent disablement; update the SNC_USE_PROXY validation to explicitly allow only
"enabled" or "disabled": if SNC_USE_PROXY=="enabled" enable proxy logic, if
"disabled" return 0, otherwise print a clear error to stderr mentioning the
invalid SNC_USE_PROXY value and exit non‑zero (or return non‑zero) so
misconfigurations fail fast; reference the SNC_USE_PROXY variable and the
existing enabling/return branch when implementing this change.
🪄 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

Run ID: 5df13681-0bb6-4fee-83a3-3b3b0d546dac

📥 Commits

Reviewing files that changed from the base of the PR and between a07769b and d73bfb9.

📒 Files selected for processing (3)
  • README.md
  • snc-library.sh
  • snc.sh

Comment thread snc-library.sh
Comment on lines +118 to +120
if [[ ${SNC_USE_PROXY} != "enabled" ]]; then
return 0
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fail fast on invalid SNC_USE_PROXY values.

Line 118 silently disables proxy for any unexpected value (e.g., true, yes, typo), which makes misconfiguration hard to detect.

Proposed fix
 function configure_install_config_proxy() {
         local install_config=$1
-        if [[ ${SNC_USE_PROXY} != "enabled" ]]; then
-                return 0
-        fi
+        case "${SNC_USE_PROXY}" in
+                enabled) ;;
+                disabled) return 0 ;;
+                *)
+                        echo "Invalid SNC_USE_PROXY='${SNC_USE_PROXY}'. Expected 'enabled' or 'disabled'."
+                        exit 1
+                        ;;
+        esac
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ ${SNC_USE_PROXY} != "enabled" ]]; then
return 0
fi
function configure_install_config_proxy() {
local install_config=$1
case "${SNC_USE_PROXY}" in
enabled) ;;
disabled) return 0 ;;
*)
echo "Invalid SNC_USE_PROXY='${SNC_USE_PROXY}'. Expected 'enabled' or 'disabled'."
exit 1
;;
esac
🤖 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 `@snc-library.sh` around lines 118 - 120, The current check treats any
non-"enabled" value as silent disablement; update the SNC_USE_PROXY validation
to explicitly allow only "enabled" or "disabled": if SNC_USE_PROXY=="enabled"
enable proxy logic, if "disabled" return 0, otherwise print a clear error to
stderr mentioning the invalid SNC_USE_PROXY value and exit non‑zero (or return
non‑zero) so misconfigurations fail fast; reference the SNC_USE_PROXY variable
and the existing enabling/return branch when implementing this change.

Comment thread snc-library.sh
Comment on lines +127 to +129
${YQ} eval --inplace ".proxy.httpProxy = \"${SNC_HTTP_PROXY}\"" "${install_config}"
${YQ} eval --inplace ".proxy.httpsProxy = \"${SNC_HTTPS_PROXY}\"" "${install_config}"
${YQ} eval --inplace ".proxy.noProxy = \"${no_proxy}\"" "${install_config}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Proxy credentials are exposed in logs.

Line 127-Line 129 run under global xtrace (set -x), so proxy URLs (including embedded credentials) will be printed to CI logs.

Proposed fix
 function configure_install_config_proxy() {
         local install_config=$1
@@
         local api_int="api-int.${SNC_PRODUCT_NAME}.${BASE_DOMAIN}"
         local no_proxy="localhost,.cluster.local,.svc,127.0.0.1,${api_int}"
+        set +x
         ${YQ} eval --inplace ".proxy.httpProxy = \"${SNC_HTTP_PROXY}\"" "${install_config}"
         ${YQ} eval --inplace ".proxy.httpsProxy = \"${SNC_HTTPS_PROXY}\"" "${install_config}"
         ${YQ} eval --inplace ".proxy.noProxy = \"${no_proxy}\"" "${install_config}"
+        set -x
 }
🤖 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 `@snc-library.sh` around lines 127 - 129, The three YQ invocations (${YQ} eval
--inplace ".proxy.httpProxy = \"${SNC_HTTP_PROXY}\"" "${install_config}", etc.)
are executed under global xtrace so embedded proxy credentials can leak to CI
logs; wrap these updates in a temporary xtrace-suppressed section (turn off
xtrace before the three ${YQ} calls and re-enable it afterwards) or use a safe
write method that reads proxy values from a file or environment without echoing
(e.g., pass masked values via stdin or a here-doc) so that SNC_HTTP_PROXY,
SNC_HTTPS_PROXY and no_proxy are never printed; ensure you modify the script
around the ${YQ} eval lines (reference the ${YQ} eval, SNC_HTTP_PROXY,
SNC_HTTPS_PROXY, no_proxy and install_config symbols) to disable tracing only
for the sensitive operations and then restore the original xtrace state.

@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Jun 4, 2026

@praveenkumar: 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/e2e-snc d73bfb9 link true /test e2e-snc

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant