diff --git a/src/k8s/pkg/k8sd/features/cilium/chart.go b/src/k8s/pkg/k8sd/features/cilium/chart.go index 59a025271..79707abef 100644 --- a/src/k8s/pkg/k8sd/features/cilium/chart.go +++ b/src/k8s/pkg/k8sd/features/cilium/chart.go @@ -7,8 +7,8 @@ import ( ) var ( - // chartCilium represents manifests to deploy Cilium. - chartCilium = helm.InstallableChart{ + // ChartCilium represents manifests to deploy Cilium. + ChartCilium = helm.InstallableChart{ Name: "ck-network", Namespace: "kube-system", ManifestPath: filepath.Join("charts", "cilium-1.15.2.tgz"), @@ -38,8 +38,8 @@ var ( // ciliumAgentImageRepo represents the image to use for cilium-agent. ciliumAgentImageRepo = "ghcr.io/canonical/cilium" - // ciliumAgentImageTag is the tag to use for the cilium-agent image. - ciliumAgentImageTag = "1.15.2-ck2" + // CiliumAgentImageTag is the tag to use for the cilium-agent image. + CiliumAgentImageTag = "1.15.2-ck2" // ciliumOperatorImageRepo is the image to use for cilium-operator. ciliumOperatorImageRepo = "ghcr.io/canonical/cilium-operator" diff --git a/src/k8s/pkg/k8sd/features/cilium/gateway.go b/src/k8s/pkg/k8sd/features/cilium/gateway.go index 5f7f2aa5d..8632e660e 100644 --- a/src/k8s/pkg/k8sd/features/cilium/gateway.go +++ b/src/k8s/pkg/k8sd/features/cilium/gateway.go @@ -37,7 +37,7 @@ func enableGateway(ctx context.Context, snap snap.Snap) (types.FeatureStatus, er err = fmt.Errorf("failed to install Gateway API CRDs: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeployFailedMsgTmpl, err), }, err } @@ -47,17 +47,17 @@ func enableGateway(ctx context.Context, snap snap.Snap) (types.FeatureStatus, er err = fmt.Errorf("failed to install Gateway API GatewayClass: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeployFailedMsgTmpl, err), }, err } - changed, err := m.Apply(ctx, chartCilium, helm.StateUpgradeOnly, map[string]any{"gatewayAPI": map[string]any{"enabled": true}}) + changed, err := m.Apply(ctx, ChartCilium, helm.StateUpgradeOnly, map[string]any{"gatewayAPI": map[string]any{"enabled": true}}) if err != nil { err = fmt.Errorf("failed to upgrade Gateway API cilium configuration: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeployFailedMsgTmpl, err), }, err } @@ -65,8 +65,8 @@ func enableGateway(ctx context.Context, snap snap.Snap) (types.FeatureStatus, er if !changed { return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, - Message: enabledMsg, + Version: CiliumAgentImageTag, + Message: EnabledMsg, }, nil } @@ -74,15 +74,15 @@ func enableGateway(ctx context.Context, snap snap.Snap) (types.FeatureStatus, er err = fmt.Errorf("failed to rollout restart cilium to enable Gateway API: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeployFailedMsgTmpl, err), }, err } return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, - Message: enabledMsg, + Version: CiliumAgentImageTag, + Message: EnabledMsg, }, nil } @@ -94,17 +94,17 @@ func disableGateway(ctx context.Context, snap snap.Snap, network types.Network) err = fmt.Errorf("failed to delete Gateway API GatewayClass: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeleteFailedMsgTmpl, err), }, err } - changed, err := m.Apply(ctx, chartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), map[string]any{"gatewayAPI": map[string]any{"enabled": false}}) + changed, err := m.Apply(ctx, ChartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), map[string]any{"gatewayAPI": map[string]any{"enabled": false}}) if err != nil { err = fmt.Errorf("failed to delete Gateway API cilium configuration: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeleteFailedMsgTmpl, err), }, err } @@ -115,7 +115,7 @@ func disableGateway(ctx context.Context, snap snap.Snap, network types.Network) err = fmt.Errorf("failed to delete Gateway API CRDs: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeleteFailedMsgTmpl, err), }, err } @@ -123,8 +123,8 @@ func disableGateway(ctx context.Context, snap snap.Snap, network types.Network) if !changed { return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, - Message: disabledMsg, + Version: CiliumAgentImageTag, + Message: DisabledMsg, }, nil } @@ -132,14 +132,14 @@ func disableGateway(ctx context.Context, snap snap.Snap, network types.Network) err = fmt.Errorf("failed to rollout restart cilium to disable Gateway API: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(gatewayDeployFailedMsgTmpl, err), }, err } return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, - Message: disabledMsg, + Version: CiliumAgentImageTag, + Message: DisabledMsg, }, nil } diff --git a/src/k8s/pkg/k8sd/features/cilium/ingress.go b/src/k8s/pkg/k8sd/features/cilium/ingress.go index a05c4b690..d62f6153f 100644 --- a/src/k8s/pkg/k8sd/features/cilium/ingress.go +++ b/src/k8s/pkg/k8sd/features/cilium/ingress.go @@ -47,20 +47,20 @@ func ApplyIngress(ctx context.Context, snap snap.Snap, ingress types.Ingress, ne } } - changed, err := m.Apply(ctx, chartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), values) + changed, err := m.Apply(ctx, ChartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), values) if err != nil { if network.GetEnabled() { err = fmt.Errorf("failed to enable ingress: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(ingressDeployFailedMsgTmpl, err), }, err } else { err = fmt.Errorf("failed to disable ingress: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(ingressDeleteFailedMsgTmpl, err), }, err } @@ -70,14 +70,14 @@ func ApplyIngress(ctx context.Context, snap snap.Snap, ingress types.Ingress, ne if ingress.GetEnabled() { return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, - Message: enabledMsg, + Version: CiliumAgentImageTag, + Message: EnabledMsg, }, nil } else { return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, - Message: disabledMsg, + Version: CiliumAgentImageTag, + Message: DisabledMsg, }, nil } } @@ -85,8 +85,8 @@ func ApplyIngress(ctx context.Context, snap snap.Snap, ingress types.Ingress, ne if !ingress.GetEnabled() { return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, - Message: disabledMsg, + Version: CiliumAgentImageTag, + Message: DisabledMsg, }, nil } @@ -94,14 +94,14 @@ func ApplyIngress(ctx context.Context, snap snap.Snap, ingress types.Ingress, ne err = fmt.Errorf("failed to rollout restart cilium to apply ingress: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(ingressDeployFailedMsgTmpl, err), }, err } return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, - Message: enabledMsg, + Version: CiliumAgentImageTag, + Message: EnabledMsg, }, nil } diff --git a/src/k8s/pkg/k8sd/features/cilium/loadbalancer.go b/src/k8s/pkg/k8sd/features/cilium/loadbalancer.go index 8711ab99a..7ebff12ab 100644 --- a/src/k8s/pkg/k8sd/features/cilium/loadbalancer.go +++ b/src/k8s/pkg/k8sd/features/cilium/loadbalancer.go @@ -30,14 +30,14 @@ func ApplyLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types.L err = fmt.Errorf("failed to disable LoadBalancer: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(lbDeleteFailedMsgTmpl, err), }, err } return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, - Message: disabledMsg, + Version: CiliumAgentImageTag, + Message: DisabledMsg, }, nil } @@ -45,7 +45,7 @@ func ApplyLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types.L err = fmt.Errorf("failed to enable LoadBalancer: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(lbDeployFailedMsgTmpl, err), }, err } @@ -53,19 +53,19 @@ func ApplyLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types.L if loadbalancer.GetBGPMode() { return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(lbEnabledMsgTmpl, "BGP"), }, nil } else if loadbalancer.GetL2Mode() { return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(lbEnabledMsgTmpl, "L2"), }, nil } else { return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(lbEnabledMsgTmpl, "Unknown"), }, nil } @@ -96,7 +96,7 @@ func disableLoadBalancer(ctx context.Context, snap snap.Snap, network types.Netw }, } - if _, err := m.Apply(ctx, chartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), values); err != nil { + if _, err := m.Apply(ctx, ChartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), values); err != nil { return fmt.Errorf("failed to refresh network to apply LoadBalancer configuration: %w", err) } return nil @@ -123,7 +123,7 @@ func enableLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types. }, } - changed, err := m.Apply(ctx, chartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), networkValues) + changed, err := m.Apply(ctx, ChartCilium, helm.StateUpgradeOnlyOrDeleted(network.GetEnabled()), networkValues) if err != nil { return fmt.Errorf("failed to update Cilium configuration for LoadBalancer: %w", err) } diff --git a/src/k8s/pkg/k8sd/features/cilium/network.go b/src/k8s/pkg/k8sd/features/cilium/network.go index a9c52c7ad..4418e8b1d 100644 --- a/src/k8s/pkg/k8sd/features/cilium/network.go +++ b/src/k8s/pkg/k8sd/features/cilium/network.go @@ -29,18 +29,18 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type m := snap.HelmClient() if !cfg.GetEnabled() { - if _, err := m.Apply(ctx, chartCilium, helm.StateDeleted, nil); err != nil { + if _, err := m.Apply(ctx, ChartCilium, helm.StateDeleted, nil); err != nil { err = fmt.Errorf("failed to uninstall network: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeleteFailedMsgTmpl, err), }, err } return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, - Message: disabledMsg, + Version: CiliumAgentImageTag, + Message: DisabledMsg, }, nil } @@ -49,7 +49,7 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type err = fmt.Errorf("invalid kube-proxy --cluster-cidr value: %v", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } @@ -57,7 +57,7 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type values := map[string]any{ "image": map[string]any{ "repository": ciliumAgentImageRepo, - "tag": ciliumAgentImageTag, + "tag": CiliumAgentImageTag, "useDigest": false, }, "socketLB": map[string]any{ @@ -99,7 +99,7 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type err = fmt.Errorf("failed to get bpf mount path: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } @@ -109,7 +109,7 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type err = fmt.Errorf("failed to get cgroup2 mount path: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } @@ -132,7 +132,7 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type err = fmt.Errorf("failed to get mount propagation type for /sys: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } @@ -145,7 +145,7 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type err := fmt.Errorf("/sys is not a shared mount on the LXD container, this might be resolved by updating LXD on the host to version 5.0.2 or newer") return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } @@ -153,25 +153,25 @@ func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ type err = fmt.Errorf("/sys is not a shared mount") return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } } - if _, err := m.Apply(ctx, chartCilium, helm.StatePresent, values); err != nil { + if _, err := m.Apply(ctx, ChartCilium, helm.StatePresent, values); err != nil { err = fmt.Errorf("failed to enable network: %w", err) return types.FeatureStatus{ Enabled: false, - Version: ciliumAgentImageTag, + Version: CiliumAgentImageTag, Message: fmt.Sprintf(networkDeployFailedMsgTmpl, err), }, err } return types.FeatureStatus{ Enabled: true, - Version: ciliumAgentImageTag, - Message: enabledMsg, + Version: CiliumAgentImageTag, + Message: EnabledMsg, }, nil } diff --git a/src/k8s/pkg/k8sd/features/cilium/network_test.go b/src/k8s/pkg/k8sd/features/cilium/network_test.go new file mode 100644 index 000000000..516ae58d0 --- /dev/null +++ b/src/k8s/pkg/k8sd/features/cilium/network_test.go @@ -0,0 +1,184 @@ +package cilium_test + +import ( + "context" + "errors" + "testing" + + . "github.com/onsi/gomega" + + "github.com/canonical/k8s/pkg/client/helm" + helmmock "github.com/canonical/k8s/pkg/client/helm/mock" + "github.com/canonical/k8s/pkg/k8sd/features/cilium" + "github.com/canonical/k8s/pkg/k8sd/types" + "github.com/canonical/k8s/pkg/snap" + snapmock "github.com/canonical/k8s/pkg/snap/mock" + "github.com/canonical/k8s/pkg/utils" + "k8s.io/utils/ptr" +) + +// NOTE(hue): status.Message is not checked sometimes to avoid unnecessary complexity + +func TestDisabled(t *testing.T) { + t.Run("HelmApplyFails", func(t *testing.T) { + g := NewWithT(t) + + applyErr := errors.New("failed to apply") + helmM := &helmmock.Mock{ + ApplyErr: applyErr, + } + snapM := &snapmock.Snap{ + Mock: snapmock.Mock{ + HelmClient: helmM, + }, + } + cfg := types.Network{ + Enabled: ptr.To(false), + } + + status, err := cilium.ApplyNetwork(context.Background(), snapM, cfg, nil) + + g.Expect(err).To(MatchError(applyErr)) + g.Expect(status.Enabled).To(BeFalse()) + g.Expect(status.Message).To(ContainSubstring(applyErr.Error())) + g.Expect(status.Version).To(Equal(cilium.CiliumAgentImageTag)) + g.Expect(helmM.ApplyCalledWith).To(HaveLen(1)) + + callArgs := helmM.ApplyCalledWith[0] + g.Expect(callArgs.Chart).To(Equal(cilium.ChartCilium)) + g.Expect(callArgs.State).To(Equal(helm.StateDeleted)) + g.Expect(callArgs.Values).To(BeNil()) + }) + t.Run("Success", func(t *testing.T) { + g := NewWithT(t) + + helmM := &helmmock.Mock{} + snapM := &snapmock.Snap{ + Mock: snapmock.Mock{ + HelmClient: helmM, + }, + } + cfg := types.Network{ + Enabled: ptr.To(false), + } + + status, err := cilium.ApplyNetwork(context.Background(), snapM, cfg, nil) + + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(status.Enabled).To(BeFalse()) + g.Expect(status.Message).To(Equal(cilium.DisabledMsg)) + g.Expect(status.Version).To(Equal(cilium.CiliumAgentImageTag)) + g.Expect(helmM.ApplyCalledWith).To(HaveLen(1)) + + callArgs := helmM.ApplyCalledWith[0] + g.Expect(callArgs.Chart).To(Equal(cilium.ChartCilium)) + g.Expect(callArgs.State).To(Equal(helm.StateDeleted)) + g.Expect(callArgs.Values).To(BeNil()) + }) +} + +func TestEnabled(t *testing.T) { + t.Run("InvalidCIDR", func(t *testing.T) { + g := NewWithT(t) + + helmM := &helmmock.Mock{} + snapM := &snapmock.Snap{ + Mock: snapmock.Mock{ + HelmClient: helmM, + }, + } + cfg := types.Network{ + Enabled: ptr.To(true), + PodCIDR: ptr.To("invalid-cidr"), + } + + status, err := cilium.ApplyNetwork(context.Background(), snapM, cfg, nil) + + g.Expect(err).To(HaveOccurred()) + g.Expect(status.Enabled).To(BeFalse()) + g.Expect(status.Version).To(Equal(cilium.CiliumAgentImageTag)) + g.Expect(helmM.ApplyCalledWith).To(HaveLen(0)) + }) + t.Run("Strict", func(t *testing.T) { + g := NewWithT(t) + + helmM := &helmmock.Mock{} + snapM := &snapmock.Snap{ + Mock: snapmock.Mock{ + HelmClient: helmM, + Strict: true, + }, + } + cfg := types.Network{ + Enabled: ptr.To(true), + PodCIDR: ptr.To("192.0.2.0/24,2001:db8::/32"), + } + + status, err := cilium.ApplyNetwork(context.Background(), snapM, cfg, nil) + + g.Expect(err).ToNot(HaveOccurred()) + g.Expect(status.Enabled).To(BeTrue()) + g.Expect(status.Message).To(Equal(cilium.EnabledMsg)) + g.Expect(status.Version).To(Equal(cilium.CiliumAgentImageTag)) + g.Expect(helmM.ApplyCalledWith).To(HaveLen(1)) + + callArgs := helmM.ApplyCalledWith[0] + g.Expect(callArgs.Chart).To(Equal(cilium.ChartCilium)) + g.Expect(callArgs.State).To(Equal(helm.StatePresent)) + validateValues(t, callArgs.Values, cfg, snapM) + }) + t.Run("HelmApplyFails", func(t *testing.T) { + g := NewWithT(t) + + applyErr := errors.New("failed to apply") + helmM := &helmmock.Mock{ + ApplyErr: applyErr, + } + snapM := &snapmock.Snap{ + Mock: snapmock.Mock{ + HelmClient: helmM, + }, + } + cfg := types.Network{ + Enabled: ptr.To(true), + PodCIDR: ptr.To("192.0.2.0/24,2001:db8::/32"), + } + + status, err := cilium.ApplyNetwork(context.Background(), snapM, cfg, nil) + + g.Expect(err).To(MatchError(applyErr)) + g.Expect(status.Enabled).To(BeFalse()) + g.Expect(status.Message).To(ContainSubstring(applyErr.Error())) + g.Expect(status.Version).To(Equal(cilium.CiliumAgentImageTag)) + g.Expect(helmM.ApplyCalledWith).To(HaveLen(1)) + + callArgs := helmM.ApplyCalledWith[0] + g.Expect(callArgs.Chart).To(Equal(cilium.ChartCilium)) + g.Expect(callArgs.State).To(Equal(helm.StatePresent)) + validateValues(t, callArgs.Values, cfg, snapM) + }) +} + +func validateValues(t *testing.T, values map[string]any, cfg types.Network, snap snap.Snap) { + t.Helper() + g := NewWithT(t) + + ipv4CIDR, ipv6CIDR, err := utils.ParseCIDRs(cfg.GetPodCIDR()) + g.Expect(err).ToNot(HaveOccurred()) + + bpfMount, err := utils.GetMountPath("bpf") + g.Expect(err).ToNot(HaveOccurred()) + + cgrMount, err := utils.GetMountPath("cgroup2") + g.Expect(err).ToNot(HaveOccurred()) + + if snap.Strict() { + g.Expect(values["bpf"].(map[string]any)["root"]).To(Equal(bpfMount)) + g.Expect(values["cgroup"].(map[string]any)["hostRoot"]).To(Equal(cgrMount)) + } + + g.Expect(values["ipam"].(map[string]any)["operator"].(map[string]any)["clusterPoolIPv4PodCIDRList"]).To(Equal(ipv4CIDR)) + g.Expect(values["ipam"].(map[string]any)["operator"].(map[string]any)["clusterPoolIPv6PodCIDRList"]).To(Equal(ipv6CIDR)) + g.Expect(values["ipv4"].(map[string]any)["enabled"]).To(Equal((ipv4CIDR != ""))) + g.Expect(values["ipv6"].(map[string]any)["enabled"]).To(Equal((ipv6CIDR != ""))) +} diff --git a/src/k8s/pkg/k8sd/features/cilium/register.go b/src/k8s/pkg/k8sd/features/cilium/register.go index e3d2dfdf1..cf9fd8dd4 100644 --- a/src/k8s/pkg/k8sd/features/cilium/register.go +++ b/src/k8s/pkg/k8sd/features/cilium/register.go @@ -8,7 +8,7 @@ import ( func init() { images.Register( - fmt.Sprintf("%s:%s", ciliumAgentImageRepo, ciliumAgentImageTag), + fmt.Sprintf("%s:%s", ciliumAgentImageRepo, CiliumAgentImageTag), fmt.Sprintf("%s-generic:%s", ciliumOperatorImageRepo, ciliumOperatorImageTag), ) } diff --git a/src/k8s/pkg/k8sd/features/cilium/status.go b/src/k8s/pkg/k8sd/features/cilium/status.go index ba9fc4739..65212848c 100644 --- a/src/k8s/pkg/k8sd/features/cilium/status.go +++ b/src/k8s/pkg/k8sd/features/cilium/status.go @@ -10,8 +10,8 @@ import ( ) const ( - disabledMsg = "disabled" - enabledMsg = "enabled" + DisabledMsg = "disabled" + EnabledMsg = "enabled" ) func CheckNetwork(ctx context.Context, snap snap.Snap) error {