helm-charts
helm-charts copied to clipboard
error validating affinity
What happened?
When I try to upgrade to the latest version (0.33.1) from the version 0.27.5, I have this error :
Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(StatefulSet.spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[1].podAffinityTerm.labelSelector.matchLabels.app): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.matchLabels: got "map", expected "string", ValidationError(StatefulSet.spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[1].podAffinityTerm.labelSelector.matchLabels.cluster-name): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.matchLabels: got "map", expected "string", ValidationError(StatefulSet.spec.template.spec.affinity.podAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution[1].podAffinityTerm.labelSelector.matchLabels.release): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector.matchLabels: got "map", expected "string"]
Did you expect to see something different?
No error
How to reproduce it (as minimally and precisely as possible):
Just copy this data in the affinity
section of the value.yaml
:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: '{{ template "timescaledb.fullname" . }}'
release: "{{ .Release.Name | quote }}"
cluster-name: '{{ template "clusterName" . }}'
- weight: 50
podAffinityTerm:
topologyKey: failure-domain.beta.kubernetes.io/zone
labelSelector:
matchLabels:
app: {{ template "timescaledb.fullname" . }}
release: {{ .Release.Name | quote }}
cluster-name: {{ template "clusterName" . }}
Environment
-
Which helm chart and what version are you using? timescaledb-single 0.33.1
-
What is in your
values.yaml
?
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: '{{ template "timescaledb.fullname" . }}'
release: "{{ .Release.Name | quote }}"
cluster-name: '{{ template "clusterName" . }}'
- weight: 50
podAffinityTerm:
topologyKey: failure-domain.beta.kubernetes.io/zone
labelSelector:
matchLabels:
app: {{ template "timescaledb.fullname" . }}
release: {{ .Release.Name | quote }}
cluster-name: {{ template "clusterName" . }}
// other stuff is useless here to reproduce
- Kubernetes version information:
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.8", GitCommit:"4a3b558c52eb6995b3c5c1db5e54111bd0645a64", GitTreeState:"clean", BuildDate:"2021-12-15T14:52:11Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.16-eks-ffeb93d", GitCommit:"52e500d139bdef42fbc4540c357f0565c7867a81", GitTreeState:"clean", BuildDate:"2022-11-29T18:41:42Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"}
-
Kubernetes cluster kind:
EKS 1.22 managed by rancher
Any news about that ? It's really annoying and block us to upgrade to latest chart version
We had a similar issue.
It looks like in https://github.com/timescale/helm-charts/commit/fd2f21a02a6c50c47ccaab3dc39bb89cf620d308#diff-3210395104e9712528afa7119350e6250761db18b886c36af3e1dc600733fcfaL464
they removed tpl
function, and now you have to define it using simple values like:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
app: "timescaledb"
release: "timescaledb"
cluster-name: "timescaledb"
- weight: 50
podAffinityTerm:
topologyKey: failure-domain.beta.kubernetes.io/zone
labelSelector:
matchLabels:
app: "timescaledb"
release: "timescaledb"
cluster-name: "timescaledb"
In summary, the current upgrade guide is either incorrect or lacks logic (missing tpl
processing affinity).