Skip to content

Commit 81b0fbe

Browse files
feat: add crds as a separate release artifact, build stripped crds to fit client-side apply
1 parent f55fbb7 commit 81b0fbe

5 files changed

Lines changed: 56 additions & 8 deletions

File tree

.github/workflows/release.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ jobs:
101101
run: |
102102
make build-installer
103103
mv dist/install.yaml dist/clickhouse-operator.yaml
104+
make build-installer-stripped
105+
mv dist/install-stripped-crds.yaml dist/clickhouse-operator-stripped-crds.yaml
106+
make build-crds
107+
mv dist/crds.yaml dist/clickhouse-operator-crds.yaml
108+
make build-crds-stripped
109+
mv dist/crds-stripped.yaml dist/clickhouse-operator-crds-stripped.yaml
104110
- name: Install Helm
105111
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
106112
- name: Verify Helm installation
@@ -152,10 +158,22 @@ jobs:
152158
name: ${{github.ref_name }}
153159
draft: true
154160
body: |
155-
## Install using the manifest
161+
## Install using the manifest (server-side apply)
156162
```
157-
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator.yaml
163+
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator.yaml
158164
```
165+
166+
For clusters restricted to client-side apply, use the description-stripped CRDs:
167+
```
168+
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator-stripped-crds.yaml
169+
```
170+
171+
## CRDs only
172+
```
173+
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator-crds.yaml
174+
```
175+
176+
Client-side apply variant: `clickhouse-operator-crds-stripped.yaml`
159177
160178
## Install using helmchart
161179
```
@@ -171,6 +189,9 @@ jobs:
171189
append_body: true
172190
files: |
173191
dist/clickhouse-operator.yaml
192+
dist/clickhouse-operator-stripped-crds.yaml
193+
dist/clickhouse-operator-crds.yaml
194+
dist/clickhouse-operator-crds-stripped.yaml
174195
clickhouse-operator-helm-${{env.VERSION}}.tgz
175196
clickhouse-cluster-helm-${{env.VERSION}}.tgz
176197
clickhouse-operator_${{env.VERSION}}_*.tar.gz

Makefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,26 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
328328
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
329329
$(KUSTOMIZE) build config/default > dist/install.yaml
330330

331+
.PHONY: build-installer-stripped
332+
build-installer-stripped: manifests generate kustomize ## Generate a consolidated installer with description-stripped CRDs (for client-side kubectl apply).
333+
mkdir -p dist
334+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases
335+
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
336+
$(KUSTOMIZE) build config/default > dist/install-stripped-crds.yaml
337+
$(MAKE) manifests
338+
339+
.PHONY: build-crds
340+
build-crds: manifests kustomize ## Generate standalone CRD manifests.
341+
mkdir -p dist
342+
$(KUSTOMIZE) build config/crd > dist/crds.yaml
343+
344+
.PHONY: build-crds-stripped
345+
build-crds-stripped: manifests kustomize ## Generate standalone CRD manifests with descriptions stripped (for client-side kubectl apply).
346+
mkdir -p dist
347+
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases
348+
$(KUSTOMIZE) build config/crd > dist/crds-stripped.yaml
349+
$(MAKE) manifests
350+
331351
##@ Deployment
332352

333353
ifndef ignore-not-found
@@ -336,7 +356,7 @@ endif
336356

337357
.PHONY: install
338358
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
339-
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
359+
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply --server-side --force-conflicts -f -
340360

341361
.PHONY: uninstall
342362
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
@@ -345,7 +365,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
345365
.PHONY: deploy
346366
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
347367
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
348-
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
368+
$(KUSTOMIZE) build config/default | $(KUBECTL) apply --server-side --force-conflicts -f -
349369

350370
.PHONY: undeploy
351371
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ For users who want to quickly try the operator:
4242
1. Install the Custom Resource Definitions(CRD) and operator (Requires cert-manager to issue webhook certificates):
4343
- Using pre-built manifests:
4444
```sh
45-
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator.yaml
45+
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator.yaml
4646
```
4747
- Using helm chart
4848
```sh

docs/install/kubectl.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ Requires cert-manager to issue webhook certificates.
2424
Install the operator and CRDs from the latest release:
2525

2626
```bash
27-
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator.yaml
27+
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator.yaml
28+
```
29+
30+
Server-side apply is required because the combined CRDs exceed the client-side apply size limit. For environments that only support client-side apply, use the description-stripped CRD variant:
31+
32+
```bash
33+
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator-stripped-crds.yaml
2834
```
2935

3036
This will:
@@ -94,7 +100,7 @@ Build the operator manifests and apply them:
94100

95101
```bash
96102
make build-installer VERSION=<required operator version> [IMG=<custom registry path>]
97-
kubectl apply -f dist/install.yaml
103+
kubectl apply --server-side --force-conflicts -f dist/install.yaml
98104
```
99105

100106
</Step>

test/deploy/deploy_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ var _ = Describe("Manifests deployment", Ordered, Label("manifest"), func() {
142142
Expect(testutil.MustRun(ctx, "make", "build-installer", "IMG="+testImage)).To(Succeed())
143143

144144
By("applying installer manifest")
145-
Expect(testutil.MustRun(ctx, "kubectl", "apply", "-f", "dist/install.yaml")).To(Succeed())
145+
Expect(testutil.MustRun(ctx, "kubectl", "apply", "--server-side", "--force-conflicts",
146+
"-f", "dist/install.yaml")).To(Succeed())
146147

147148
DeferCleanup(func(ctx context.Context) {
148149
By("removing installer manifest resources")

0 commit comments

Comments
 (0)