Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions tests/e2e/ambient/ambient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,11 @@ spec:

When("the Istio CR is created with ambient profile", func() {
BeforeAll(func() {
istioYAML := `
apiVersion: sailoperator.io/v1
kind: Istio
metadata:
name: default
spec:
values:
pilot:
trustedZtunnelNamespace: ztunnel
profile: ambient
version: %s
namespace: %s`
istioYAML = fmt.Sprintf(istioYAML, version.Name, controlPlaneNamespace)
Log("Istio YAML:", istioYAML)
Expect(k.CreateFromString(istioYAML)).
To(Succeed(), "Istio CR failed to be created")
Success("Istio CR created")
common.CreateIstio(k, version.Name, `
values:
pilot:
trustedZtunnelNamespace: ztunnel
profile: ambient`)
})

It("updates the Istio CR status to Reconciled", func(ctx SpecContext) {
Expand Down
32 changes: 2 additions & 30 deletions tests/e2e/controlplane/control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,7 @@ metadata:

When("the IstioCNI CR is created", func() {
BeforeAll(func() {
yaml := `
apiVersion: sailoperator.io/v1
kind: IstioCNI
metadata:
name: default
spec:
version: %s
namespace: %s`
yaml = fmt.Sprintf(yaml, version.Name, istioCniNamespace)
Log("IstioCNI YAML:", indent(yaml))
Expect(k.CreateFromString(yaml)).To(Succeed(), "IstioCNI creation failed")
Success("IstioCNI created")
common.CreateIstioCNI(k, version.Name)
})

It("deploys the CNI DaemonSet", func(ctx SpecContext) {
Expand Down Expand Up @@ -158,19 +147,7 @@ spec:

When("the Istio CR is created", func() {
BeforeAll(func() {
istioYAML := `
apiVersion: sailoperator.io/v1
kind: Istio
metadata:
name: default
spec:
version: %s
namespace: %s`
istioYAML = fmt.Sprintf(istioYAML, version.Name, controlPlaneNamespace)
Log("Istio YAML:", indent(istioYAML))
Expect(k.CreateFromString(istioYAML)).
To(Succeed(), "Istio CR failed to be created")
Success("Istio CR created")
common.CreateIstio(k, version.Name)
})

It("updates the Istio CR status to Reconciled", func(ctx SpecContext) {
Expand Down Expand Up @@ -297,11 +274,6 @@ func ImageFromRegistry(regexp string) types.GomegaMatcher {
return HaveField("Image", MatchRegexp(regexp))
}

func indent(str string) string {
indent := strings.Repeat(" ", 2)
return indent + strings.ReplaceAll(str, "\n", "\n"+indent)
}

func getProxyVersion(podName, namespace string) (*semver.Version, error) {
output, err := k.WithNamespace(namespace).Exec(
podName,
Expand Down
36 changes: 6 additions & 30 deletions tests/e2e/controlplane/control_plane_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,42 +58,18 @@ var _ = Describe("Control Plane updates", Label("control-plane", "slow"), Ordere
Expect(k.CreateNamespace(controlPlaneNamespace)).To(Succeed(), "Istio namespace failed to be created")
Expect(k.CreateNamespace(istioCniNamespace)).To(Succeed(), "IstioCNI namespace failed to be created")

yaml := `
apiVersion: sailoperator.io/v1
kind: IstioCNI
metadata:
name: default
spec:
version: %s
namespace: %s`
yaml = fmt.Sprintf(yaml, istioversion.Base, istioCniNamespace)
Log("IstioCNI YAML:", indent(yaml))
Expect(k.CreateFromString(yaml)).To(Succeed(), "IstioCNI creation failed")
Success("IstioCNI created")

common.CreateIstioCNI(k, istioversion.Base)
Eventually(common.GetObject).WithArguments(ctx, cl, kube.Key(istioCniName), &v1.IstioCNI{}).
Should(HaveConditionStatus(v1.IstioCNIConditionReady, metav1.ConditionTrue), "IstioCNI is not Ready; unexpected Condition")
Success("IstioCNI is Ready")
})

When(fmt.Sprintf("the Istio CR is created with RevisionBased updateStrategy for base version %s", istioversion.Base), func() {
BeforeAll(func() {
istioYAML := `
apiVersion: sailoperator.io/v1
kind: Istio
metadata:
name: default
spec:
version: %s
namespace: %s
updateStrategy:
type: RevisionBased
inactiveRevisionDeletionGracePeriodSeconds: 30`
istioYAML = fmt.Sprintf(istioYAML, istioversion.Base, controlPlaneNamespace)
Log("Istio YAML:", indent(istioYAML))
Expect(k.CreateFromString(istioYAML)).
To(Succeed(), "Istio CR failed to be created")
Success("Istio CR created")
common.CreateIstio(k, istioversion.Base, `
updateStrategy:
type: RevisionBased
inactiveRevisionDeletionGracePeriodSeconds: 30`)
})

It("deploys istiod and pod is Ready", func(ctx SpecContext) {
Expand All @@ -114,7 +90,7 @@ spec:
targetRef:
kind: Istio
name: default`
Log("IstioRevisionTag YAML:", indent(IstioRevisionTagYAML))
Log("IstioRevisionTag YAML:", common.Indent(IstioRevisionTagYAML))
Expect(k.CreateFromString(IstioRevisionTagYAML)).
To(Succeed(), "IstioRevisionTag CR failed to be created")
Success("IstioRevisionTag CR created")
Expand Down
48 changes: 13 additions & 35 deletions tests/e2e/dualstack/dualstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,7 @@ var _ = Describe("DualStack configuration ", Label("dualstack"), Ordered, func()

When("the IstioCNI CR is created", func() {
BeforeAll(func() {
cniYAML := `
apiVersion: sailoperator.io/v1
kind: IstioCNI
metadata:
name: default
spec:
version: %s
namespace: %s`
cniYAML = fmt.Sprintf(cniYAML, version.Name, istioCniNamespace)
Log("IstioCNI YAML:", cniYAML)
Expect(k.CreateFromString(cniYAML)).To(Succeed(), "IstioCNI creation failed")
Success("IstioCNI created")
common.CreateIstioCNI(k, version.Name)
})

It("deploys the CNI DaemonSet", func(ctx SpecContext) {
Expand All @@ -111,30 +100,19 @@ spec:

When("the Istio CR is created with DualStack configuration", func() {
BeforeAll(func() {
istioYAML := `
apiVersion: sailoperator.io/v1
kind: Istio
metadata:
name: default
spec:
values:
meshConfig:
defaultConfig:
proxyMetadata:
ISTIO_DUAL_STACK: "true"
pilot:
ipFamilyPolicy: %s
env:
spec := `
values:
meshConfig:
defaultConfig:
proxyMetadata:
ISTIO_DUAL_STACK: "true"
cni:
enabled: true
version: %s
namespace: %s`
istioYAML = fmt.Sprintf(istioYAML, corev1.IPFamilyPolicyRequireDualStack, version.Name, controlPlaneNamespace)
Log("Istio YAML:", istioYAML)
Expect(k.CreateFromString(istioYAML)).
To(Succeed(), "Istio CR failed to be created")
Success("Istio CR created")
pilot:
ipFamilyPolicy: %s
env:
ISTIO_DUAL_STACK: "true"
cni:
enabled: true`
common.CreateIstio(k, version.Name, fmt.Sprintf(spec, corev1.IPFamilyPolicyRequireDualStack))
})

It("updates the Istio CR status to Reconciled", func(ctx SpecContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,41 +70,11 @@ var _ = Describe("Multicluster deployment models", Label("multicluster", "multic
Expect(k1.CreateNamespace(controlPlaneNamespace)).To(Succeed(), "Namespace failed to be created")
Expect(k1.CreateNamespace(istioCniNamespace)).To(Succeed(), "Istio CNI namespace failed to be created")

multiclusterCNIYAML := `
apiVersion: sailoperator.io/v1
kind: IstioCNI
metadata:
name: {{ .Name }}
spec:
version: {{ .Version }}
namespace: {{ .Namespace }}`
multiclusterCNIYAML = genTemplate(multiclusterCNIYAML, map[string]any{
"Name": istioCniName,
"Namespace": istioCniNamespace,
"Version": v.Name,
})
Log("Istio CNI CR Cluster #1: ", multiclusterCNIYAML)
Expect(k1.CreateFromString(multiclusterCNIYAML)).To(Succeed(), "Istio CNI Resource creation failed on Cluster #1")

multiclusterYAML := `
apiVersion: sailoperator.io/v1
kind: Istio
metadata:
name: {{ .Name }}
spec:
version: {{ .Version }}
namespace: {{ .Namespace }}
values:
global:
network: {{ .Network }}`
multiclusterYAML = genTemplate(multiclusterYAML, map[string]any{
"Name": istioName,
"Namespace": controlPlaneNamespace,
"Network": "network1",
"Version": v.Name,
})
Log("Istio CR Cluster #1: ", multiclusterYAML)
Expect(k1.CreateFromString(multiclusterYAML)).To(Succeed(), "Istio Resource creation failed on Cluster #1")
common.CreateIstioCNI(k1, v.Name)
common.CreateIstio(k1, v.Name, `
values:
global:
network: network1`)
})

It("updates the default Istio CR status to Ready", func(ctx SpecContext) {
Expand Down Expand Up @@ -143,21 +113,8 @@ spec:
Expect(clRemote.Get(ctx, client.ObjectKey{Name: externalControlPlaneNamespace}, &corev1.Namespace{})).To(Succeed())

Expect(k2.CreateNamespace(istioCniNamespace)).To(Succeed(), "Istio CNI namespace failed to be created")
remoteIstioCNIYAML := `
apiVersion: sailoperator.io/v1
kind: IstioCNI
metadata:
name: {{ .Name }}
spec:
version: {{ .Version }}
namespace: {{ .Namespace }}`
remoteIstioCNIYAML = genTemplate(remoteIstioCNIYAML, map[string]any{
"Name": istioCniName,
"Namespace": istioCniNamespace,
"Version": v.Name,
})
Log("Istio CNI CR Cluster #2: ", remoteIstioCNIYAML)
Expect(k2.CreateFromString(remoteIstioCNIYAML)).To(Succeed(), "Istio CNI Resource creation failed on Cluster #2")
common.CreateIstioCNI(k2, v.Name)
Log("Istio CNI created on Cluster #2")

remotePilotAddress := common.GetSVCLoadBalancerAddress(ctx, clPrimary, controlPlaneNamespace, "istio-ingressgateway")
remotePilotIP, err := common.ResolveHostDomainToIP(remotePilotAddress)
Expand Down
49 changes: 12 additions & 37 deletions tests/e2e/multicluster/multicluster_multiprimary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,43 +76,18 @@ var _ = Describe("Multicluster deployment models", Label("multicluster", "multic
return err
}).ShouldNot(HaveOccurred(), "Secret is not created on Cluster #1")

multiclusterIstioCNIYAML := `
apiVersion: sailoperator.io/v1
kind: IstioCNI
metadata:
name: default
spec:
version: %s
namespace: %s`
multiclusterIstioCNICluster1YAML := fmt.Sprintf(multiclusterIstioCNIYAML, version.Name, istioCniNamespace)
Log("Istio CNI CR Cluster #1: ", multiclusterIstioCNICluster1YAML)
Expect(k1.CreateFromString(multiclusterIstioCNICluster1YAML)).To(Succeed(), "Istio CNI Resource creation failed on Cluster #1")

multiclusterIstioCNICluster2YAML := fmt.Sprintf(multiclusterIstioCNIYAML, version.Name, istioCniNamespace)
Log("Istio CNI CR Cluster #2: ", multiclusterIstioCNICluster2YAML)
Expect(k2.CreateFromString(multiclusterIstioCNICluster2YAML)).To(Succeed(), "Istio CNI Resource creation failed on Cluster #2")

multiclusterIstioYAML := `
apiVersion: sailoperator.io/v1
kind: Istio
metadata:
name: default
spec:
version: %s
namespace: %s
values:
global:
meshID: %s
multiCluster:
clusterName: %s
network: %s`
multiclusterIstioCluster1YAML := fmt.Sprintf(multiclusterIstioYAML, version.Name, controlPlaneNamespace, "mesh1", "cluster1", "network1")
Log("Istio CR Cluster #1: ", multiclusterIstioCluster1YAML)
Expect(k1.CreateFromString(multiclusterIstioCluster1YAML)).To(Succeed(), "Istio Resource creation failed on Cluster #1")

multiclusterIstioCluster2YAML := fmt.Sprintf(multiclusterIstioYAML, version.Name, controlPlaneNamespace, "mesh1", "cluster2", "network2")
Log("Istio CR Cluster #2: ", multiclusterIstioCluster2YAML)
Expect(k2.CreateFromString(multiclusterIstioCluster2YAML)).To(Succeed(), "Istio Resource creation failed on Cluster #2")
common.CreateIstioCNI(k1, version.Name)
common.CreateIstioCNI(k2, version.Name)

spec := `
values:
global:
meshID: mesh1
multiCluster:
clusterName: %s
network: %s`
common.CreateIstio(k1, version.Name, fmt.Sprintf(spec, "cluster1", "network1"))
common.CreateIstio(k2, version.Name, fmt.Sprintf(spec, "cluster2", "network2"))
})

It("updates both Istio CR status to Ready", func(ctx SpecContext) {
Expand Down
Loading