Skip to content

Commit 1a1dad2

Browse files
authored
passthrough hubble networkConfig to helm global values (#741)
* passthrough networkConfig hubble settings to global chart values Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud> * test Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud> --------- Signed-off-by: Lukas Hoehl <lukas.hoehl@stackit.cloud>
1 parent 8590664 commit 1a1dad2

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

pkg/charts/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type globalConfig struct {
5656
ConfigMapLabelPrefixHash string `json:"configMapLabelPrefixHash"`
5757
PolicyAuditMode bool `json:"policyAuditMode"`
5858
Encryption encryption `json:"encryption"`
59+
Hubble hubbleConfig `json:"hubble"`
5960
}
6061

6162
// etcd related configuration for cilium
@@ -209,3 +210,7 @@ type encryptionWireguardStrictMode struct {
209210
Enabled bool `json:"enabled"`
210211
AllowRemoteNodeIdentities bool `json:"allowRemoteNodeIdentities"`
211212
}
213+
214+
type hubbleConfig struct {
215+
Enabled bool `json:"enabled"`
216+
}

pkg/charts/utils.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ var defaultGlobalConfig = globalConfig{
125125
NodeEncryption: false,
126126
Enabled: false,
127127
},
128+
Hubble: hubbleConfig{
129+
Enabled: false,
130+
},
128131
}
129132

130133
func newGlobalConfig() globalConfig {
@@ -214,9 +217,9 @@ func generateChartValues(config *ciliumv1alpha1.NetworkConfig, network *extensio
214217
return requirementsConfig, globalConfig, nil
215218
}
216219

217-
// If Hubble enabled
218-
if config.Hubble != nil && config.Hubble.Enabled {
220+
if config.Hubble != nil {
219221
requirementsConfig.Hubble.Enabled = config.Hubble.Enabled
222+
globalConfig.Hubble.Enabled = config.Hubble.Enabled
220223
}
221224

222225
// If ETCD enabled

pkg/charts/utils_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package charts
22

33
import (
4+
gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
5+
extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
6+
"github.com/gardener/gardener/pkg/extensions"
47
. "github.com/onsi/ginkgo/v2"
58
. "github.com/onsi/gomega"
69

@@ -45,3 +48,26 @@ var _ = Describe("#applyEncryptionConfig", func() {
4548
})
4649
})
4750
})
51+
52+
var _ = Describe("#generateChartValues", func() {
53+
Describe("hubble", func() {
54+
var config *ciliumv1alpha1.NetworkConfig
55+
cluster := &extensions.Cluster{
56+
Shoot: &gardencorev1beta1.Shoot{},
57+
}
58+
BeforeEach(func() {
59+
config = &ciliumv1alpha1.NetworkConfig{}
60+
})
61+
Describe("reflect hubble of NetworkConfig in both requirementsConfig and globalConfig", func() {
62+
It("should be disabled in requirementsConfig and globalConfig", func() {
63+
config.Hubble = &ciliumv1alpha1.Hubble{
64+
Enabled: false,
65+
}
66+
requirementCfg, globalCfg, err := generateChartValues(config, &extensionsv1alpha1.Network{}, cluster, "", "", "")
67+
Expect(err).NotTo(HaveOccurred())
68+
Expect(requirementCfg.Hubble.Enabled).To(Equal(config.Hubble.Enabled), "requirementsConfig mismatch")
69+
Expect(globalCfg.Hubble.Enabled).To(Equal(config.Hubble.Enabled), "globalConfig mismatch")
70+
})
71+
})
72+
})
73+
})

0 commit comments

Comments
 (0)