Skip to content

Commit

Permalink
ingress nginx class set (#20)
Browse files Browse the repository at this point in the history
* ingress nginx class set

* default annotations remove

* Mendix license keys added to deployments

* low-54 helm ingress domain to app url, replicas

* low-54 license default changed

* low-54 enable prometheus metrics

* low-54 port to int

* low-54 port to int

* low-54 port to str

* low-54 ingress name - release name

* Remove prometheus annotations. Use podmonitor instead

---------

Co-authored-by: Viktor B <[email protected]>
Co-authored-by: Xiwen Cheng <[email protected]>
  • Loading branch information
3 people authored Dec 22, 2023
1 parent 9f59bce commit 3a4fafd
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 28 deletions.
4 changes: 3 additions & 1 deletion charts/app-mendix/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
apiVersion: v2
name: app-mendix
version: 2.1.0
version: 2.2.0
description: Mendix Application Chart.
icon: https://cinaq.github.io/helm-charts/icons/mendix-logo.png
maintainers:
- email: [email protected]
name: Xiwen Cheng
- email: [email protected]
name: Viktor Berlov
16 changes: 13 additions & 3 deletions charts/app-mendix/templates/deployment-leader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
{{- include "app-mendix.labels" . | nindent 4 }}
spec:
{{- if ge .Values.replicaCount 1.0 }}
{{- if (ge (int .Values.replicaCount) 1) }}
replicas: 1
{{- else }}
replicas: 0
Expand All @@ -31,15 +31,25 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
{{- if .Values.metrics.enabled }}
- containerPort: {{ add .Values.service.internalPort 3}}
name: app
- containerPort: {{ add (int .Values.service.internalPort) 2}}
name: metrics
- containerPort: 9273
name: metrics_mendix
{{- end }}
env:
- name: CF_INSTANCE_INDEX
value: "0"
- name: MXRUNTIME_Metrics_Registries
value: '[{"type": "prometheus", "settings": {"step": "5m"}}]'
{{- if .Values.licenseId }}
- name: LICENSE_ID
value: {{ .Values.licenseId }}
{{- end }}
{{- if .Values.licenseKey }}
- name: LICENSE_KEY
value: {{ .Values.licenseKey }}
{{- end }}
{{- range .Values.env }}
- name: {{ .name | quote}}
value: {{ .value | quote}}
Expand Down
17 changes: 16 additions & 1 deletion charts/app-mendix/templates/deployment-slave.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ metadata:
spec:
{{- if .Values.autoscale.enabled }}
replicas: {{ .Values.autoscale.minSlaveReplicas }}
{{- else if (eq (int .Values.replicaCount) 0)}}
replicas: 0
{{- else }}
replicas: {{ sub .Values.replicaCount 1.0 }}
replicas: {{ (sub (int .Values.replicaCount) 1) }}
{{- end }}
selector:
matchLabels:
Expand Down Expand Up @@ -38,15 +40,28 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.internalPort }}
name: app
{{- if .Values.metrics.enabled }}
- containerPort: {{ add .Values.service.internalPort 3 }}
name: metrics
- containerPort: 9273
name: metrics_mendix
{{- end }}
- containerPort: {{ add (int .Values.service.internalPort) 2 }}
name: metrics
env:
- name: CF_INSTANCE_INDEX
value: "1"
- name: MXRUNTIME_Metrics_Registries
value: '[{"type": "prometheus", "settings": {"step": "5m"}}]'
{{- if .Values.licenseId }}
- name: LICENSE_ID
value: {{ .Values.licenseId }}
{{- end }}
{{- if .Values.licenseKey }}
- name: LICENSE_KEY
value: {{ .Values.licenseKey }}
{{- end }}
{{- range .Values.env }}
- name: {{ .name | quote}}
value: {{ .value | quote}}
Expand Down
5 changes: 3 additions & 2 deletions charts/app-mendix/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ template "app-mendix.fullname" . }}
name: {{ .Release.Name }}
labels:
{{- include "app-mendix.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: {{ .Values.ingress.ingressClassName }}
rules:
- host: {{ .Release.Name }}.{{ .Values.ingress.domain }}
- host: {{ .Values.ingress.domain }}
http:
paths:
- backend:
Expand Down
28 changes: 7 additions & 21 deletions charts/app-mendix/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
# larger than 1 => 1 leader, rest slaves
replicaCount: 1

metrics:
# if enabled, metrics are exposed at service.internalPort + 3 e.d. localhost:8083/metrics
enabled: true
scrape: true

image:
repository: "cinaq/hackme"
tag: "latest"
pullPolicy: "Always"
imagePullSecrets:
- name: dockerconfigjson

licenseId:
licenseKey:

env: []
# - name: SCHEDULED_EVENTS
# value: ALL
Expand All @@ -29,8 +27,6 @@ env: []
# value: 8080
# - name: MXRUNTIME_ApplicationRootUrl
# value: "https://mx-app.example.com/"
# - name: METRICS_SERVICE_ENABLED
# value: "true"
# - name: MXRUNTIME_DatabaseHost
# value: "mendix-postgres:5432"
# - name: MXRUNTIME_DatabaseType
Expand All @@ -41,10 +37,6 @@ env: []
# value: "test-mx-app"
# - name: S3_ENDPOINT
# value: "http://minio:9000"
# - name: LICENSE_ID
# value: xxx
# - name: LICENSE_KEY
# value: xxx
# - name: ADMIN_PASSWORD
# value: "Hello0123!!"
# - name: MXRUNTIME_DatabaseUserName
Expand Down Expand Up @@ -76,10 +68,7 @@ resources: {}
# cpu: 0.5
# memory: 512Mi

annotations:
prometheus.io/scrape: "true"
prometheus.io/path: "/metrics"
prometheus.io/port: "8080"
annotations: {}

service:
type: ClusterIP
Expand All @@ -88,14 +77,11 @@ service:

ingress:
enabled: true
ingressClassName: nginx
domain: paas
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
annotations: {}
addHosts: false
hosts:
- foo.domain.com
- bar.domain.com
hosts: []
tls:
enabled: false
# Secrets must be manually created in the namespace.
Expand Down

0 comments on commit 3a4fafd

Please sign in to comment.