Skip to content

Commit

Permalink
feat(minecraft-server): Allow deployment labels/annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
0SkillAllLuck committed Jun 10, 2022
1 parent aa9636f commit 4f55a1b
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/minecraft-server/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: minecraft-server
version: 0.1.1200
version: 0.1.1201
appVersion: v0.1.12
description: Docker Minecraft Server image with support for Plugins etc.
home: https://github.com/qumine/minecraft-server
Expand Down
24 changes: 21 additions & 3 deletions charts/minecraft-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@ Create chart name and version as used by the chart label.

{{/* Helm required labels */}}
{{- define "qumine.labels" -}}
app.kubernetes.io/name: {{ template "qumine.name" . }}
helm.sh/chart: {{ template "qumine.chart" . }}
app.kubernetes.io/name: {{ template "qumine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels }}
{{- if .Values.labels }}
{{ toYaml .Values.labels }}
{{- end }}
{{- end -}}

{{/* annotations */}}
{{- define "qumine.annotations" -}}
{{- if .Values.annotations }}
{{ toYaml .Values.annotations }}
{{- end }}
{{- end -}}

Expand All @@ -48,6 +55,17 @@ app.kubernetes.io/name: {{ template "qumine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/* Helm required labels */}}
{{- define "qumine.podLabels" -}}
helm.sh/chart: {{ template "qumine.chart" . }}
app.kubernetes.io/name: {{ template "qumine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels }}
{{- end }}
{{- end -}}

{{/* podAnnotations */}}
{{- define "qumine.podAnnotations" -}}
{{- if .Values.podAnnotations }}
Expand Down
6 changes: 5 additions & 1 deletion charts/minecraft-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ kind: Deployment
metadata:
name: {{ template "qumine.fullname" . }}
labels: {{ include "qumine.labels" . | nindent 4 }}
annotations:
{{- if .Values.annotations }}
{{- include "qumine.annotations" . | trim | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicas }}
strategy:
Expand All @@ -11,7 +15,7 @@ spec:
matchLabels: {{ include "qumine.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{ include "qumine.labels" . | nindent 8 }}
labels: {{ include "qumine.podLabels" . | nindent 8 }}
annotations:
{{- if or .Values.podAnnotations .Values.integrations.metrics.enabled }}
{{- include "qumine.podAnnotations" . | trim | nindent 8 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/ingress-bluemap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "{{ template "qumine.fullname" . }}-bluemap"
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
annotations:
kubernetes.io/tls-acme: '"true"'
spec:
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "qumine.fullname" . }}
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
annotations:
{{- if .Values.persistence.storageClass }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/service-bluemap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: "{{ template "qumine.fullname" . }}-bluemap"
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
{{- if .Values.integrations.bluemap.service.labels -}}
{{ toYaml .Values.integrations.bluemap.service.labels | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/service-geysermc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: "{{ template "qumine.fullname" . }}-geysermc"
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
{{- if .Values.integrations.geysermc.service.labels -}}
{{ toYaml .Values.integrations.geysermc.service.labels | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/service-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: "{{ template "qumine.fullname" . }}-metrics"
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
{{- if .Values.integrations.metrics.service.labels -}}
{{ toYaml .Values.integrations.metrics.service.labels | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "qumine.fullname" . }}
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
{{- if .Values.service.labels -}}
{{ toYaml .Values.service.labels | nindent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/minecraft-server/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
{{- with .Values.integrations.metrics.serviceMonitor.namespace }}
namespace: {{ . }}
{{- end }}
labels: {{ include "qumine.labels" . | nindent 4 }}
labels: {{ include "qumine.podLabels" . | nindent 4 }}
{{- with .Values.integrations.metrics.serviceMonitor.selector }}
{{ toYaml . | nindent 4 }}
{{- end }}
Expand Down
13 changes: 10 additions & 3 deletions charts/minecraft-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ replicas: 1
# upgrade strategy (e.g. Recreate or RollingUpdate)
strategy: Recreate

## Annotations for the deployment
##
labels: {}
## Annotations for the deployment
##
annotations: {}

## Affinity for pod assignment (this value is evaluated as a template)
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
##
Expand All @@ -362,12 +369,12 @@ nodeSelector: {}
tolerations: []
## Annotations for qumine pods
##
podAnnotations: {}
## Additional labels for the pod(s).
##
podLabels: {}
## Pod priority class name
##
podAnnotations: {}
## Additional labels for the pod(s).
##
priorityClassName: ""

## Kubernetes svc configutarion
Expand Down

0 comments on commit 4f55a1b

Please sign in to comment.