Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
using volumeClaimTemplates for statefulSet
Browse files Browse the repository at this point in the history
* also updating label syntax to current helm standards (e.g.
`app.kubernetes.io/name`)

Signed-off-by: Jeff Billimek <jeff@billimek.com>
  • Loading branch information
billimek committed Mar 10, 2019
1 parent 637f2a5 commit 84038a4
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 74 deletions.
12 changes: 6 additions & 6 deletions stable/unifi/templates/controller-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: Service
metadata:
name: {{ template "unifi.fullname" . }}-controller
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.controllerService.labels }}
{{ toYaml .Values.controllerService.labels | indent 4 }}
{{- end }}
Expand Down Expand Up @@ -49,6 +49,6 @@ spec:
nodePort: {{.Values.controllerService.nodePort}}
{{ end }}
selector:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
12 changes: 6 additions & 6 deletions stable/unifi/templates/discovery-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: Service
metadata:
name: {{ template "unifi.fullname" . }}-discovery
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.discoveryService.labels }}
{{ toYaml .Values.discoveryService.labels | indent 4 }}
{{- end }}
Expand Down Expand Up @@ -49,6 +49,6 @@ spec:
nodePort: {{.Values.discoveryService.nodePort}}
{{ end }}
selector:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
12 changes: 6 additions & 6 deletions stable/unifi/templates/gui-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: Service
metadata:
name: {{ template "unifi.fullname" . }}-gui
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.guiService.labels }}
{{ toYaml .Values.guiService.labels | indent 4 }}
{{- end }}
Expand Down Expand Up @@ -49,6 +49,6 @@ spec:
nodePort: {{.Values.guiService.nodePort}}
{{ end }}
selector:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
10 changes: 5 additions & 5 deletions stable/unifi/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "unifi.fullname" . -}}
{{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1
apiVersion: extensions/v1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
Expand Down
24 changes: 0 additions & 24 deletions stable/unifi/templates/pvc.yaml

This file was deleted.

55 changes: 40 additions & 15 deletions stable/unifi/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ kind: StatefulSet
metadata:
name: {{ template "unifi.fullname" . }}
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
annotations:
{{- range $key, $value := .Values.podAnnotations }}
Expand Down Expand Up @@ -93,13 +93,38 @@ spec:
resources:
{{ toYaml .Values.resources | indent 12 }}
volumes:
- name: unifi-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "unifi.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{ end }}
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: unifi-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else }}
emptyDir: {}
{{- end }}
{{- else if not .Values.persistence.enabled }}
- name: unifi-data
emptyDir: {}
{{- else if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
volumeClaimTemplates:
- metadata:
name: unifi-data
labels:
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
Expand Down
12 changes: 6 additions & 6 deletions stable/unifi/templates/stun-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: Service
metadata:
name: {{ template "unifi.fullname" . }}-stun
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.stunService.labels }}
{{ toYaml .Values.stunService.labels | indent 4 }}
{{- end }}
Expand Down Expand Up @@ -49,6 +49,6 @@ spec:
nodePort: {{.Values.stunService.nodePort}}
{{ end }}
selector:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}
12 changes: 6 additions & 6 deletions stable/unifi/templates/unified-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ kind: Service
metadata:
name: {{ template "unifi.fullname" . }}
labels:
app: {{ template "unifi.name" . }}
chart: {{ template "unifi.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
helm.sh/chart: {{ include "unifi.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.unifiedService.labels }}
{{ toYaml .Values.unifiedService.labels | indent 4 }}
{{- end }}
Expand Down Expand Up @@ -70,7 +70,7 @@ spec:
nodePort: {{.Values.guiService.nodePort}}
{{ end }}
selector:
app: {{ template "unifi.name" . }}
release: {{ .Release.Name }}
app.kubernetes.io/name: {{ include "unifi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{ end }}

0 comments on commit 84038a4

Please sign in to comment.