Skip to content

Commit

Permalink
Merge dd96953 into 5ecd3d5
Browse files Browse the repository at this point in the history
  • Loading branch information
vktr-brlv authored Nov 18, 2022
2 parents 5ecd3d5 + dd96953 commit d794a31
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 399 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
pull_request:

jobs:
release:
Expand Down
4 changes: 2 additions & 2 deletions charts/app-mendix/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
apiVersion: v2
name: app-mendix
version: 1.0.8
version: 2.0.1
description: Mendix Application Chart.
icon: https://cinaq.github.io/helm-charts/icons/mendix-logo.png
maintainers:
Expand Down
31 changes: 29 additions & 2 deletions charts/app-mendix/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,42 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- define "app-mendix.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).
*/}}
{{- define "fullname" -}}
{{- define "app-mendix.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "app-mendix.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "app-mendix.labels" -}}
helm.sh/chart: {{ include "app-mendix.chart" . }}
{{ include "app-mendix.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "app-mendix.selectorLabels" -}}
app.kubernetes.io/name: {{ include "app-mendix.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
11 changes: 4 additions & 7 deletions charts/app-mendix/templates/autoscale.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
{{- if .Values.autoscale.enabled -}}
{{- $serviceName := include "fullname" . -}}
{{- $serviceName := include "app-mendix.fullname" . -}}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "fullname" . }}
name: {{ template "app-mendix.fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- include "app-mendix.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "fullname" . }}-slave
name: {{ template "app-mendix.fullname" . }}-slave
minReplicas: {{ .Values.autoscale.minSlaveReplicas }}
maxReplicas: {{ .Values.autoscale.maxSlaveReplicas }}
targetCPUUtilizationPercentage: {{ .Values.autoscale.targetCPUUtilizationPercentage }}
Expand Down
117 changes: 117 additions & 0 deletions charts/app-mendix/templates/deployment-leader.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "app-mendix.fullname" . }}-leader
labels:
{{- include "app-mendix.labels" . | nindent 4 }}
spec:
{{- if ge .Values.replicaCount 1.0 }}
replicas: 1
{{- else }}
replicas: 0
{{- end }}
selector:
matchLabels:
{{- include "app-mendix.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
{{- include "app-mendix.labels" . | nindent 8 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
{{- if .Values.metrics.enabled }}
- containerPort: {{ add .Values.service.internalPort 3}}
name: metrics
{{- end }}
env:
- name: CF_INSTANCE_INDEX
value: "0"
{{- range .Values.env }}
- name: {{ .name | quote}}
value: {{ .value | quote}}
{{- end }}
{{- if .Values.secretName }}
envFrom:
- secretRef:
name: {{ .Values.secretName }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
{{- if eq "httpGet" .Values.readinessProbe.type }}
httpGet:
path: {{ .Values.readinessProbe.httpGet.path }}
port: {{ .Values.readinessProbe.httpGet.port }}
{{- else if eq "exec" .Values.readinessProbe.type }}
exec:
command:
{{- range .Values.readinessProbe.exec.command }}
- {{ . }}
{{- end }}
{{- else if eq "tcpSocket" .Values.readinessProbe.type }}
tcpSocket:
port: {{ .Values.readinessProbe.tcpSocket.port }}
{{- end }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if eq "httpGet" .Values.livenessProbe.type }}
httpGet:
path: {{ .Values.livenessProbe.httpGet.path }}
port: {{ .Values.livenessProbe.httpGet.port }}
{{- else if eq "exec" .Values.livenessProbe.type }}
exec:
command:
{{- range .Values.livenessProbe.exec.command }}
- {{ . }}
{{- end }}
{{- else if eq "tcpSocket" .Values.livenessProbe.type }}
tcpSocket:
port: {{ .Values.livenessProbe.tcpSocket.port }}
{{- end }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
{{- end }}
{{- if .Values.lifecycle.prestop.enabled }}
lifecycle:
preStop:
exec:
command: [{{ .Values.lifecycle.prestop.command }}]
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- 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 }}
123 changes: 123 additions & 0 deletions charts/app-mendix/templates/deployment-slave.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "app-mendix.fullname" . }}-slave
labels:
{{- include "app-mendix.labels" . | nindent 4 }}
spec:
{{- if .Values.autoscale.enabled }}
replicas: {{ .Values.autoscale.minSlaveReplicas }}
{{- else }}
replicas: {{ sub .Values.replicaCount 1.0 }}
{{- end }}
selector:
matchLabels:
{{- include "app-mendix.selectorLabels" . | nindent 6 }}
{{- if .Values.strategy.enabled }}
strategy:
type: {{ .Values.strategy.type }}
{{- if eq "RollingUpdate" .Values.strategy.type }}
rollingUpdate:
maxSurge: {{ .Values.strategy.rollingUpdate.maxSurge }}
maxUnavailable: {{ .Values.strategy.rollingUpdate.maxUnavailable }}
{{- end }}
{{- end }}
template:
metadata:
labels:
{{- include "app-mendix.labels" . | nindent 8 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
{{- if .Values.metrics.enabled }}
- containerPort: {{ add .Values.service.internalPort 3 }}
{{- end }}
env:
- name: CF_INSTANCE_INDEX
value: "1"
{{- range .Values.env }}
- name: {{ .name | quote}}
value: {{ .value | quote}}
{{- end }}
{{- if .Values.secretName }}
envFrom:
- secretRef:
name: {{ .Values.secretName }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
{{- if eq "httpGet" .Values.readinessProbe.type }}
httpGet:
path: {{ .Values.readinessProbe.httpGet.path }}
port: {{ .Values.readinessProbe.httpGet.port }}
{{- else if eq "exec" .Values.readinessProbe.type }}
exec:
command:
{{- range .Values.readinessProbe.exec.command }}
- {{ . }}
{{- end }}
{{- else if eq "tcpSocket" .Values.readinessProbe.type }}
tcpSocket:
port: {{ .Values.readinessProbe.tcpSocket.port }}
{{- end }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if eq "httpGet" .Values.livenessProbe.type }}
httpGet:
path: {{ .Values.livenessProbe.httpGet.path }}
port: {{ .Values.livenessProbe.httpGet.port }}
{{- else if eq "exec" .Values.livenessProbe.type }}
exec:
command:
{{- range .Values.livenessProbe.exec.command }}
- {{ . }}
{{- end }}
{{- else if eq "tcpSocket" .Values.livenessProbe.type }}
tcpSocket:
port: {{ .Values.livenessProbe.tcpSocket.port }}
{{- end }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
{{- end }}
{{- if .Values.lifecycle.prestop.enabled }}
lifecycle:
preStop:
exec:
command: [{{ .Values.lifecycle.prestop.command }}]
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- 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 }}
Loading

0 comments on commit d794a31

Please sign in to comment.