Skip to content

Commit

Permalink
test: add ciliu.operator-suffix cli option
Browse files Browse the repository at this point in the history
This option makes it possible to use new operator.image.suffix Helm
value in test runs.

Signed-off-by: Maciej Kwiek <maciej@isovalent.com>
  • Loading branch information
nebril committed Feb 12, 2021
1 parent 85c2256 commit 3d8ff72
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
35 changes: 19 additions & 16 deletions test/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,23 @@ type CiliumTestConfigType struct {
// PassCLIEnvironment passes through the environment invoking the gingko
// tests. When false all subcommands are executed with an empty environment,
// including PATH.
PassCLIEnvironment bool
SSHConfig string
ShowCommands bool
TestScope string
SkipLogGathering bool
CiliumImage string
CiliumTag string
CiliumOperatorImage string
CiliumOperatorTag string
HubbleRelayImage string
HubbleRelayTag string
ProvisionK8s bool
Timeout time.Duration
Kubeconfig string
RegistryCredentials string
Benchmarks bool
PassCLIEnvironment bool
SSHConfig string
ShowCommands bool
TestScope string
SkipLogGathering bool
CiliumImage string
CiliumTag string
CiliumOperatorImage string
CiliumOperatorTag string
CiliumOperatorSuffix string
HubbleRelayImage string
HubbleRelayTag string
ProvisionK8s bool
Timeout time.Duration
Kubeconfig string
RegistryCredentials string
Benchmarks bool
// Multinode enables the running of tests that involve more than one
// node. If false, some tests will silently skip multinode checks.
Multinode bool
Expand Down Expand Up @@ -86,6 +87,8 @@ func (c *CiliumTestConfigType) ParseFlags() {
"Specifies which image of cilium-operator to use during tests")
flagset.StringVar(&c.CiliumOperatorTag, "cilium.operator-tag", "",
"Specifies which tag of cilium-operator to use during tests")
flagset.StringVar(&c.CiliumOperatorSuffix, "cilium.operator-suffix", "",
"Specifies a suffix to append to operator image after cloud-specific suffix")
flagset.StringVar(&c.HubbleRelayImage, "cilium.hubble-relay-image", "",
"Specifies which image of hubble-relay to use during tests")
flagset.StringVar(&c.HubbleRelayTag, "cilium.hubble-relay-tag", "",
Expand Down
18 changes: 12 additions & 6 deletions test/helpers/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ var (
"preflight.image.tag": "latest",
"operator.image.repository": "k8s1:5000/cilium/operator",
"operator.image.tag": "latest",
"operator.image.suffix": "",
"hubble.relay.image.repository": "k8s1:5000/cilium/hubble-relay",
"hubble.relay.image.tag": "latest",
"debug.enabled": "true",
Expand Down Expand Up @@ -255,6 +256,10 @@ func Init() {
os.Setenv("CILIUM_OPERATOR_TAG", config.CiliumTestConfig.CiliumOperatorTag)
}

if config.CiliumTestConfig.CiliumOperatorSuffix != "" {
os.Setenv("CILIUM_OPERATOR_SUFFIX", config.CiliumTestConfig.CiliumOperatorSuffix)
}

if config.CiliumTestConfig.HubbleRelayImage != "" {
os.Setenv("HUBBLE_RELAY_IMAGE", config.CiliumTestConfig.HubbleRelayImage)
}
Expand All @@ -269,12 +274,13 @@ func Init() {

// Copy over envronment variables that are passed in.
for envVar, helmVar := range map[string]string{
"CILIUM_TAG": "image.tag",
"CILIUM_IMAGE": "image.repository",
"CILIUM_OPERATOR_TAG": "operator.image.tag",
"CILIUM_OPERATOR_IMAGE": "operator.image.repository",
"HUBBLE_RELAY_IMAGE": "hubble.relay.image.repository",
"HUBBLE_RELAY_TAG": "hubble.relay.image.tag",
"CILIUM_TAG": "image.tag",
"CILIUM_IMAGE": "image.repository",
"CILIUM_OPERATOR_TAG": "operator.image.tag",
"CILIUM_OPERATOR_IMAGE": "operator.image.repository",
"CILIUM_OPERATOR_SUFFIX": "operator.image.suffix",
"HUBBLE_RELAY_IMAGE": "hubble.relay.image.repository",
"HUBBLE_RELAY_TAG": "hubble.relay.image.tag",
} {
if v := os.Getenv(envVar); v != "" {
defaultHelmOptions[helmVar] = v
Expand Down

0 comments on commit 3d8ff72

Please sign in to comment.