Skip to content

Commit

Permalink
fixup for #206
Browse files Browse the repository at this point in the history
206 got merged, even with red tests. this should not have happened. this PR fixes the problem.
  • Loading branch information
birdayz committed Sep 2, 2024
1 parent 30ee31b commit d170c26
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 14 deletions.
64 changes: 64 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,69 @@ steps:
TAG_NAME=$(ci/scripts/tag-check.sh) ./ci/scripts/run-in-nix-docker.sh ./task ci:k8s
agents:
queue: amd64-builders
artifact_paths:
- src/go/k8s/*.tar.gz
- src/go/k8s/tests/_e2e_with_flags_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
- 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
Expand Down Expand Up @@ -134,6 +197,7 @@ steps:
- main



- group: K8s Operator v2 Jobs
if: |
build.tag == null ||
Expand Down
13 changes: 6 additions & 7 deletions src/go/k8s/pkg/resources/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,12 @@ func (r *StatefulSetResource) obj(
// In any case, configure PersistentVolumeClaimRetentionPolicy
// Default to old behavior: Retain PVC
// If auto-remove-pvcs flag is set, active new behavior: switch to Delete for both WhenScaled and WhenDeleted.
var pvcReclaimRetentionPolicy appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy
var pvcReclaimRetentionPolicy *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy
if r.autoDeletePVCs {
pvcReclaimRetentionPolicy.WhenScaled = appsv1.DeletePersistentVolumeClaimRetentionPolicyType
pvcReclaimRetentionPolicy.WhenDeleted = appsv1.DeletePersistentVolumeClaimRetentionPolicyType
} else {
pvcReclaimRetentionPolicy.WhenScaled = appsv1.RetainPersistentVolumeClaimRetentionPolicyType
pvcReclaimRetentionPolicy.WhenDeleted = appsv1.RetainPersistentVolumeClaimRetentionPolicyType
pvcReclaimRetentionPolicy = &appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy{
WhenDeleted: appsv1.DeletePersistentVolumeClaimRetentionPolicyType,
WhenScaled: appsv1.DeletePersistentVolumeClaimRetentionPolicyType,
}
}

// We set statefulset replicas via status.currentReplicas in order to control it from the handleScaling function
Expand All @@ -368,7 +367,7 @@ func (r *StatefulSetResource) obj(
APIVersion: "apps/v1",
},
Spec: appsv1.StatefulSetSpec{
PersistentVolumeClaimRetentionPolicy: &pvcReclaimRetentionPolicy,
PersistentVolumeClaimRetentionPolicy: pvcReclaimRetentionPolicy,
Replicas: &replicas,
PodManagementPolicy: appsv1.ParallelPodManagement,
Selector: clusterLabels.AsAPISelector(),
Expand Down
1 change: 1 addition & 0 deletions src/go/k8s/tests/e2e/endpoint-template/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ commands:
- timeout: 300
script: |
kubectl wait --for=condition=ClusterConfigured=True cluster/endpoint-template --timeout 300s --namespace $NAMESPACE
kubectl wait --for=condition=OperatorQuiescent=True cluster/endpoint-template --timeout 300s --namespace $NAMESPACE
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
Expand Down
14 changes: 7 additions & 7 deletions src/go/k8s/tests/e2e/endpoint-template/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- timeout: 300
script: |
kubectl wait --for=condition=ClusterConfigured=True cluster/endpoint-template --timeout 300s --namespace $NAMESPACE
---
apiVersion: redpanda.vectorized.io/v1alpha1
kind: Cluster
metadata:
Expand All @@ -7,13 +14,6 @@ status:
readyReplicas: 3
restarting: false
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- timeout: 300
script: |
kubectl wait --for=condition=ClusterConfigured=True cluster/endpoint-template --timeout 300s --namespace $NAMESPACE
---
apiVersion: v1
kind: Pod
metadata:
Expand Down
9 changes: 9 additions & 0 deletions taskfiles/k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ tasks:
- :dev:install-kustomize
- :dev:install-kuttl
- :dev:install-yq
- task: set-aio-max
vars:
USE_SUDO: "false"
- task: set-inotify-watches
vars:
USE_SUDO: "false"
- task: set-inotify-instances
vars:
USE_SUDO: "false"
- task: fetch-latest-redpanda
- task: build-operator-images
cmds:
Expand Down

0 comments on commit d170c26

Please sign in to comment.