Skip to content

Commit

Permalink
Add server-side apply flag to kubectl apply
Browse files Browse the repository at this point in the history
Due to a repetition for Redpanda in version v1alpha1 and v1alpha2
the kubectl apply fails with

```
The CustomResourceDefinition "redpandas.cluster.redpanda.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes
```

With server-side flag the annotation is not added to each
resource.

Reference

https://github.com/kubernetes/kubectl/blob/514f46729f82412dd9cc41f206058bc4ae9b62b0/pkg/cmd/apply/apply.go#L762-L784
  • Loading branch information
RafalKorepta committed May 15, 2024
1 parent f487434 commit 62a11af
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/go/k8s/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ run-v2: generate vet manifests fmt

# Install CRDs into a cluster
install: manifests kustomize
$(KUSTOMIZE) build config/crd | kubectl apply -f -
$(KUSTOMIZE) build config/crd | kubectl apply --server-side -f -

# Uninstall CRDs from a cluster
uninstall: manifests kustomize
Expand All @@ -81,7 +81,7 @@ uninstall: manifests kustomize
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
deploy: manifests kustomize
cd config/manager && $(KUSTOMIZE) edit set image vectorized/redpanda-operator=${OPERATOR_IMG_LATEST}
$(KUSTOMIZE) build config/default | kubectl apply -f -
$(KUSTOMIZE) build config/default | kubectl apply --server-side -f -
kind load docker-image ${REDPANDA_IMG}

# Deploy pre loaded controller in the configured Kind Kubernetes cluster
Expand Down
2 changes: 1 addition & 1 deletion src/go/k8s/kuttl-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ commands:
- 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 2>> tests/_e2e_artifacts/kustomize-output.txt | kubectl apply -f - 1>> tests/_e2e_artifacts/kubectl-output.txt 2>> tests/_e2e_artifacts/kubectl-error-output.txt; do sleep 0.5; done'"
- command: "sh -c 'until kustomize build config/e2e-tests 2>> tests/_e2e_artifacts/kustomize-output.txt | kubectl apply --server-side -f - 1>> tests/_e2e_artifacts/kubectl-output.txt 2>> tests/_e2e_artifacts/kubectl-error-output.txt; do sleep 0.5; done'"
background: true
- command: "./hack/wait-for-webhook-ready.sh"
artifactsDir: tests/_e2e_artifacts
Expand Down
2 changes: 1 addition & 1 deletion src/go/k8s/kuttl-unstable-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ commands:
- command: "./hack/install-cert-manager.sh tests/_e2e_unstable_artifacts"
- command: "kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/e23ff77fceba6a5d9f190f5d1a123c87701dc964/bundle.yaml"
- command: "sh -c 'cd config/manager && kustomize edit set image vectorized/redpanda-operator=localhost/redpanda-operator:dev'"
- command: "sh -c 'kustomize build config/default | kubectl apply -f -'"
- command: "sh -c 'kustomize build config/default | kubectl apply --server-side -f -'"
- command: "kind load docker-image localhost/redpanda:dev"
- command: "./hack/wait-for-webhook-ready.sh"
artifactsDir: tests/_e2e_unstable_artifacts
Expand Down
2 changes: 1 addition & 1 deletion src/go/k8s/kuttl-v2-helm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ commands:
- command: kubectl taint nodes -l node-role.kubernetes.io/master= node-role.kubernetes.io/master:NoSchedule-
ignoreFailure: true
- command: ./hack/install-cert-manager.sh tests/_e2e_helm_artifacts_v2
- script: kubectl kustomize ./config/crd | kubectl apply -f -
- script: kubectl kustomize ./config/crd | kubectl apply --server-side -f -
- command: helm repo add redpanda https://charts.redpanda.com
- command: helm repo update
- command: helm install --set logLevel=trace --set image.tag=dev
Expand Down
2 changes: 1 addition & 1 deletion src/go/k8s/kuttl-v2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ commands:
- command: kubectl taint nodes -l node-role.kubernetes.io/master= node-role.kubernetes.io/master:NoSchedule-
ignoreFailure: true
- command: ./hack/install-cert-manager.sh tests/_e2e_artifacts_v2
- script: kubectl kustomize ./config/crd | kubectl apply -f -
- script: kubectl kustomize ./config/crd | kubectl apply --server-side -f -
- command: helm repo add redpanda https://charts.redpanda.com
- command: helm repo update
- command: helm install --set logLevel=trace --set image.tag=dev
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl apply -f https://github.com/fluxcd/flux2/releases/download/v2.2.2/install.yaml
- command: kubectl apply --server-side -f https://github.com/fluxcd/flux2/releases/download/v2.2.2/install.yaml
assert:
- 01-assert-install-flux.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: kubectl kustomize https://github.com/redpanda-data/redpanda-operator//src/go/k8s/config/crd | kubectl apply -f -
- script: kubectl kustomize ../../../config/crd | kubectl apply --server-side -f -
- command: helm upgrade --install --set logLevel=trace --set image.tag=dev
--set image.repository=localhost/redpanda-operator --namespace redpanda --create-namespace redpanda-operator
redpanda/operator --set rbac.createAdditionalControllerCRs=true --set additionalCmdFlags="{--additional-controllers=all,--enable-helm-controllers=true}"
Expand Down

0 comments on commit 62a11af

Please sign in to comment.