Update Deployment and statefulSet

This commit is contained in:
na 2024-09-07 01:37:07 +02:00
parent fcb45ec331
commit d2f602bf79
11 changed files with 80 additions and 21 deletions

View File

@ -1,30 +1,35 @@
apiVersion: apps/v1
kind: StatefulSet
kind: Deployment
metadata:
name: {{ .Release.Name }}-oc-catalog
name: oc-catalog
labels:
app: oc-catalog
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
serviceName: "{{ .Release.Name }}-oc-catalog"
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: oc-catalog
release: {{ .Release.Name }}
template:
metadata:
labels:
app: oc-catalog
release: {{ .Release.Name }}
spec:
containers:
- name: oc-catalog
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
- containerPort: {{ .Values.service.targetPort }}
env:
- name: MONGO_DATABASE
value: "DC_myDC"
value: {{ .Values.mongo.database }}
- name: MONGO_URI
value: "mongodb://mongo:27017"
value: {{ .Values.mongo.uri }}
imagePullSecrets:
{{- if .Values.imagePullSecrets }}
{{- range .Values.imagePullSecrets }}

View File

@ -1,12 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-oc-catalog
name: oc-catalog
labels:
app: oc-catalog
release: {{ .Release.Name }}
spec:
selector:
app: {{ .Chart.Name }}
type: {{ .Values.service.type }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
type: {{ .Values.service.type }}
selector:
app: oc-catalog
release: {{ .Release.Name }}

View File

@ -16,4 +16,3 @@ mongo:
imagePullSecrets:
- name: regcred

View File

@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: oc-catalog
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ include "mongo-express.name" . }}
template:
metadata:
labels:
app: {{ include "mongo-express.name" . }}
spec:
containers:
- name: mongo-express
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: {{ .Values.service.port }}
env:
- name: ME_CONFIG_BASICAUTH_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.env.secretName }}
key: {{ .Values.env.usernameSecret }}
- name: ME_CONFIG_BASICAUTH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.env.secretName }}
key: {{ .Values.env.passwordSecret }}
imagePullSecrets:
{{- if .Values.imagePullSecrets }}
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
{{- end }}

View File

@ -16,3 +16,4 @@ imagePullSecrets:
secret:
usernameKey: mongo-username
passwordKey: mongo-password
secretName: mongo-secret

View File

@ -1,10 +1,16 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.persistence.name }}
name: {{ .Values.mongo.pvcName }}
labels:
app: mongo
release: {{ .Release.Name }}
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}

View File

@ -2,7 +2,10 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-mongo-secret
labels:
app: mongo
release: {{ .Release.Name }}
type: Opaque
data:
username: {{ .Values.secret.username }}
password: {{ .Values.secret.password }}
username: {{ .Values.secret.username | b64enc }}
password: {{ .Values.secret.password | b64enc }}

View File

@ -2,10 +2,12 @@ apiVersion: v1
kind: Service
metadata:
name: mongo
labels:
app: mongo
spec:
selector:
app: mongo
ports:
- protocol: TCP
port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
targetPort: {{ .Values.mongo.containerPort }}

View File

@ -1,11 +1,11 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Release.Name }}-mongo
name: mongo
labels:
app: mongo
spec:
serviceName: "{{ .Release.Name }}-mongo"
serviceName: "mongo"
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:

View File

@ -13,7 +13,12 @@ persistence:
enabled: true
accessMode: ReadWriteOnce
size: 1Gi
storageClass: ""
secret:
username: dGVzdA== # base64 encoding of 'test'
password: dGVzdA== # base64 encoding of 'test'
mongo:
containerPort: 27017
pvcName: mongo-pvc-helm