first helm test
All checks were successful
the build was successful

This commit is contained in:
ston1th 2019-01-18 20:23:46 +01:00
commit 951fc96548
7 changed files with 297 additions and 3 deletions

13
chart/Chart.yaml Normal file
View file

@ -0,0 +1,13 @@
name: testapp
version: 1.0.0
appVersion: 1.0.0
description: Kubernetes Test Application
keywords:
- go
- k8s
- test
sources:
- https://git.giftfish.de/ston1th/test
maintainers:
- name: ston1th
email: ston1th@giftfish.de

View file

@ -0,0 +1,71 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "testapp.fullname" . }}-db
labels:
app: {{ template "testapp.name" . }}-db
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
component: db
spec:
replicas: {{ .Values.db.replicas }}
template:
metadata:
annotations:
{{- if .Values.db.annotations }}
{{ toYaml .Values.db.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "testapp.name" . }}-db
release: "{{ .Release.Name }}"
component: db
spec:
{{- if .Values.db.schedulerName }}
schedulerName: "{{ .Values.db.schedulerName }}"
{{- end }}
{{- if .Values.db.affinity }}
affinity:
{{ toYaml .Values.db.affinity | indent 8 }}
{{- end }}
{{- if .Values.db.nodeSelector }}
nodeSelector:
{{ toYaml .Values.db.nodeSelector | indent 8 }}
{{- end }}
containers:
- name: {{ template "testapp.fullname" . }}-db
image: "{{ .Values.images.db.repository }}:{{ .Values.images.db.tag }}"
imagePullPolicy: {{ .Values.images.db.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
{{- range $key, $value := .Values.db.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ toYaml .Values.db.resources | indent 10 }}
{{- if .Values.db.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: "/healthz"
port: http
initialDelaySeconds: {{ .Values.db.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.db.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.db.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.db.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.db.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.db.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: "/healthz"
port: http
initialDelaySeconds: {{ .Values.db.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.db.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.db.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.db.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.db.readinessProbe.failureThreshold }}
{{- end }}

View file

@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "testapp.fullname" . }}-srv
labels:
app: {{ template "testapp.name" . }}-srv
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
component: srv
spec:
replicas: {{ .Values.srv.replicas }}
template:
metadata:
annotations:
{{- if .Values.srv.annotations }}
{{ toYaml .Values.srv.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "testapp.name" . }}-srv
release: "{{ .Release.Name }}"
component: srv
spec:
{{- if .Values.srv.schedulerName }}
schedulerName: "{{ .Values.srv.schedulerName }}"
{{- end }}
{{- if .Values.srv.affinity }}
affinity:
{{ toYaml .Values.srv.affinity | indent 8 }}
{{- end }}
{{- if .Values.srv.nodeSelector }}
nodeSelector:
{{ toYaml .Values.srv.nodeSelector | indent 8 }}
{{- end }}
containers:
- name: {{ template "testapp.fullname" . }}-srv
image: "{{ .Values.images.srv.repository }}:{{ .Values.images.srv.tag }}"
imagePullPolicy: {{ .Values.images.srv.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: DB_HOST
value: {{ template "testapp.fullname" . }}-db.{{ Release.Namespace }}.svc
{{- range $key, $value := .Values.srv.env }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ toYaml .Values.srv.resources | indent 10 }}
{{- if .Values.srv.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: "/healthz"
port: http
initialDelaySeconds: {{ .Values.srv.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.srv.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.srv.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.srv.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.srv.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.srv.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: "/healthz"
port: http
initialDelaySeconds: {{ .Values.srv.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.srv.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.srv.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.srv.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.srv.readinessProbe.failureThreshold }}
{{- end }}

View file

@ -0,0 +1,25 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "drone.fullname" . }}-db
annotations:
{{- range $key, $value := .Values.Db.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
app: {{ template "drone.name" . }}-db
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: {{ .Values.Db.service.type }}
ports:
- name: http
port: {{ .Values.Db.service.httpPort }}
targetPort: 8080
{{- if hasKey .Values.Db.service "nodePort" }}
nodePort: {{ .Values.Db.service.nodePort }}
{{- end }}
selector:
app: {{ template "drone.name" . }}-db
release: {{ .Release.Name | quote }}

View file

@ -0,0 +1,34 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "testapp.fullname" . }}-srv
annotations:
getambassador.io/config: |
---
apiVersion: ambassador/v0
kind: Mapping
name: {{ template "testapp.fullname" . }}-srv_mapping
host: "^{{ .Values.srv.host }}.*$"
host_regex: true
prefix: /
service: {{ template "testapp.fullname" . }}-srv.{{ Release.Namespace }}.svc:8080
{{- range $key, $value := .Values.service.srv.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
app: {{ template "testapp.name" . }}-srv
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
type: {{ .Values.service.srv.type }}
ports:
- name: http
port: {{ .Values.service.srv.httpPort }}
targetPort: 8080
{{- if hasKey .Values.service.srv "nodePort" }}
nodePort: {{ .Values.service.srv.nodePort }}
{{- end }}
selector:
app: {{ template "testapp.name" . }}-srv
release: {{ .Release.Name | quote }}

80
chart/values.yaml Normal file
View file

@ -0,0 +1,80 @@
appVersion: "1.0.0"
images:
srv:
repository: "127.0.0.1:5000/testapp/srv"
tag: 1.0.0
pullPolicy: IfNotPresent
db:
repository: "127.0.0.1:5000/testapp/db"
tag: 1.0.0
pullPolicy: IfNotPresent
service:
srv:
httpPort: 80
# nodePort: 32015
type: ClusterIP
# annotations:
db:
httpPort: 80
# nodePort: 32015
type: ClusterIP
# annotations:
srv:
# host: "srv.kube"
# env:
annotations: {}
resources: {}
# requests:
# memory: 32Mi
# cpu: 40m
# limits:
# memory: 2Gi
# cpu: 1
livenessProbe:
enabled: true
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
enabled: true
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
# schedulerName:
affinity: {}
nodeSelector: {}
db:
# env:
annotations: {}
resources: {}
# requests:
# memory: 32Mi
# cpu: 40m
# limits:
# memory: 2Gi
# cpu: 1
livenessProbe:
enabled: true
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
enabled: true
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
# schedulerName:
affinity: {}
nodeSelector: {}