Add a chart for db services

This commit is contained in:
Milos Pejanovic
2020-04-11 21:21:46 +02:00
parent 886e61ba3f
commit 6fb685e6da
10 changed files with 279 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: An Example Chart for Configurd
name: db
version: 0.1.0
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "example.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "example.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "example.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -0,0 +1,65 @@
{{- $pvc := printf "%s-pvc" .Release.Name }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Release.Name }}"
labels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: "{{ .Release.Name }}-{{ .Release.Revision }}"
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}
spec:
containers:
- name: {{ .Release.Name }}
image: {{ .Values.image.repository }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
{{- toYaml .Values.args | nindent 12 }}
env:
{{- toYaml .Values.env | nindent 12 }}
ports:
- name: container-port
containerPort: {{ .Values.service.containerPort }}
protocol: TCP
livenessProbe:
tcpSocket:
port: container-port
readinessProbe:
tcpSocket:
port: container-port
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
{{- range .Values.volumeMounts }}
- name: {{ .name }}
mountPath: {{ .path }}
{{- end }}
volumes:
{{- range .Values.volumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ $pvc }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
@@ -0,0 +1,20 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: "{{ .Release.Name }}-pv"
labels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: "{{ .Release.Name }}-{{ .Release.Revision }}"
spec:
storageClassName: manual
capacity:
storage: {{ .Values.persistentVolume.size }}
{{- with .Values.persistentVolume.accessModes }}
accessModes:
{{- toYaml . | nindent 4 }}
{{- end }}
persistentVolumeReclaimPolicy: {{ .Values.persistentVolume.ReclaimPolicy }}
hostPath:
path: {{ .Values.persistentVolume.path }}
@@ -0,0 +1,18 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: "{{ .Release.Name }}-pvc"
labels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: "{{ .Release.Name }}-{{ .Release.Revision }}"
spec:
storageClassName: manual
{{- with .Values.persistentVolume.accessModes }}
accessModes:
{{- toYaml . | nindent 4 }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistentVolume.size }}
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: "{{ .Release.Name }}-{{ .Release.Revision }}"
spec:
selector:
app.kubernetes.io/name: {{ .Release.Name }}
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.containerPort }}
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "example.fullname" . }}-test-connection"
labels:
app.kubernetes.io/name: {{ include "example.name" . }}
helm.sh/chart: {{ include "example.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "example.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
+83
View File
@@ -0,0 +1,83 @@
# Default values for test.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: nginx
pullPolicy: IfNotPresent
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name:
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
containerPort: 3000
group: test
env: []
# - name: TEST
# value: "test"
args: []
# - "arg1==one"
persistentVolume:
size: 1Gi
path: /tmp
reclaimPolicy: Delete
accessModes:
- ReadWriteOnce
volumeMounts:
- name: data
path: /var/lib/mysql
ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
host: ""
path: ""
secretName: ""
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Release.Name }}-deployment"
name: "{{ .Release.Name }}"
labels:
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.group }}