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
24 changes: 16 additions & 8 deletions tests/e2e/common-operator-integ-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,22 @@ export COMMAND OCP HUB IMAGE_BASE TAG NAMESPACE
if [ "${SKIP_BUILD}" == "false" ]; then
"${WD}/setup/build-and-push-operator.sh"

if [ "${OCP}" = "true" ]; then
# This is a workaround when pulling the image from internal registry
# To avoid errors of certificates meanwhile we are pulling the operator image from the internal registry
# We need to set image $HUB to a fixed known value after the push
# This value always will be equal to the svc url of the internal registry
HUB="image-registry.openshift-image-registry.svc:5000/istio-images"
echo "Using internal registry: ${HUB}"

# Workaround for OCP helm operator installation issues:
# To avoid any cleanup issues, after we build and push the image we check if the namespace exists and delete it if it does.
# The test logic already handles the namespace creation and deletion during the test run.
if ${COMMAND} get ns "${NAMESPACE}" &>/dev/null; then
echo "Namespace ${NAMESPACE} already exists. Deleting it to avoid conflicts."
${COMMAND} delete ns "${NAMESPACE}"
fi
fi
# If OLM is enabled, deploy the operator using OLM
# We are skipping the deploy via OLM test on OCP because the workaround to avoid the certificate issue is not working.
# Jira ticket related to the limitation: https://issues.redhat.com/browse/OSSM-7993
Expand Down Expand Up @@ -182,14 +198,6 @@ if [ "${SKIP_BUILD}" == "false" ]; then
fi
fi

if [ "${OCP}" == "true" ]; then
# This is a workaround
# To avoid errors of certificates meanwhile we are pulling the operator image from the internal registry
# We need to set image $HUB to a fixed known value after the push
# This value always will be equal to the svc url of the internal registry
HUB="image-registry.openshift-image-registry.svc:5000/sail-operator"
fi

export SKIP_DEPLOY IP_FAMILY ISTIO_MANIFEST NAMESPACE CONTROL_PLANE_NS DEPLOYMENT_NAME MULTICLUSTER ARTIFACTS ISTIO_NAME COMMAND KUBECONFIG ISTIOCTL_PATH

# shellcheck disable=SC2086
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
Loading