Skip to content

Commit 5cdb8f4

Browse files
joshuabairdmarcofranssen
authored andcommitted
Add Helm v4 E2E tests.
Signed-off-by: Josh Baird <jbaird@galileo.io>
1 parent edd6d92 commit 5cdb8f4

6 files changed

Lines changed: 746 additions & 7 deletions

File tree

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ cleanup-test-e2e:
9797
.PHONY: test-e2e
9898
test-e2e: setup-test-e2e fluentd-e2e ## Run the e2e tests against a Kind k8s instance that is spun up.
9999

100+
.PHONY: helm-v4-e2e
101+
helm-v4-e2e: setup-test-e2e ## Run Helm v4 chart e2e tests against a Kind k8s instance.
102+
@export KIND_CLUSTER=$(KIND_CLUSTER); export PATH="$$PWD/bin:$$PATH"; tests/scripts/helm_v4_e2e.sh
103+
104+
.PHONY: helm-upgrade-e2e
105+
helm-upgrade-e2e: setup-test-e2e ## Run Helm v4 upgrade e2e tests (v3 → v4) against a Kind k8s instance.
106+
@export KIND_CLUSTER=$(KIND_CLUSTER); export PATH="$$PWD/bin:$$PATH"; tests/scripts/helm_v4_upgrade_e2e.sh
107+
100108
%-e2e: ginkgo
101109
@export KIND_CLUSTER=$(KIND_CLUSTER); export PATH="$$PWD/bin:$$PATH"; tests/scripts/$*_e2e.sh
102110

charts/fluent-operator/MIGRATION-v4.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,13 @@ When upgrading, manually apply CRD updates before upgrading the chart:
263263
helm repo update
264264

265265
# Extract and apply CRD updates
266+
# Note: --server-side --force-conflicts is required:
267+
# - --server-side: the v4 CRDs exceed the 262144-byte annotation limit of
268+
# client-side apply.
269+
# - --force-conflicts: Helm owns the existing CRD fields; kubectl must take
270+
# over management to apply the v4 schema changes.
266271
helm pull fluent/fluent-operator --version 4.0.0 --untar
267-
kubectl apply -f fluent-operator/crds/
272+
kubectl apply --server-side --force-conflicts -f fluent-operator/crds/
268273

269274
# Then upgrade the chart
270275
helm upgrade fluent-operator fluent/fluent-operator --version 4.0.0
@@ -341,15 +346,30 @@ helm upgrade fluent-operator fluent/fluent-operator --version 4.0.0
341346

342347
### Migrating to Helm-Managed CRDs
343348

344-
If you want to switch to full Helm management of CRDs:
349+
If you want to switch to full Helm lifecycle management of CRDs after upgrading to v4.0:
345350

346351
```bash
347-
# Step 1: Install the new CRDs chart (existing CRDs will be adopted)
352+
# Step 1: Apply v4 CRDs manually (see Upgrading Standard Installation above)
353+
kubectl apply --server-side --force-conflicts -f fluent-operator/crds/
354+
355+
# Step 2: Add Helm ownership metadata to all existing fluent.io CRDs.
356+
# Helm cannot adopt pre-existing cluster resources without this metadata.
357+
NAMESPACE=fluent # set to your release namespace
358+
kubectl get crds -o name | grep '\.fluent\.io' | while read crd; do
359+
kubectl label "$crd" app.kubernetes.io/managed-by=Helm --overwrite
360+
kubectl annotate "$crd" \
361+
meta.helm.sh/release-name=fluent-operator-crds \
362+
meta.helm.sh/release-namespace="${NAMESPACE}" --overwrite
363+
done
364+
365+
# Step 3: Install the CRDs chart — it will adopt the annotated CRDs
348366
helm install fluent-operator-crds fluent/fluent-operator-crds \
367+
--namespace "${NAMESPACE}" \
349368
--set additionalAnnotations."helm\.sh/resource-policy"=keep
350369

351-
# Step 2: Upgrade operator to v4.0 with --skip-crds
352-
helm upgrade fluent-operator fluent/fluent-operator --version 4.0.0 --skip-crds
370+
# Step 4: Upgrade operator to v4.0 with --skip-crds
371+
helm upgrade fluent-operator fluent/fluent-operator --version 4.0.0 \
372+
--namespace "${NAMESPACE}" --skip-crds
353373
```
354374

355375
### Fresh v4.0 Installation

charts/fluent-operator/_docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ When upgrading, manually apply CRD updates before upgrading the chart. You can o
2323
```bash
2424
# Option 1: Extract from the chart
2525
helm pull fluent/fluent-operator --untar
26-
kubectl apply -f fluent-operator/crds/
26+
kubectl apply --server-side --force-conflicts -f fluent-operator/crds/
2727

2828
# Option 2: Clone the repository
2929
git clone https://github.com/fluent/fluent-operator.git
3030
cd fluent-operator
31-
kubectl apply -f charts/fluent-operator/crds/
31+
kubectl apply --server-side --force-conflicts -f charts/fluent-operator/crds/
3232

3333
# Then upgrade the chart
3434
helm upgrade fluent-operator fluent/fluent-operator

tests/fixtures/fluentbit-cr.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: fluentbit.fluent.io/v1alpha2
2+
kind: FluentBit
3+
metadata:
4+
name: fluent-bit
5+
namespace: fluent
6+
spec:
7+
image: ghcr.io/fluent/fluent-operator/fluent-bit:v4.2.3
8+
positionDB:
9+
hostPath:
10+
path: /var/lib/fluent-bit/
11+
resources:
12+
requests:
13+
cpu: 10m
14+
memory: 25Mi
15+
limits:
16+
cpu: 500m
17+
memory: 200Mi

0 commit comments

Comments
 (0)