-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
operator v1: add separate test suite with feature flags
it's not possible to toggle feature flags on a per test case basis. therefore, as per advice from Rafal, we're adding a new test suite. it also uses k8s 1.28, as this is what cloud uses, and is required by the new code under test.
- Loading branch information
Showing
28 changed files
with
474 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,70 @@ steps: | |
failed: true | ||
branches: | ||
- main | ||
- key: k8s-operator-with-flags | ||
label: K8s Operator tests with flags | ||
timeout_in_minutes: 180 | ||
notify: | ||
- github_commit_status: | ||
context: k8s-operator | ||
commands: | ||
- | | ||
TAG_NAME=$(ci/scripts/tag-check.sh) ./ci/scripts/run-in-nix-docker.sh ./task ci:run-k8s-tests-with-flags | ||
agents: | ||
queue: amd64-builders | ||
artifact_paths: | ||
- src/go/k8s/*.tar.gz | ||
- src/go/k8s/tests/_e2e_artifacts/kuttl-report.xml | ||
plugins: | ||
- seek-oss/aws-sm#v2.3.2: &aws-sm-plugin | ||
json-to-env: | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/active_directory | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/buildkite_analytics_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/buildkite_api_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/cdt_gcp | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/cdt_runner_aws | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/ci_db | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/cloudsmith | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/dockerhub | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/gh_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/github_api_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/goreleaser_key | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/grafana_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/redpanda_sample_license | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/redpanda_second_sample_license | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/rpk_test_client | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/seceng_audit_aws | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/slack_vbot_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/teleport_bot_token | ||
- json-key: . | ||
secret-id: sdlc/prod/buildkite/test_result_dsn | ||
- https://[email protected]/redpanda-data/step-slack-notify-buildkite-plugin.git#main: | ||
message: ":cloud: K8s Operator v1 Jobs failed" | ||
channel_name: "kubernetes-tests" | ||
slack_token_env_var_name: "SLACK_VBOT_TOKEN" | ||
conditions: | ||
failed: true | ||
branches: | ||
- main | ||
|
||
|
||
- group: K8s Operator v2 Jobs | ||
if: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../e2e-tests | ||
patches: | ||
- patch: |- | ||
- op: add | ||
path: /spec/template/spec/containers/0/args/- | ||
value: --auto-delete-pvcs | ||
target: | ||
group: apps | ||
version: v1 | ||
kind: Deployment | ||
name: controller-manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
# Need to run KIND 0.19 based image; >0.19 does not support cgroupsv1/missing cgroupns - and this is required for CI at the moment. | ||
image: kindest/node:v1.28.0@sha256:dad5a6238c5e41d7cac405fae3b5eda2ad1de6f1190fa8bfc64ff5bb86173213 | ||
- role: worker | ||
image: kindest/node:v1.28.0@sha256:dad5a6238c5e41d7cac405fae3b5eda2ad1de6f1190fa8bfc64ff5bb86173213 | ||
- role: worker | ||
image: kindest/node:v1.28.0@sha256:dad5a6238c5e41d7cac405fae3b5eda2ad1de6f1190fa8bfc64ff5bb86173213 | ||
- role: worker | ||
image: kindest/node:v1.28.0@sha256:dad5a6238c5e41d7cac405fae3b5eda2ad1de6f1190fa8bfc64ff5bb86173213 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestSuite | ||
startKIND: true | ||
kindContainers: | ||
- localhost/redpanda-operator:dev | ||
- localhost/configurator:dev | ||
- localhost/redpanda:dev | ||
testDirs: | ||
- ./tests/e2e-with-flags | ||
kindConfig: ./kind-for-cloud.yaml | ||
kindNodeCache: false | ||
commands: | ||
- command: kubectl taint node kind-control-plane node-role.kubernetes.io/control-plane- | ||
- command: "mkdir -p tests/_e2e_with_flags_artifacts" | ||
- command: "./hack/install-cert-manager.sh tests/_e2e_with_flags_artifacts" | ||
background: true | ||
ignoreFailure: true | ||
- command: "kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/e23ff77fceba6a5d9f190f5d1a123c87701dc964/bundle.yaml" | ||
background: true | ||
ignoreFailure: true | ||
- command: "sh -c 'until kustomize build config/e2e-tests-with-flags 2>> tests/_e2e_with_flags_artifacts/kustomize-output.txt | kubectl apply --server-side -f - 1>> tests/_e2e_with_flags_artifacts/kubectl-output.txt 2>> tests/_e2e_with_flags_artifacts/kubectl-error-output.txt; do sleep 0.5; done'" | ||
background: true | ||
- command: "./hack/wait-for-webhook-ready.sh" | ||
artifactsDir: tests/_e2e_with_flags_artifacts | ||
timeout: 330 | ||
reportFormat: xml | ||
parallel: 2 | ||
namespace: redpanda-system | ||
suppress: | ||
- events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Package patch is a utility package that provides utils around patching a resource. | ||
// It has its own package, because of a dependency conflict; pkg/utils may not | ||
// import types/v1alpha1, types/v1alpha1 imports pkg/utils (cycle). | ||
package patch | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
vectorizedv1alpha1 "github.com/redpanda-data/redpanda-operator/src/go/k8s/api/vectorized/v1alpha1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
// PatchStatus persforms a mutation as done by mutator, calls k8s-api with PATCH, and then returns the | ||
// new status. | ||
func PatchStatus(ctx context.Context, c client.Client, observedCluster *vectorizedv1alpha1.Cluster, mutator func(cluster *vectorizedv1alpha1.Cluster)) (vectorizedv1alpha1.ClusterStatus, error) { | ||
clusterPatch := client.MergeFrom(observedCluster.DeepCopy()) | ||
mutator(observedCluster) | ||
|
||
if err := c.Status().Patch(ctx, observedCluster, clusterPatch); err != nil { | ||
return vectorizedv1alpha1.ClusterStatus{}, fmt.Errorf("failed to update cluster status: %w", err) | ||
} | ||
|
||
return observedCluster.Status, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/go/k8s/tests/e2e-with-flags/decommission/00-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
commands: | ||
- script: | | ||
kubectl wait --for=condition=ClusterConfigured=True cluster/up-img-admin-tls --timeout 300s --namespace $NAMESPACE | ||
kubectl wait --for=condition=OperatorQuiescent=True cluster/up-img-admin-tls --timeout 300s --namespace $NAMESPACE | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: decommission-0 | ||
status: | ||
phase: Running | ||
--- | ||
apiVersion: redpanda.vectorized.io/v1alpha1 | ||
kind: Cluster | ||
metadata: | ||
name: decommission | ||
status: | ||
replicas: 3 | ||
currentReplicas: 3 | ||
readyReplicas: 3 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: decommission | ||
spec: | ||
persistentVolumeClaimRetentionPolicy: | ||
whenDeleted: Delete | ||
whenScaled: Delete | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
collectors: | ||
- command: ../../../hack/get-redpanda-info.sh |
28 changes: 28 additions & 0 deletions
28
src/go/k8s/tests/e2e-with-flags/decommission/00-redpanda-cluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: redpanda.vectorized.io/v1alpha1 | ||
kind: Cluster | ||
metadata: | ||
name: decommission | ||
spec: | ||
image: "localhost/redpanda" | ||
version: "dev" | ||
replicas: 3 | ||
resources: | ||
requests: | ||
cpu: 1 | ||
memory: 1Gi | ||
limits: | ||
cpu: 1 | ||
memory: 1Gi | ||
configuration: | ||
rpcServer: | ||
port: 33145 | ||
kafkaApi: | ||
- port: 9092 | ||
adminApi: | ||
- port: 9644 | ||
pandaproxyApi: | ||
- port: 8082 | ||
developerMode: true | ||
additionalCommandlineArguments: | ||
dump-memory-diagnostics-on-alloc-failure-kind: all | ||
abort-on-seastar-bad-alloc: '' |
20 changes: 20 additions & 0 deletions
20
src/go/k8s/tests/e2e-with-flags/decommission/01-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
commands: | ||
- script: | | ||
kubectl wait --for=condition=ClusterConfigured=True cluster/up-img-admin-tls --timeout 300s --namespace $NAMESPACE | ||
kubectl wait --for=condition=OperatorQuiescent=True cluster/up-img-admin-tls --timeout 300s --namespace $NAMESPACE | ||
--- | ||
apiVersion: redpanda.vectorized.io/v1alpha1 | ||
kind: Cluster | ||
metadata: | ||
name: decommission | ||
status: | ||
replicas: 2 | ||
currentReplicas: 2 | ||
readyReplicas: 2 | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
collectors: | ||
- command: ../../../hack/get-redpanda-info.sh |
6 changes: 6 additions & 0 deletions
6
src/go/k8s/tests/e2e-with-flags/decommission/01-redpanda-downscale.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: redpanda.vectorized.io/v1alpha1 | ||
kind: Cluster | ||
metadata: | ||
name: decommission | ||
spec: | ||
replicas: 2 |
18 changes: 18 additions & 0 deletions
18
src/go/k8s/tests/e2e-with-flags/decommission/02-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
job-name: get-broker-count | ||
status: | ||
containerStatuses: | ||
- name: curl | ||
state: | ||
terminated: | ||
exitCode: 0 | ||
reason: Completed | ||
phase: Running | ||
--- | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
collectors: | ||
- command: ../../../hack/get-redpanda-info.sh |
Oops, something went wrong.