|
| 1 | +package charts |
| 2 | + |
| 3 | +import ( |
| 4 | + . "github.com/onsi/ginkgo/v2" |
| 5 | + . "github.com/onsi/gomega" |
| 6 | + |
| 7 | + ciliumv1alpha1 "github.com/gardener/gardener-extension-networking-cilium/pkg/apis/cilium/v1alpha1" |
| 8 | +) |
| 9 | + |
| 10 | +var _ = Describe("#applyEncryptionConfig", func() { |
| 11 | + Describe("wireguard", func() { |
| 12 | + var config *ciliumv1alpha1.NetworkConfig |
| 13 | + BeforeEach(func() { |
| 14 | + config = &ciliumv1alpha1.NetworkConfig{ |
| 15 | + Encryption: &ciliumv1alpha1.Encryption{ |
| 16 | + Mode: ciliumv1alpha1.EncryptionModeWireguard, |
| 17 | + Enabled: true, |
| 18 | + }, |
| 19 | + } |
| 20 | + }) |
| 21 | + Describe("vxlan tunnel config with strict mode encryption", func() { |
| 22 | + It("should set AllowRemoteNodeIdentities", func() { |
| 23 | + cfg := &globalConfig{ |
| 24 | + Tunnel: ciliumv1alpha1.VXLan, |
| 25 | + } |
| 26 | + config.Encryption.StrictMode = true |
| 27 | + Expect(applyEncryptionConfig(cfg, config)).ShouldNot(HaveOccurred()) |
| 28 | + Expect(cfg.Encryption.Wireguard.StrictMode.AllowRemoteNodeIdentities).To(BeTrue()) |
| 29 | + }) |
| 30 | + }) |
| 31 | + Describe("overlapping node & pod CIDR with direct routing and strict mode encryption", func() { |
| 32 | + It("should set AllowRemoteNodeIdentities", func() { |
| 33 | + config.Encryption.StrictMode = true |
| 34 | + config.Overlay = &ciliumv1alpha1.Overlay{ |
| 35 | + Enabled: false, |
| 36 | + } |
| 37 | + cfg := &globalConfig{ |
| 38 | + Tunnel: ciliumv1alpha1.Disabled, |
| 39 | + PodCIDR: "10.0.0.0/16", |
| 40 | + NodeCIDR: "10.0.0.128/17", |
| 41 | + } |
| 42 | + Expect(applyEncryptionConfig(cfg, config)).ShouldNot(HaveOccurred()) |
| 43 | + Expect(cfg.Encryption.Wireguard.StrictMode.AllowRemoteNodeIdentities).To(BeTrue()) |
| 44 | + }) |
| 45 | + }) |
| 46 | + }) |
| 47 | +}) |
0 commit comments