Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm Chart: selector & labels issue #35

Open
extravio opened this issue Dec 4, 2023 · 0 comments
Open

Helm Chart: selector & labels issue #35

extravio opened this issue Dec 4, 2023 · 0 comments

Comments

@extravio
Copy link

extravio commented Dec 4, 2023

Hi there,
I think there's a problem with the service selector and the labels on the pods.

Unless I hard-code a key pair in the services.yaml (spec.selector) and add the same one in statefulset.yaml (template.metadata.labels), my service doesn't work.

If I add extra labels in value.yml

nexus:
  extraLabels:
    app: nxrm
  extraSelectorLabels:
    app: nxrm

I get the following error:

│ Error: StatefulSet.apps "nexus-nxrm-ha" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app.kubernetes.io/instance":"nexus", "app.kubernetes.io/name":"nxrm-ha"}: `selector` does not match template `labels`

which is pretty logical. as in statefulset.yaml , matchLabels and labels don't match

 selector:
    matchLabels:
      {{- include "nexus.selectorLabels" . | nindent 6 }}
      {{- if .Values.nexus.extraSelectorLabels }}
        {{- with .Values.nexus.extraSelectorLabels }}
          {{ toYaml . | nindent 6 }}
        {{- end }}
      {{- end }}
  template:
    metadata:
      [...]
      labels:
        {{- include "nexus.selectorLabels" . | nindent 8 }}

If I try to add

 [...]
  template:
    metadata:
      [...]
      labels:
        {{- include "nexus.selectorLabels" . | nindent 8 }}
        {{- if .Values.nexus.extraSelectorLabels }}
        {{- with .Values.nexus.extraSelectorLabels }}
          {{ toYaml . | nindent 6 }}
        {{- end }}
      {{- end }}

I still get the same error.

Could you please have a look?

@extravio extravio changed the title selector & labels issue Helm Chart: selector & labels issue Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant