This commit is contained in:
parent
1c3dcbdb57
commit
2be53934ea
@ -1,6 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: helmchart
|
||||
description: A Helm chart for Kubernetes
|
||||
name: mealapi
|
||||
description: A fun meal api
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
|
6
helmchart/templates/configmap.yaml
Normal file
6
helmchart/templates/configmap.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: meal-api-config
|
||||
data:
|
||||
DATABASE_URI: {{ .Values.configmap.dburi }}
|
@ -1,3 +1,4 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@ -24,7 +25,6 @@ spec:
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "helmchart.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
@ -33,17 +33,20 @@ spec:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: meal-api-config
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
path: /healthz
|
||||
port: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
path: /healthz
|
||||
port: http
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
|
62
helmchart/templates/postgresql.yaml
Normal file
62
helmchart/templates/postgresql.yaml
Normal file
@ -0,0 +1,62 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: meal-api-postgres-pvc
|
||||
spec:
|
||||
storageClassName: {{ .Values.postgres.storage.provider }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.postgres.storage.size }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: meal-api-postgres
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: meal-api-postgres
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: meal-api-postgres
|
||||
spec:
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: meal-api-postgres-pvc
|
||||
containers:
|
||||
- name: meal-api-postgres
|
||||
image: "postgres:14"
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: meal-api-postgres-config
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/postgresql
|
||||
name: data
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: meal-api-postgres
|
||||
spec:
|
||||
selector:
|
||||
app: meal-api-postgres
|
||||
ports:
|
||||
- name: {{ .Values.postgres.name }}
|
||||
protocol: TCP
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: meal-api-postgres-config
|
||||
data:
|
||||
POSTGRES_PASSWORD: {{ .Values.postgres.password }}
|
||||
POSTGRES_USER: {{ .Values.postgres.user }}
|
||||
POSTGRES_DB: {{ .Values.postgres.database }}
|
@ -1,12 +0,0 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "helmchart.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "helmchart.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -14,15 +14,6 @@ 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: ""
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podSecurityContext: {}
|
||||
@ -80,3 +71,15 @@ nodeSelector: {}
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
postgres:
|
||||
name: postgres-meapi
|
||||
user: meapi-postgres
|
||||
password: mealapi-postgres
|
||||
database: mealapi
|
||||
storage:
|
||||
size: 1Gi
|
||||
privder: longhorn
|
||||
|
||||
configmap:
|
||||
dburi: "postgresql://meapi-postgres:mealapi-postgres@postgres-meapi:5432/mealapi"
|
Loading…
Reference in New Issue
Block a user