Skip to content

[release-5.9]LOG-6963:Map cluster-wide proxy env variable for compatibility with Vector expectations #3032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release-5.9
Choose a base branch
from

Conversation

vparfonov
Copy link
Contributor

@vparfonov vparfonov commented Apr 29, 2025

Description

Adding cluster-wide proxy automatically inject the environment variable, to support Fluentd collector they was lowercased to http_proxy, https_proxy and no_proxy. In the same time, the Vector expects the variable to be named HTTP_PROXY, HTTPS_PROXY and NO_PROXY (in uppercase) [1]. This mismatch causes the Vector not picked up proxy settings.

This PR adds a mechanism to support both collectors in the Vector value will be remapped according to current collector expectations.

[1] https://github.com/vectordotdev/vector/blob/f5b9265335c9df7bcbd4a57046738fb5e87a67c1/lib/vector-core/src/config/proxy.rs#L121

/cc @Clee2691 @cahartma
/assign @jcantrill

Links

@openshift-ci openshift-ci bot requested review from Clee2691 and jcantrill April 29, 2025 20:12
@cahartma
Copy link
Contributor

This should most likely be fixed in 6.2 (and master), rather than 5.9. Also, I'm not seeing how this is related to fixing the '@' issue in: https://issues.redhat.com/browse/LOG-6963

@cahartma
Copy link
Contributor

Shouldn't we be merging this fix into master and release-6.2 first. Is there a way we can resolve this in v6, then tell them to upgrade if they complain about not fixing in v5?

@vparfonov
Copy link
Contributor Author

vparfonov commented Apr 30, 2025

This should most likely be fixed in 6.2 (and master), rather than 5.9. Also, I'm not seeing how this is related to fixing the '@' issue in: issues.redhat.com/browse/LOG-6963

Vector just don't picked up env value in lowercase, not related directly to the @

Something similar was here: https://issues.redhat.com/browse/LOG-4900

@vparfonov
Copy link
Contributor Author

Shouldn't we be merging this fix into master and release-6.2 first. Is there a way we can resolve this in v6, then tell them to upgrade if they complain about not fixing in v5?

Maybe yes, original issue opened for 5.9 thats why i did it firstly

Copy link
Contributor

@jcantrill jcantrill left a comment

Choose a reason for hiding this comment

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

/hold

# Remap lowercase to uppercase if it's set
if [ -z "${HTTP_PROXY:-}" ] && [ -n "${http_proxy:-}" ]; then
export HTTP_PROXY="$http_proxy"
echo HTTP_PROXY="$HTTP_PROXY"
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to add a "log" statement then lets say what we are doing... "Setting HTTP_PROXY=...."

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the proxy url actually something we want to put into a log? Couldn't it contain user/pwd?

Expect(framework.DeployWithVisitor(envVisitor)).To(BeNil())
out, err := framework.ReadCollectorLogs()
Expect(err).To(BeNil())
Expect(out).To(ContainSubstring(`HTTP_PROXY=http://my_proxy:8080`))
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe a more accurate assertion would be to exec into the pod, get the env vars, and check explicitly for the environment variable and value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, get the env vars will be better but with here var sets only in the process running that script, It does not persist globally in the container environment.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 1, 2025
@vparfonov
Copy link
Contributor Author

/retest

@vparfonov vparfonov changed the title Map cluster-wide proxy env variable for compatibility with Vector expctations WIP:Map cluster-wide proxy env variable for compatibility with Vector expctations May 1, 2025
@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 May 1, 2025
@vparfonov vparfonov changed the title WIP:Map cluster-wide proxy env variable for compatibility with Vector expctations [release-5.9]LOG-6963:Map cluster-wide proxy env variable for compatibility with Vector expectations May 2, 2025
@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 May 2, 2025
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 2, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented May 2, 2025

@vparfonov: This pull request references LOG-6963 which is a valid jira issue.

In response to this:

Description

Adding cluster-wide proxy automatically inject the environment variable http_proxy, https_proxy and no_proxy (in lowercase) but the Vector expects the variable to be named HTTP_PROXY, HTTPS_PROXY and NO_PROXY (in uppercase). This mismatch causes the Vector not picked up proxy settings.

This PR adds a fallback mechanism in the Vector startup script to remap the existed lowercase value to uppercase.
[1] https://github.com/vectordotdev/vector/blob/f5b9265335c9df7bcbd4a57046738fb5e87a67c1/lib/vector-core/src/config/proxy.rs#L121

/cc @Clee2691 @cahartma
/assign @jcantrill

Links

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

openshift-ci-robot commented May 2, 2025

@vparfonov: This pull request references LOG-6963 which is a valid jira issue.

In response to this:

Description

Adding cluster-wide proxy automatically inject the environment variable, to support Fluentd collector they was lowercased to http_proxy, https_proxy and no_proxy. In the same time, the Vector expects the variable to be named HTTP_PROXY, HTTPS_PROXY and NO_PROXY (in uppercase) [1]. This mismatch causes the Vector not picked up proxy settings.

This PR adds a mechanism to support both collectors in the Vector value will be remapped according to current collector expectations.

[1] https://github.com/vectordotdev/vector/blob/f5b9265335c9df7bcbd4a57046738fb5e87a67c1/lib/vector-core/src/config/proxy.rs#L121

/cc @Clee2691 @cahartma
/assign @jcantrill

Links

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.

@vparfonov vparfonov requested a review from jcantrill May 2, 2025 13:52
@jcantrill
Copy link
Contributor

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 2, 2025
Copy link
Contributor

openshift-ci bot commented May 2, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcantrill, vparfonov

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 2, 2025
Copy link
Contributor

openshift-ci bot commented May 2, 2025

@vparfonov: all tests passed!

Full PR test history. Your PR dashboard.

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
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. release/5.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants