diff --git a/tests/templates/kuttl/restarter-content-identical-write/00-patch-ns.yaml.j2 b/tests/templates/kuttl/restarter-content-identical-write/00-patch-ns.yaml.j2 new file mode 100644 index 0000000..67185ac --- /dev/null +++ b/tests/templates/kuttl/restarter-content-identical-write/00-patch-ns.yaml.j2 @@ -0,0 +1,9 @@ +{% if test_scenario['values']['openshift'] == 'true' %} +# see https://github.com/stackabletech/issues/issues/566 +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: kubectl patch namespace $NAMESPACE -p '{"metadata":{"labels":{"pod-security.kubernetes.io/enforce":"privileged"}}}' + timeout: 120 +{% endif %} diff --git a/tests/templates/kuttl/restarter-content-identical-write/10-assert.yaml b/tests/templates/kuttl/restarter-content-identical-write/10-assert.yaml new file mode 100644 index 0000000..9941c1f --- /dev/null +++ b/tests/templates/kuttl/restarter-content-identical-write/10-assert.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 300 +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test + generation: 1 +status: + readyReplicas: 2 + replicas: 2 + observedGeneration: 1 diff --git a/tests/templates/kuttl/restarter-content-identical-write/10-statefulset.yaml b/tests/templates/kuttl/restarter-content-identical-write/10-statefulset.yaml new file mode 100644 index 0000000..453532b --- /dev/null +++ b/tests/templates/kuttl/restarter-content-identical-write/10-statefulset.yaml @@ -0,0 +1,38 @@ +--- +# A minimal StatefulSet opted in to the restarter, mounting a ConfigMap. + +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-config +data: + foo: bar +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test + labels: + restarter.stackable.tech/enabled: "true" +spec: + selector: + matchLabels: + app: test + serviceName: test + replicas: 2 + template: + metadata: + labels: + app: test + spec: + terminationGracePeriodSeconds: 1 + containers: + - name: nginx + image: nginxinc/nginx-unprivileged:1.27 + volumeMounts: + - name: config + mountPath: /config + volumes: + - name: config + configMap: + name: test-config diff --git a/tests/templates/kuttl/restarter-content-identical-write/20-assert.yaml b/tests/templates/kuttl/restarter-content-identical-write/20-assert.yaml new file mode 100644 index 0000000..dbd2310 --- /dev/null +++ b/tests/templates/kuttl/restarter-content-identical-write/20-assert.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestAssert +timeout: 30 +--- +# The ConfigMap content never changed. +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-config +data: + foo: bar +--- +# This should stay on generation 1 +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: test + generation: 1 +status: + readyReplicas: 2 + replicas: 2 + observedGeneration: 1 diff --git a/tests/templates/kuttl/restarter-content-identical-write/20-content-identical-write.yaml b/tests/templates/kuttl/restarter-content-identical-write/20-content-identical-write.yaml new file mode 100644 index 0000000..be86506 --- /dev/null +++ b/tests/templates/kuttl/restarter-content-identical-write/20-content-identical-write.yaml @@ -0,0 +1,19 @@ +--- +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +timeout: 120 +commands: + # Do a change that should (tm) not have an impact on a pod mounting/needing this cm. + - script: | + kubectl apply --server-side --field-manager=third-party-controller --force-conflicts -f - <