mirror of https://github.com/containers/podman.git
Merge pull request #18772 from esendjer/main
fix ignition config creation (propagation of proxy settings)
This commit is contained in:
commit
8e3ecc8936
13
Makefile
13
Makefile
|
@ -215,6 +215,8 @@ all: binaries docs
|
||||||
.PHONY: binaries
|
.PHONY: binaries
|
||||||
ifeq ($(shell uname -s),FreeBSD)
|
ifeq ($(shell uname -s),FreeBSD)
|
||||||
binaries: podman podman-remote ## Build podman and podman-remote binaries
|
binaries: podman podman-remote ## Build podman and podman-remote binaries
|
||||||
|
else ifneq (, $(findstring $(GOOS),darwin windows))
|
||||||
|
binaries: podman-remote ## Build podman-remote (client) only binaries
|
||||||
else
|
else
|
||||||
binaries: podman podman-remote rootlessport quadlet ## Build podman, podman-remote and rootlessport binaries quadlet
|
binaries: podman podman-remote rootlessport quadlet ## Build podman, podman-remote and rootlessport binaries quadlet
|
||||||
endif
|
endif
|
||||||
|
@ -224,7 +226,16 @@ endif
|
||||||
# at reference-time (due to `=` and not `=:`).
|
# at reference-time (due to `=` and not `=:`).
|
||||||
_HLP_TGTS_RX = '^[[:print:]]+:.*?\#\# .*$$'
|
_HLP_TGTS_RX = '^[[:print:]]+:.*?\#\# .*$$'
|
||||||
_HLP_TGTS_CMD = grep -E $(_HLP_TGTS_RX) $(MAKEFILE_LIST)
|
_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")
|
||||||
|
# Separated condition for Darwin
|
||||||
|
ifeq ($(shell uname -s)$(_HLP_TGTS_LEN),DarwinPARSING_ERROR)
|
||||||
|
ifneq (,$(wildcard /usr/local/bin/gwc))
|
||||||
|
_HLP_TGTS_LEN = $(shell $(call err_if_empty,_HLP_TGTS_CMD) | cut -d : -f 1 | gwc -L)
|
||||||
|
else
|
||||||
|
$(warning On Darwin (MacOS) installed coreutils is necessary)
|
||||||
|
$(warning Use 'brew install coreutils' command to install coreutils on your system)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
_HLPFMT = "%-$(call err_if_empty,_HLP_TGTS_LEN)s %s\n"
|
_HLPFMT = "%-$(call err_if_empty,_HLP_TGTS_LEN)s %s\n"
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help: ## (Default) Print listing of key targets with their descriptions
|
help: ## (Default) Print listing of key targets with their descriptions
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package e2e_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
. "github.com/onsi/ginkgo/v2"
|
||||||
|
. "github.com/onsi/gomega"
|
||||||
|
. "github.com/onsi/gomega/gexec"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = Describe("podman machine proxy settings propagation", func() {
|
||||||
|
var (
|
||||||
|
mb *machineTestBuilder
|
||||||
|
testDir string
|
||||||
|
)
|
||||||
|
|
||||||
|
BeforeEach(func() {
|
||||||
|
testDir, mb = setup()
|
||||||
|
})
|
||||||
|
AfterEach(func() {
|
||||||
|
teardown(originalHomeDir, testDir, mb)
|
||||||
|
})
|
||||||
|
|
||||||
|
It("ssh to running machine and check proxy settings", func() {
|
||||||
|
name := randomString()
|
||||||
|
i := new(initMachine)
|
||||||
|
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(session).To(Exit(0))
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
httpProxyEnv := os.Getenv("HTTP_PROXY")
|
||||||
|
httpsProxyEnv := os.Getenv("HTTPS_PROXY")
|
||||||
|
if httpProxyEnv != "" {
|
||||||
|
os.Unsetenv("HTTP_PROXY")
|
||||||
|
}
|
||||||
|
if httpsProxyEnv != "" {
|
||||||
|
os.Unsetenv("HTTPS_PROXY")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
proxyURL := "http://abcdefghijklmnopqrstuvwxyz-proxy"
|
||||||
|
os.Setenv("HTTP_PROXY", proxyURL)
|
||||||
|
os.Setenv("HTTPS_PROXY", proxyURL)
|
||||||
|
|
||||||
|
s := new(startMachine)
|
||||||
|
startSession, err := mb.setName(name).setCmd(s).run()
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(startSession).To(Exit(0))
|
||||||
|
|
||||||
|
sshProxy := sshMachine{}
|
||||||
|
sshSession, err := mb.setName(name).setCmd(sshProxy.withSSHCommand([]string{"printenv", "HTTP_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()
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
Expect(sshSession).To(Exit(0))
|
||||||
|
Expect(sshSession.outputToString()).To(ContainSubstring(proxyURL))
|
||||||
|
})
|
||||||
|
})
|
|
@ -206,12 +206,6 @@ WantedBy=sysinit.target
|
||||||
Contents: &deMoby,
|
Contents: &deMoby,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
ignConfig := Config{
|
|
||||||
Ignition: ignVersion,
|
|
||||||
Passwd: ignPassword,
|
|
||||||
Storage: ignStorage,
|
|
||||||
Systemd: ignSystemd,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only qemu has the qemu firmware environment setting
|
// Only qemu has the qemu firmware environment setting
|
||||||
if ign.VMType == QemuVirt {
|
if ign.VMType == QemuVirt {
|
||||||
|
@ -222,7 +216,14 @@ WantedBy=sysinit.target
|
||||||
}
|
}
|
||||||
ignSystemd.Units = append(ignSystemd.Units, qemuUnit)
|
ignSystemd.Units = append(ignSystemd.Units, qemuUnit)
|
||||||
}
|
}
|
||||||
ign.Cfg = ignConfig
|
// Only after all checks are done
|
||||||
|
// it's ready create the ingConfig
|
||||||
|
ign.Cfg = Config{
|
||||||
|
Ignition: ignVersion,
|
||||||
|
Passwd: ignPassword,
|
||||||
|
Storage: ignStorage,
|
||||||
|
Systemd: ignSystemd,
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue