Pushing mongod and mongoexpress integration

This commit is contained in:
plm
2024-11-29 15:18:56 +01:00
parent ffff95b694
commit 98ef81fe2d
185 changed files with 25183 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mongo-express.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT{{ .Values.siteBaseUrl }}
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "mongo-express.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mongo-express.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.ports.http }}{{ .Values.siteBaseUrl }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mongo-express.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8081{{ .Values.siteBaseUrl }} to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8081:{{ .Values.containerPorts.http }}
{{- end }}

View File

@@ -0,0 +1,136 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "mongo-express.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 "mongo-express.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 "mongo-express.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "mongo-express.labels" -}}
helm.sh/chart: {{ include "mongo-express.chart" . }}
{{ include "mongo-express.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "mongo-express.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mongo-express.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "mongo-express.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "mongo-express.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Create the name of the secret to use
*/}}
{{- define "mongo-express.secretName" -}}
{{- if .Values.existingSecret -}}
{{ .Values.existingSecret }}
{{- else -}}
{{ include "mongo-express.fullname" . }}
{{- end -}}
{{- end -}}
{{/*
Key in Secret that contains administrator password
*/}}
{{- define "mongo-express.secretKeyMongodbAdminPassword" -}}
{{- if .Values.existingSecret -}}
{{ .Values.existingSecretKeyMongodbAdminPassword }}
{{- else -}}
mongodb-admin-password
{{- end -}}
{{- end -}}
{{/*
Key in Secret that contains database password
*/}}
{{- define "mongo-express.secretKeyMongodbAuthPassword" -}}
{{- if .Values.existingSecret -}}
{{ .Values.existingSecretKeyMongodbAuthPassword }}
{{- else -}}
mongodb-auth-password
{{- end -}}
{{- end -}}
{{/*
Key in Secret that contains string used by cookie-parser middleware to sign cookies
*/}}
{{- define "mongo-express.secretKeySiteCookieSecret" -}}
{{- if .Values.existingSecret -}}
{{ .Values.existingSecretKeySiteCookieSecret }}
{{- else -}}
site-cookie-secret
{{- end -}}
{{- end -}}
{{/*
Key in Secret that contains string used to sign the session ID cookie by express-session middleware
*/}}
{{- define "mongo-express.secretKeySiteSessionSecret" -}}
{{- if .Values.existingSecret -}}
{{ .Values.existingSecretKeySiteSessionSecret }}
{{- else -}}
site-session-secret
{{- end -}}
{{- end -}}
{{/*
Key in Secret that contains Mongo Express web login password
*/}}
{{- define "mongo-express.secretKeyBasicAuthPassword" -}}
{{- if .Values.existingSecret -}}
{{ .Values.existingSecretKeyBasicAuthPassword }}
{{- else -}}
basic-auth-password
{{- end -}}
{{- end -}}
{{/*
Create the basic authentification HTTP header
*/}}
{{- define "mongo-express.basicAuthHttpHeader" -}}
Basic {{ printf "%s:%s" .Values.basicAuthUsername .Values.basicAuthPassword | b64enc }}
{{- end -}}

View File

@@ -0,0 +1,197 @@
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "mongo-express.fullname" . }}
labels:
{{- include "mongo-express.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.deploymentAnnotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.deploymentAnnotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "mongo-express.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "mongo-express.selectorLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.podLabels "context" $ ) | nindent 8 }}
{{- end }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
{{- end }}
annotations:
{{- if not .Values.existingSecret }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.podAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.podAnnotations "context" $ ) | nindent 8 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 8 }}
{{- end }}
spec:
{{- include "common.images.pullSecrets" ( dict "images" ( list .Values.image ) "global" .Values.global ) | nindent 6 }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.runtimeClassName }}
runtimeClassName: {{ .Values.runtimeClassName | quote }}
{{- end }}
serviceAccountName: {{ include "mongo-express.serviceAccountName" . }}
{{- if .Values.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: mongo-express
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.image "global" .Values.global ) }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.extraArgs }}
args:
{{- range $key, $value := .Values.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
{{- end }}
env:
- name: PORT
value: {{ .Values.containerPorts.http | quote }}
- name: MONGODB_SERVER
value: {{ .Values.mongodbServer | quote }}
- name: MONGODB_PORT
value: {{ .Values.mongodbPort | quote }}
- name: ME_CONFIG_MONGODB_ENABLE_ADMIN
value: {{ .Values.mongodbEnableAdmin | quote }}
{{- if .Values.mongodbEnableAdmin }}
{{- if and .Values.mongodbAdminUsername .Values.mongodbAdminPassword}}
- name: MONGODB_USERNAME
value: {{ .Values.mongodbAdminUsername | quote }}
- name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mongo-express.secretName" . }}
key: {{ include "mongo-express.secretKeyMongodbAdminPassword" . }}
- name: ME_CONFIG_MONGODB_URL
value: "mongodb://$(MONGODB_USERNAME):$(MONGODB_PASSWORD)@$(MONGODB_SERVER):$(MONGODB_PORT)/"
{{- else }}
- name: ME_CONFIG_MONGODB_URL
value: "mongodb://$(MONGODB_SERVER):$(MONGODB_PORT)/"
{{- end }}
{{- else }}
- name: MONGODB_DATABASE
value: {{ .Values.mongodbAuthDatabase | quote }}
{{- if and .Values.mongodbAuthUsername .Values.mongodbAuthPassword}}
- name: MONGODB_USERNAME
value: {{ .Values.mongodbAuthUsername | quote }}
- name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mongo-express.secretName" . }}
key: {{ include "mongo-express.secretKeyMongodbAuthPassword" . }}
- name: ME_CONFIG_MONGODB_URL
value: "mongodb://$(MONGODB_USERNAME):$(MONGODB_PASSWORD)@$(MONGODB_SERVER):$(MONGODB_PORT)/$(MONGODB_DATABASE)"
{{- else }}
- name: ME_CONFIG_MONGODB_URL
value: "mongodb://$(MONGODB_SERVER):$(MONGODB_PORT)/$(MONGODB_DATABASE)"
{{- end }}
{{- end }}
- name: ME_CONFIG_SITE_BASEURL
value: {{ .Values.siteBaseUrl | quote }}
- name: ME_CONFIG_SITE_COOKIESECRET
valueFrom:
secretKeyRef:
name: {{ include "mongo-express.secretName" . }}
key: {{ include "mongo-express.secretKeySiteCookieSecret" . }}
- name: ME_CONFIG_SITE_SESSIONSECRET
valueFrom:
secretKeyRef:
name: {{ include "mongo-express.secretName" . }}
key: {{ include "mongo-express.secretKeySiteSessionSecret" . }}
{{- if and .Values.basicAuthUsername .Values.basicAuthPassword }}
- name: ME_CONFIG_BASICAUTH
value: "true"
- name: ME_CONFIG_BASICAUTH_USERNAME
value: {{ .Values.basicAuthUsername | quote }}
- name: ME_CONFIG_BASICAUTH_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mongo-express.secretName" . }}
key: {{ include "mongo-express.secretKeyBasicAuthPassword" . }}
{{- else }}
- name: ME_CONFIG_BASICAUTH
value: "false"
{{- end }}
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
{{- if or .Values.extraEnvVarsCM .Values.extraEnvVarsSecret }}
envFrom:
{{- if .Values.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.extraEnvVarsSecret "context" $) }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.containerPorts.http }}
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.siteBaseUrl | trimSuffix "/" }}/status
port: http
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.siteBaseUrl | trimSuffix "/" }}/status
port: http
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
{{- end }}
{{- if .Values.startupProbe.enabled }}
startupProbe:
httpGet:
path: {{ .Values.siteBaseUrl | trimSuffix "/" }}/status
port: http
initialDelaySeconds: {{ .Values.startupProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
timeoutSeconds: {{ .Values.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
successThreshold: {{ .Values.startupProbe.successThreshold }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,4 @@
{{- range .Values.extraDeploy }}
---
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
{{- end }}

View File

@@ -0,0 +1,43 @@
{{- if .Values.ingress.enabled -}}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ include "mongo-express.fullname" . }}
labels:
{{- include "mongo-express.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.ingress.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.ingress.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.ingressClassName (eq "true" (include "common.ingress.supportsIngressClassname" .)) }}
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ . }}
{{- if eq "true" (include "common.ingress.supportsPathType" $) }}
pathType: {{ $.Values.ingress.pathType }}
{{- end }}
backend:
{{- include "common.ingress.backend" (dict "serviceName" (include "mongo-express.fullname" $) "servicePort" $.Values.service.ports.http "context" $) | nindent 14 }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,25 @@
{{- if .Values.pdb.create }}
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ include "mongo-express.fullname" . }}
labels:
{{- include "mongo-express.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
{{- end }}
{{- if .Values.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.pdb.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "mongo-express.selectorLabels" . | nindent 6 }}
{{- end }}

View File

@@ -0,0 +1,27 @@
{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "mongo-express.secretName" . }}
labels:
{{- include "mongo-express.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations:
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
type: Opaque
data:
{{- if .Values.mongodbEnableAdmin }}
mongodb-admin-password: {{ .Values.mongodbAdminPassword | b64enc | quote }}
{{- else }}
mongodb-auth-password: {{ .Values.mongodbAuthPassword | b64enc | quote }}
{{- end }}
site-cookie-secret: {{ default (randAlphaNum 32) .Values.siteCookieSecret | b64enc | quote }}
site-session-secret: {{ default (randAlphaNum 32) .Values.siteSessionSecret | b64enc | quote }}
{{- if and .Values.basicAuthUsername .Values.basicAuthPassword }}
basic-auth-password: {{ .Values.basicAuthPassword | b64enc | quote }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,38 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "mongo-express.fullname" . }}
labels:
{{- include "mongo-express.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.service.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.service.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
clusterIP: {{ .Values.service.clusterIP }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
{{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }}
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
ports:
- port: {{ .Values.service.ports.http }}
targetPort: http
protocol: TCP
name: http
{{- if and (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) .Values.service.nodePorts.http }}
nodePort: {{ .Values.service.nodePorts.http }}
{{- end }}
selector:
{{- include "mongo-express.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,15 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "mongo-express.serviceAccountName" . }}
labels:
{{- include "mongo-express.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }}
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,22 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Create a default fully qualified app name.
*/}}
{{- define "mongo-express.tests.fullname" -}}
{{- printf "%s-%s" (include "mongo-express.fullname" .) "tests" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Component labels
*/}}
{{- define "mongo-express.tests.componentLabels" -}}
app.kubernetes.io/component: tests
{{- end -}}
{{/*
Common labels
*/}}
{{- define "mongo-express.tests.labels" -}}
{{ include "mongo-express.labels" . }}
{{ include "mongo-express.tests.componentLabels" . }}
{{- end -}}

View File

@@ -0,0 +1,25 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mongo-express.tests.fullname" . }}
labels:
{{- include "mongo-express.tests.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
helm.sh/hook: test
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
data:
test_all.py: |
import requests
def test_service_connection():
url = "http://{{ include "mongo-express.fullname" . }}:{{ .Values.service.ports.http }}{{ .Values.siteBaseUrl }}"
response = requests.get(url)
assert response.status_code == 200

View File

@@ -0,0 +1,30 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ include "mongo-express.tests.fullname" . }}
labels:
{{- include "mongo-express.tests.labels" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
helm.sh/hook: test
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
{{- include "common.images.pullSecrets" ( dict "images" ( list .Values.tests.image ) "global" .Values.global ) | nindent 2 }}
containers:
- name: tests
image: {{ include "common.images.image" ( dict "imageRoot" .Values.tests.image "global" .Values.global ) }}
imagePullPolicy: {{ .Values.tests.image.pullPolicy }}
volumeMounts:
- name: tests
mountPath: /tests
readOnly: true
workingDir: /tests
restartPolicy: Never
volumes:
- name: tests
configMap:
name: {{ include "mongo-express.tests.fullname" . }}