Skip to content

[minecraft] Service Label and Annotations #235

@Anghille

Description

@Anghille

It is usually usefull to be able to add labels and annotations to services. One usecase might be to use cilium L2LoadbalancerIpPool, which usually needs labels to point to the pool that will hand ips to the service of type Loadbalancer and annotations such as io.cilium/lb-ipam-ips which fix the IP of the loadbalancer.

I tried to use the serviceLabels: {} and serviceAnnotations: {} fields as it is declared here in the templates:

apiVersion: v1
kind: Service
metadata:
  name: {{ template "minecraft.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "minecraft.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
    app.kubernetes.io/name: "{{ .Chart.Name }}"
    app.kubernetes.io/instance: {{ template "minecraft.fullname" . }}
    app.kubernetes.io/version: "{{ .Chart.Version }}"
  {{- if .Values.serviceLabels }}
    {{- range $key, $value := .Values.serviceLabels}} #<--------- HERE
    {{ $key }}: {{ $value | quote }}
    {{- end }}
  {{- end }}
  annotations:
{{ toYaml .Values.serviceAnnotations | indent 4 }} #<--------- HERE

But despites my efforts, I cannot add labels and annotations to this service. I managed to fix the bug by patching the service through kustomize for know.

I didnt found anyone reporting this. Maybe I am doing something wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions