When attempting to apply a helm generated configuration mutiple times, the nginx-ingress fails due to immutable fields
Summary
A current PoC for GitLab.com: gitlab-com/gl-infra/k8s-workloads/gitlab-com!2 (merged) cannot properly apply our helm chart. Our desired workflow is as follows:
- Generate the Kubernetes application configurations
helm template ./ -v values.yaml -o output
- Using CI
kubectl apply -R -f output/
This presents an issue, specifically with the nginx-ingress controller. Our fork has a designation in every Service template like this: https://gitlab.com/charts/gitlab/blob/980b144536cfa7caeaee3de5767366c5574219d1/charts/nginx/templates/controller-metrics-service.yaml#L18. When helm generates the output files we are provided:
<snip>
spec:
clusterIP: ""
ports:
<snip>
Due to this, when applying the configurations a second time around, this will fail on all of these services with a similar error:
for: "output/pre/gitlab/charts/nginx-ingress/templates/default-backend-service.yaml": Service "gitlab-nginx-ingress-default-backend" is invalid: spec.clusterIP: Invalid value: "": field is immutable
The following templates are subject to this issue:
controller-metrics-service.yaml
controller-service.yaml
controller-stats-service.yaml
default-backend-service.yaml
Expected behavior
It is desired that we can apply a Service configuration in an idempotent manner without the need to manually intervene or control the ClusterIP's for which Kubernetes assigns these services.
There are 2 solutions I can see quickly:
- Port over the changes located in here: https://github.com/helm/charts/pull/13646 into our fork.
- Upgrade our fork
😬
Versions
- Chart: hash
d8a504d87c8ad441fb80a6fd777b7cad6e2c8ecd
- Platform:
- Cloud: GKE
- Kubernetes:
- Client: 1.13.6
- Server: 1.13.6
- Helm:
- Client: 2.13.1
- Server: n/a