@@ -698,6 +698,90 @@ var _ = Describe("Istio controller tests", func() {
698698 ObjectMeta : metav1.ObjectMeta {
699699 Name : "calico-master" ,
700700 },
701+ Spec : operatorv1.ImageSetSpec {
702+ Images : []operatorv1.Image {
703+ {Image : "calico/istio-pilot" , Digest : "sha256:pilot123" },
704+ {Image : "calico/istio-install-cni" , Digest : "sha256:cni123" },
705+ {Image : "calico/istio-ztunnel" , Digest : "sha256:ztunnel123" },
706+ {Image : "calico/istio-proxyv2" , Digest : "sha256:proxyv2123" },
707+ },
708+ },
709+ }
710+ Expect (cli .Create (ctx , imageSet )).NotTo (HaveOccurred ())
711+
712+ r := & ReconcileIstio {
713+ Client : cli ,
714+ scheme : scheme ,
715+ provider : operatorv1 .ProviderNone ,
716+ status : mockStatus ,
717+ }
718+
719+ _ , err := r .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : "default" }})
720+ Expect (err ).ShouldNot (HaveOccurred ())
721+
722+ // Verify Istiod Deployment uses ImageSet digest
723+ istiodDeploy := & appsv1.Deployment {}
724+ Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioIstiodDeploymentName , Namespace : istio .IstioNamespace }, istiodDeploy )).NotTo (HaveOccurred ())
725+ Expect (istiodDeploy .Spec .Template .Spec .Containers ).NotTo (BeEmpty ())
726+ // Verify the pilot container image uses the digest from ImageSet
727+ Expect (istiodDeploy .Spec .Template .Spec .Containers [0 ].Image ).To (ContainSubstring ("@sha256:pilot123" ))
728+
729+ // Verify CNI DaemonSet uses ImageSet digest
730+ cniDaemonSet := & appsv1.DaemonSet {}
731+ Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioCNIDaemonSetName , Namespace : istio .IstioNamespace }, cniDaemonSet )).NotTo (HaveOccurred ())
732+ Expect (cniDaemonSet .Spec .Template .Spec .Containers ).NotTo (BeEmpty ())
733+ // Verify the install-cni container image uses the digest from ImageSet
734+ Expect (cniDaemonSet .Spec .Template .Spec .Containers [0 ].Image ).To (ContainSubstring ("@sha256:cni123" ))
735+
736+ // Verify Ztunnel DaemonSet uses ImageSet digest
737+ ztunnelDaemonSet := & appsv1.DaemonSet {}
738+ Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioZTunnelDaemonSetName , Namespace : istio .IstioNamespace }, ztunnelDaemonSet )).NotTo (HaveOccurred ())
739+ Expect (ztunnelDaemonSet .Spec .Template .Spec .Containers ).NotTo (BeEmpty ())
740+ // Verify the ztunnel container image uses the digest from ImageSet
741+ Expect (ztunnelDaemonSet .Spec .Template .Spec .Containers [0 ].Image ).To (ContainSubstring ("@sha256:ztunnel123" ))
742+ })
743+
744+ It ("should create expected Istio resources for Enterprise variant" , func () {
745+ installation .Spec .Variant = operatorv1 .TigeraSecureEnterprise
746+ installation .Status .Variant = operatorv1 .TigeraSecureEnterprise
747+ Expect (cli .Update (ctx , installation )).NotTo (HaveOccurred ())
748+
749+ r := & ReconcileIstio {
750+ Client : cli ,
751+ scheme : scheme ,
752+ provider : operatorv1 .ProviderNone ,
753+ status : mockStatus ,
754+ }
755+
756+ _ , err := r .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : "default" }})
757+ Expect (err ).ShouldNot (HaveOccurred ())
758+
759+ // Verify Istiod Deployment was created
760+ istiodDeploy := & appsv1.Deployment {}
761+ Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioIstiodDeploymentName , Namespace : istio .IstioNamespace }, istiodDeploy )).NotTo (HaveOccurred ())
762+
763+ // Verify Istio CNI DaemonSet was created
764+ cniDaemonSet := & appsv1.DaemonSet {}
765+ Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioCNIDaemonSetName , Namespace : istio .IstioNamespace }, cniDaemonSet )).NotTo (HaveOccurred ())
766+
767+ // Verify Istio Ztunnel DaemonSet was created
768+ ztunnelDaemonSet := & appsv1.DaemonSet {}
769+ Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioZTunnelDaemonSetName , Namespace : istio .IstioNamespace }, ztunnelDaemonSet )).NotTo (HaveOccurred ())
770+
771+ // Verify status was marked ready
772+ mockStatus .AssertCalled (GinkgoT (), "ClearDegraded" )
773+ })
774+
775+ It ("should handle ImageSet application for Enterprise variant" , func () {
776+ installation .Spec .Variant = operatorv1 .TigeraSecureEnterprise
777+ installation .Status .Variant = operatorv1 .TigeraSecureEnterprise
778+ Expect (cli .Update (ctx , installation )).NotTo (HaveOccurred ())
779+
780+ // Create ImageSet with all required Istio images for Enterprise
781+ imageSet := & operatorv1.ImageSet {
782+ ObjectMeta : metav1.ObjectMeta {
783+ Name : "enterprise-master" ,
784+ },
701785 Spec : operatorv1.ImageSetSpec {
702786 Images : []operatorv1.Image {
703787 {Image : "tigera/istio-pilot" , Digest : "sha256:pilot123" },
@@ -723,21 +807,18 @@ var _ = Describe("Istio controller tests", func() {
723807 istiodDeploy := & appsv1.Deployment {}
724808 Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioIstiodDeploymentName , Namespace : istio .IstioNamespace }, istiodDeploy )).NotTo (HaveOccurred ())
725809 Expect (istiodDeploy .Spec .Template .Spec .Containers ).NotTo (BeEmpty ())
726- // Verify the pilot container image uses the digest from ImageSet
727810 Expect (istiodDeploy .Spec .Template .Spec .Containers [0 ].Image ).To (ContainSubstring ("@sha256:pilot123" ))
728811
729812 // Verify CNI DaemonSet uses ImageSet digest
730813 cniDaemonSet := & appsv1.DaemonSet {}
731814 Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioCNIDaemonSetName , Namespace : istio .IstioNamespace }, cniDaemonSet )).NotTo (HaveOccurred ())
732815 Expect (cniDaemonSet .Spec .Template .Spec .Containers ).NotTo (BeEmpty ())
733- // Verify the install-cni container image uses the digest from ImageSet
734816 Expect (cniDaemonSet .Spec .Template .Spec .Containers [0 ].Image ).To (ContainSubstring ("@sha256:cni123" ))
735817
736818 // Verify Ztunnel DaemonSet uses ImageSet digest
737819 ztunnelDaemonSet := & appsv1.DaemonSet {}
738820 Expect (cli .Get (ctx , types.NamespacedName {Name : istio .IstioZTunnelDaemonSetName , Namespace : istio .IstioNamespace }, ztunnelDaemonSet )).NotTo (HaveOccurred ())
739821 Expect (ztunnelDaemonSet .Spec .Template .Spec .Containers ).NotTo (BeEmpty ())
740- // Verify the ztunnel container image uses the digest from ImageSet
741822 Expect (ztunnelDaemonSet .Spec .Template .Spec .Containers [0 ].Image ).To (ContainSubstring ("@sha256:ztunnel123" ))
742823 })
743824 })
0 commit comments