Skip to content
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

fix ignition config creation (propagation of proxy settings) #18772

Merged
merged 2 commits into from
Jun 6, 2023

Conversation

esendjer
Copy link
Contributor

@esendjer esendjer commented Jun 1, 2023

Reopened of #18759

In the v4.5.1 release, the propagation of proxy settings for QEMU VMs was broken.

The issue #13168 that was solved in the PR #13209 has come back.
@amilanoski mentioned the issue there

I could repeat the issue on my side as well, and the researching led me to the next:

The cause was in a broken sequence of Ignition config creation, such that, the part, responsible for propagation of proxy settings, was not included in the final ignConfig

This PR contains:

  • fix of Ignition config creation
  • e2e test for proxy settings propagation
  • minor adjustment of binaries target in Makefile for Darwin (macOS) and Windows.

Does this PR introduce a user-facing change?

None

Fixed Ignition config creation (is relavant only for qemu VMs)

@esendjer
Copy link
Contributor Author

esendjer commented Jun 1, 2023

@Luap99 there were comments from you
#18759 (review)
#18759 (comment)

Sorry, but I broke that branch and had to reopen PR

There are fixes here, that you asked about

@esendjer
Copy link
Contributor Author

esendjer commented Jun 1, 2023

@baude Could you please take a look at this PR

@esendjer esendjer force-pushed the main branch 3 times, most recently from 34b6cc4 to ad2249a Compare June 2, 2023 09:50
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

Remove the [NO NEW TESTS NEEDED] from your commit message and also remove the double sign-off line.

Comment on lines 55 to 60
if err := os.Unsetenv("HTTP_PROXY"); err != nil {
Fail("unable to unset HTTP_PROXY")
}
if err := os.Unsetenv("HTTPS_PROXY"); err != nil {
Fail("unable to unset HTTPS_PROXY")
}
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, please use defer os.Unsetenv(...) instead directly after the setenv call.
The thing with ginkgo is that if a match above fails it stops executing this function and returns early, so if this test fails you will leak the env into all following test causing likely more errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done
For some unclear for me reason, a simple definition of defer os.Unsetenv("...") didn't work and there were leaks of the env into all following tests
Now, there is a slightly bulky defer in the test, but it works, it's simple and it's clear.

@esendjer esendjer force-pushed the main branch 4 times, most recently from f8ef1ff to 306dbe6 Compare June 2, 2023 17:21
Comment on lines 51 to 56
sshSession, err := mb.setName(name).setCmd(sshProxy.withSSHCommand([]string{"printenv", "HTTPS_PROXY"})).run()
Expect(err).ToNot(HaveOccurred())
Expect(sshSession).To(Exit(0))
Expect(sshSession.outputToString()).To(ContainSubstring(proxyURL))

sshSession, err = mb.setName(name).setCmd(sshProxy.withSSHCommand([]string{"printenv", "HTTPS_PROXY"})).run()
Copy link
Member

Choose a reason for hiding this comment

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

both are checking HTTPS_PROXY, I assume one of them should check HTTP_PROXY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -224,7 +226,17 @@ endif
# at reference-time (due to `=` and not `=:`).
_HLP_TGTS_RX = '^[[:print:]]+:.*?\#\# .*$$'
_HLP_TGTS_CMD = grep -E $(_HLP_TGTS_RX) $(MAKEFILE_LIST)
_HLP_TGTS_LEN = $(shell $(call err_if_empty,_HLP_TGTS_CMD) | cut -d : -f 1 | wc -L)
_HLP_TGTS_LEN = $(shell $(call err_if_empty,_HLP_TGTS_CMD) | cut -d : -f 1 | wc -L 2>/dev/null || echo "PARSING_ERROR")
Copy link
Member

Choose a reason for hiding this comment

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

I think it may be better to keep this in a separate commit as this is not related to the actual fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Makefile Outdated
$(warning On Darwin (MacOS) installed coreutils is necessary)
$(warning Use 'brew install coreutils' command to install coreutils on your system)
endif
else
Copy link
Member

Choose a reason for hiding this comment

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

I think this else can be dropped?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

esendjer added 2 commits June 5, 2023 17:59
* the sequence of Ignition config creation was broken,
so that the part responsible for propagation of proxy
settings has been out of the final ignConfig

* e2e test for proxy settings propagation

Signed-off-by: esendjer <[email protected]>
@djukxe
Copy link

djukxe commented Jun 6, 2023

@esendjer, I tested your PR and it's also fixing regression on SSL_CERT_FILE and SSL_CERT_DIR environment variables propagation (initially implemented in #16457).

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 6, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: esendjer, Luap99

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 Jun 6, 2023
@TomSweeneyRedHat
Copy link
Member

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jun 6, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 6, 2023
@openshift-merge-robot openshift-merge-robot merged commit 8e3ecc8 into containers:main Jun 6, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants