Skip to content

Commit ef27260

Browse files
authored
Merge pull request #250 from shopware/fix-helm-install-issue
fix: helm null issues
2 parents 964f16a + 84e5fdd commit ef27260

2 files changed

Lines changed: 79 additions & 6 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ jobs:
6262
- name: helm lint
6363
run: |
6464
helm lint charts/shopware
65+
- name: Check for null values in rendered templates
66+
run: |
67+
helm repo add percona https://percona.github.io/percona-helm-charts
68+
helm repo add grafana https://grafana.github.io/helm-charts
69+
helm repo add prometheus https://prometheus-community.github.io/helm-charts
70+
helm repo add opentelemetry https://open-telemetry.github.io/opentelemetry-helm-charts
71+
helm repo add rustfs https://rustfs.github.io/helm
72+
helm dependency build charts/shopware
73+
helm template test charts/shopware > rendered.yaml
74+
awk '
75+
BEGIN { RS="---\n"; ORS="---\n" }
76+
/^# Source: shopware\/templates\// { print }
77+
' rendered.yaml > rendered-shopware.yaml
78+
if grep -n ': null$' rendered-shopware.yaml; then
79+
echo "::error::Rendered templates contain 'null' values. Wrap optional fields in {{- with }} blocks to omit them when unset."
80+
exit 1
81+
fi
6582
6683
test-on-cluster:
6784
name: Cluster E2E Test
@@ -78,11 +95,12 @@ jobs:
7895
- name: Create k8s Kind Cluster
7996
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
8097

81-
- name: Run chart-testing (install)
98+
- name: Run preperation
8299
run: |
83100
kubectl apply --server-side -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.1/standard-install.yaml
84101
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/baremetal/deploy.yaml
85102
kubectl create namespace test
103+
kubectl create namespace test-template
86104
kubectl rollout status --namespace ingress-nginx deployment/ingress-nginx-controller --timeout=60s
87105
88106
helm repo add percona https://percona.github.io/percona-helm-charts
@@ -95,17 +113,43 @@ jobs:
95113
96114
helm template charts/shopware-operator --set crds.installOnly=true | kubectl apply --server-side -f -
97115
helm template op charts/shopware-operator --namespace test --set crds.installOnly=false --set crds.install=false | kubectl apply -f -
116+
helm template template charts/shopware-operator --namespace test-template --set crds.installOnly=false --set crds.install=false | kubectl apply -f -
117+
118+
tar -xOf charts/shopware/charts/pxc-operator-*.tgz pxc-operator/crds/crd.yaml | kubectl apply --server-side -f -
119+
for crd in \
120+
perconaxtradbclusters.pxc.percona.com \
121+
perconaxtradbclusterbackups.pxc.percona.com \
122+
perconaxtradbclusterrestores.pxc.percona.com; do
123+
established=""
124+
for i in $(seq 1 30); do
125+
established=$(kubectl get crd "$crd" -o jsonpath='{range .status.conditions[?(@.type=="Established")]}{.status}{end}' 2>/dev/null || true)
126+
if [ "$established" = "True" ]; then
127+
break
128+
fi
129+
sleep 2
130+
done
131+
if [ "$established" != "True" ]; then
132+
kubectl get crd "$crd" -o yaml
133+
exit 1
134+
fi
135+
done
98136
137+
kubectl wait --namespace test --for=condition=Available --timeout=60s deployment/op-shopware-operator || {
138+
kubectl get deployment/op-shopware-operator --namespace test -o json && exit 2
139+
}
140+
kubectl wait --namespace test-template --for=condition=Available --timeout=60s deployment/template-shopware-operator || {
141+
kubectl get deployment/template-shopware-operator --namespace test-template -o json && exit 3
142+
}
143+
144+
- name: Run helm install
145+
run: |
99146
helm install test --namespace test charts/shopware \
100147
--set rustfs.storageclass.dataStorageSize=100Mi \
101148
--set rustfs.storageclass.logStorageSize=100Mi \
102149
--set valkeyapp.master.resources.requests.cpu=200m \
103150
--set valkeysession.master.resources.requests.cpu=200m \
104151
--set valkeyworker.master.resources.requests.cpu=200m
105152
106-
kubectl wait --namespace test --for=condition=Available --timeout=60s deployment/op-shopware-operator || {
107-
kubectl get deployment/op-shopware-operator --namespace test -o json && exit 2
108-
}
109153
kubectl wait --namespace test store/test --for='jsonpath={.status.state}'=setup --timeout=1m
110154
111155
sleep 10
@@ -123,3 +167,34 @@ jobs:
123167
}
124168
125169
kubectl get pods --namespace test -o wide
170+
helm uninstall test --namespace test
171+
kubectl wait --namespace test --for=delete store/test --timeout=2m
172+
kubectl wait --namespace test --for=delete ingress/test-rustfs-s3-api --timeout=2m || true
173+
kubectl wait --namespace test --for=delete ingress/test-rustfs --timeout=2m || true
174+
175+
- name: Run helm template
176+
run: |
177+
helm template template charts/shopware --namespace test-template \
178+
--set rustfs.storageclass.dataStorageSize=100Mi \
179+
--set rustfs.storageclass.logStorageSize=100Mi \
180+
--set valkeyapp.master.resources.requests.cpu=200m \
181+
--set valkeysession.master.resources.requests.cpu=200m \
182+
--set valkeyworker.master.resources.requests.cpu=200m | kubectl apply -n test-template -f -
183+
184+
kubectl wait --namespace test-template store/template --for='jsonpath={.status.state}'=setup --timeout=1m
185+
186+
sleep 10
187+
188+
kubectl wait --namespace test-template jobs/template-setup --timeout=8m --for=condition=complete || {
189+
kubectl get job/template-setup --namespace test-template -o json; \
190+
kubectl get job --namespace test-template -o wide; \
191+
kubectl get pods --namespace test-template -o wide; \
192+
LATEST_POD=$(kubectl get pods --sort-by=.metadata.creationTimestamp -n test-template -o jsonpath='{.items[-1].metadata.name}')
193+
kubectl logs $LATEST_POD -n test-template && exit 6
194+
}
195+
196+
kubectl wait --namespace test-template store/template --for='jsonpath={.status.state}'=ready --timeout=1m || {
197+
kubectl get store/template --namespace test-template -o json && exit 7
198+
}
199+
200+
kubectl get pods --namespace test-template -o wide

charts/shopware/templates/prometheus_config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ data:
2424
enable_compression: true
2525
follow_redirects: true
2626
enable_http2: true
27-
http_headers: null
2827
relabel_configs:
2928
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
3029
separator: ;
@@ -96,7 +95,6 @@ data:
9695
kubeconfig_file: ""
9796
follow_redirects: true
9897
enable_http2: true
99-
http_headers: null
10098
namespaces:
10199
names:
102100
- {{ .Release.Namespace }}

0 commit comments

Comments
 (0)