Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions mender/templates/admin-panel-gui/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{{- if and .Values.admin_panel_gui.enabled .Values.global.enterprise }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two admin_panel and admin_panel_gui always go in pair right? What about just using admin_panel as key and dropping admin_panel_gui? If you need specific gui-only values, you can have a dedicated stanza under admin_panel, like:

admin_panel:
  enabled: true
  gui:
    mystuff: 
Suggested change
{{- if and .Values.admin_panel_gui.enabled .Values.global.enterprise }}
{{- if and .Values.admin_panel.enabled .Values.global.enterprise }}

{{- $context := dict "dot" . "component" "admin-panel-gui" "override" .Values.admin_panel_gui -}}
{{- $merged := merge (deepCopy .Values.admin_panel_gui) (deepCopy (default (dict) .Values.default)) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mender.fullname" . }}-admin-panel-gui
namespace: {{ .Release.Namespace }}
labels:
{{- include "mender.labels" . | nindent 4 }}
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel-gui
app.kubernetes.io/component: admin-panel-gui
spec:
{{- if not (or .Values.admin_panel_gui.hpa .Values.default.hpa ) }}
replicas: {{ .Values.admin_panel_gui.replicas }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel-gui

progressDeadlineSeconds: 600

{{- $updateStrategy := coalesce .Values.admin_panel_gui.updateStrategy .Values.default.updateStrategy }}
{{- if $updateStrategy }}
strategy: {{- toYaml $updateStrategy | nindent 4 }}
{{- end }}

{{- $minReadySeconds := coalesce .Values.admin_panel_gui.minReadySeconds .Values.default.minReadySeconds }}
{{- if $minReadySeconds }}
minReadySeconds: {{ $minReadySeconds }}
{{- end }}

template:
metadata:
{{- with .Values.admin_panel_gui.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel-gui
{{- include "mender.labels" . | nindent 8 }}
app.kubernetes.io/component: admin-panel-gui
spec:
serviceAccountName: {{ include "mender.serviceAccountName" . }}
{{- with $merged.affinity }}
affinity: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with $merged.tolerations }}
tolerations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.admin_panel_gui.podSecurityContext.enabled }}
securityContext: {{- omit .Values.admin_panel_gui.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}

containers:
- name: admin-panel-gui
image: {{ include "mender.image" $context }}
imagePullPolicy: {{ include "mender.imagePullPolicy" $context }}
{{- if .Values.admin_panel_gui.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.admin_panel_gui.containerSecurityContext "enabled" | toYaml | nindent 10 }}
{{- end }}
{{- with include "mender.resources" (list .Values.default.resources .Values.admin_panel_gui.resources) }}
resources: {{- nindent 10 . }}
{{- end }}

livenessProbe:
tcpSocket:
port: {{ .Values.admin_panel_gui.httpPort }}
{{- with include "mender.probesOverrides" (dict "default" .Values.default.probesOverrides "override" .Values.admin_panel_gui.probesOverrides ) }}
{{- nindent 10 . }}
{{- end }}
readinessProbe:
tcpSocket:
port: {{ .Values.admin_panel_gui.httpPort }}
{{- with include "mender.probesOverrides" (dict "default" .Values.default.probesOverrides "override" .Values.admin_panel_gui.probesOverrides ) }}
{{- nindent 10 . }}
{{- end }}
startupProbe:
tcpSocket:
port: {{ .Values.admin_panel_gui.httpPort }}
{{- with include "mender.probesOverrides" (dict "default" .Values.default.probesOverrides "override" .Values.admin_panel_gui.probesOverrides ) }}
{{- nindent 10 . }}
{{- end }}

{{- with include "mender.customEnvs" (merge (deepCopy .Values.admin_panel_gui) (deepCopy (default (dict) .Values.default))) }}
env:
{{- nindent 8 . }}
{{- end }}

{{- if and .Values.global.image .Values.global.image.username }}
imagePullSecrets:
- name: docker-registry
{{- else }}
{{- $ips := coalesce .Values.admin_panel_gui.imagePullSecrets .Values.default.imagePullSecrets }}
{{- if $ips }}
imagePullSecrets:
{{- toYaml $ips | nindent 6 }}
{{- end }}
{{- end }}

{{- $pcn := coalesce .Values.admin_panel_gui.priorityClassName .Values.global.priorityClassName -}}
{{- if $pcn }}
priorityClassName: {{ $pcn }}
{{- end }}

{{- with (coalesce .Values.admin_panel_gui.nodeSelector .Values.default.nodeSelector) }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions mender/templates/admin-panel-gui/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- if and .Values.admin_panel_gui.enabled .Values.global.enterprise }}
{{- $servicename := "admin-panel-gui" }}
{{- $context := (dict "default" .Values.default "override" .Values.admin_panel_gui "name" (printf "%s-%s" (include "mender.fullname" . ) $servicename ) ) -}}
{{- include "mender.autoscaler" $context }}
{{- end }}
38 changes: 38 additions & 0 deletions mender/templates/admin-panel-gui/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if and .Values.admin_panel_gui.enabled .Values.global.enterprise }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.admin_panel_gui.service.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "mender.labels" . | nindent 4 }}
app.kubernetes.io/name: admin-panel-gui-svc
app.kubernetes.io/component: admin-panel-gui
{{- with .Values.admin_panel_gui.service.annotations }}
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.admin_panel_gui.service.type }}
{{- if and (eq .Values.admin_panel_gui.service.type "ClusterIP") .Values.admin_panel_gui.service.clusterIP }}
clusterIP: {{ .Values.admin_panel_gui.service.clusterIP }}
{{- end }}
{{- if and (eq .Values.admin_panel_gui.service.type "LoadBalancer") .Values.admin_panel_gui.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.admin_panel_gui.service.loadBalancerIP }}
{{- end }}
{{- if .Values.admin_panel_gui.service.externalIPs }}
externalIPs: {{ toYaml .Values.admin_panel_gui.service.externalIPs | nindent 4 }}
{{- end }}
{{- if .Values.admin_panel_gui.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values.admin_panel_gui.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
ports:
- port: {{ .Values.admin_panel_gui.service.port }}
name: http
protocol: TCP
targetPort: {{ .Values.admin_panel_gui.httpPort }}
{{- if .Values.admin_panel_gui.service.nodePort }}
nodePort: {{ .Values.admin_panel_gui.service.nodePort }}
{{- end }}
selector:
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel-gui
{{- end }}
134 changes: 134 additions & 0 deletions mender/templates/admin-panel/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{{- if and .Values.admin_panel.enabled .Values.global.enterprise }}
{{- $context := dict "dot" . "component" "admin-panel" "override" .Values.admin_panel -}}
{{- $merged := merge (deepCopy .Values.admin_panel) (deepCopy (default (dict) .Values.default)) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mender.fullname" . }}-admin-panel
namespace: {{ .Release.Namespace }}
labels:
{{- include "mender.labels" . | nindent 4 }}
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel
app.kubernetes.io/component: admin-panel
spec:
{{- if not (or .Values.admin_panel.hpa .Values.default.hpa ) }}
replicas: {{ .Values.admin_panel.replicas }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel

progressDeadlineSeconds: 600

{{- $updateStrategy := coalesce .Values.admin_panel.updateStrategy .Values.default.updateStrategy }}
{{- if $updateStrategy }}
strategy: {{- toYaml $updateStrategy | nindent 4 }}
{{- end }}

{{- $minReadySeconds := coalesce .Values.admin_panel.minReadySeconds .Values.default.minReadySeconds }}
{{- if $minReadySeconds }}
minReadySeconds: {{ $minReadySeconds }}
{{- end }}

template:
metadata:
{{- with .Values.admin_panel.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel
{{- include "mender.labels" . | nindent 8 }}
app.kubernetes.io/component: admin-panel
spec:
serviceAccountName: {{ include "mender.serviceAccountName" . }}
{{- with $merged.affinity }}
affinity: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- with $merged.tolerations }}
tolerations: {{ tpl (toYaml .) $ | nindent 8 }}
{{- end }}
{{- if .Values.admin_panel.podSecurityContext.enabled }}
securityContext: {{- omit .Values.admin_panel.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}

containers:
- name: admin-panel
image: {{ include "mender.image" $context }}
imagePullPolicy: {{ include "mender.imagePullPolicy" $context }}
{{- if .Values.admin_panel.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.admin_panel.containerSecurityContext "enabled" | toYaml | nindent 10 }}
{{- end }}
{{- with include "mender.resources" (list .Values.default.resources .Values.admin_panel.resources) }}
resources: {{- nindent 10 . }}
{{- end }}

args: ["server"]

readinessProbe:
httpGet:
path: /api/internal/v1/admin-panel/health
port: 8080
periodSeconds: 15
{{- with include "mender.probesOverrides" (dict "default" .Values.default.probesOverrides "override" .Values.admin_panel.probesOverrides ) }}
{{- nindent 10 . }}
{{- end }}
livenessProbe:
httpGet:
path: /api/internal/v1/admin-panel/alive
port: 8080
periodSeconds: 5
{{- with include "mender.probesOverrides" (dict "default" .Values.default.probesOverrides "override" .Values.admin_panel.probesOverrides ) }}
{{- nindent 10 . }}
{{- end }}
startupProbe:
httpGet:
path: /api/internal/v1/admin-panel/alive
port: 8080
failureThreshold: 36
periodSeconds: 5

env:
- name: ADMIN_PANEL_TENANTADM_ADDRESS
value: {{ printf "http://%s:%v" .Values.tenantadm.service.name .Values.tenantadm.service.port }}
- name: ADMIN_PANEL_USERADM_ADDRESS
value: {{ printf "http://%s:%v" .Values.useradm.service.name .Values.useradm.service.port }}
- name: ADMIN_PANEL_DEVICEAUTH_ADDRESS
value: {{ printf "http://%s:%v" .Values.device_auth.service.name .Values.device_auth.service.port }}
- name: ADMIN_PANEL_DEPLOYMENTS_ADDRESS
value: {{ printf "http://%s:%v" .Values.deployments.service.name .Values.deployments.service.port }}
- name: ADMIN_PANEL_INVENTORY_ADDRESS
value: {{ printf "http://%s:%v" .Values.inventory.service.name .Values.inventory.service.port }}
# the chart names the workflows service '-server', so the service default of 'mender-workflows' does not resolve here
- name: ADMIN_PANEL_WORKFLOWS_ADDRESS
value: {{ printf "http://%s:%v" .Values.workflows.service.name .Values.workflows.service.port }}
{{- include "mender.customEnvs" (merge (deepCopy .Values.admin_panel) (deepCopy (default (dict) .Values.default))) | nindent 8 }}
# The OAuth credentials and the session secret have no defaults and the service refuses to start without them,
# so they are expected to come in through customEnvs or the secret below.
{{- with .Values.admin_panel.existingSecret }}
envFrom:
- prefix: ADMIN_PANEL_
secretRef:
name: {{ . }}
{{- end }}

{{- if and .Values.global.image .Values.global.image.username }}
imagePullSecrets:
- name: docker-registry
{{- else }}
{{- $ips := coalesce .Values.admin_panel.imagePullSecrets .Values.default.imagePullSecrets }}
{{- if $ips }}
imagePullSecrets:
{{- toYaml $ips | nindent 6 }}
{{- end }}
{{- end }}

{{- $pcn := coalesce .Values.admin_panel.priorityClassName .Values.global.priorityClassName -}}
{{- if $pcn }}
priorityClassName: {{ $pcn }}
{{- end }}

{{- with (coalesce .Values.admin_panel.nodeSelector .Values.default.nodeSelector) }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions mender/templates/admin-panel/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- if and .Values.admin_panel.enabled .Values.global.enterprise }}
{{- $servicename := "admin-panel" }}
{{- $context := (dict "default" .Values.default "override" .Values.admin_panel "name" (printf "%s-%s" (include "mender.fullname" . ) $servicename ) ) -}}
{{- include "mender.autoscaler" $context }}
{{- end }}
38 changes: 38 additions & 0 deletions mender/templates/admin-panel/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if and .Values.admin_panel.enabled .Values.global.enterprise }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.admin_panel.service.name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "mender.labels" . | nindent 4 }}
app.kubernetes.io/name: admin-panel-svc
app.kubernetes.io/component: admin-panel
{{- with .Values.admin_panel.service.annotations }}
annotations: {{ tpl (toYaml .) $ | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.admin_panel.service.type }}
{{- if and (eq .Values.admin_panel.service.type "ClusterIP") .Values.admin_panel.service.clusterIP }}
clusterIP: {{ .Values.admin_panel.service.clusterIP }}
{{- end }}
{{- if and (eq .Values.admin_panel.service.type "LoadBalancer") .Values.admin_panel.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.admin_panel.service.loadBalancerIP }}
{{- end }}
{{- if .Values.admin_panel.service.externalIPs }}
externalIPs: {{ toYaml .Values.admin_panel.service.externalIPs | nindent 4 }}
{{- end }}
{{- if .Values.admin_panel.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- toYaml .Values.admin_panel.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
ports:
- port: {{ .Values.admin_panel.service.port }}
name: http
protocol: TCP
targetPort: 8080
{{- if .Values.admin_panel.service.nodePort }}
nodePort: {{ .Values.admin_panel.service.nodePort }}
{{- end }}
selector:
app.kubernetes.io/name: {{ include "mender.fullname" . }}-admin-panel
{{- end }}
Loading