changed to a cleaner multi-container deployment

This commit is contained in:
Sebastian Wendel 2022-11-10 17:23:06 +01:00
parent fc00b9211e
commit ef482b51dc
No known key found for this signature in database
GPG key ID: 1422B7DF78144640
21 changed files with 617 additions and 433 deletions

View file

@ -39,7 +39,7 @@ In order to use the different tools on this repository, you will first need to:
- [Optional: Use the Nix Package Manager](https://nix.dev/tutorials/install-nix). This will allow you to make use of the [nixpkgs](https://github.com/NixOS/nixpkgs), automatically managing all required dependencies from the [`nix shell env`](shell.nix). In addition you also need the [nixpkgs: direnv](https://search.nixos.org/packages?query=direnv) for automatic environment selection.
```bash
k3d cluster create --config k3d-fcos-dev.yaml
k3d cluster create --config k3d-fcoscore-dev.yaml
```
Validate chart rendering

View file

@ -1,6 +1,6 @@
---
name: fcoscore
description: Fab City OS Core Chart using Kubernetes Helm
description: Fab City OS Core Kubernetes Helm Chart
version: 0.0.1
type: application
appVersion: latest
@ -11,8 +11,9 @@ sources:
- https://github.com/dyne/zenflows-crypto
- https://www.interfacerproject.eu/
keywords:
- fabcity
- fcos
- fabcity
- blockchain
- zenflow
- zvmlet
- fediverse

View file

@ -20,10 +20,10 @@ up: k3d-create build ## Create a local k3d development cluster.
down: k3d-delete ## Delete the local k3d development cluster.
k3d-create: ## Create a local K3D development cluster.
@k3d cluster create fcos-dev --config k3d-dev.yaml
@k3d cluster create fcoscore-dev --config k3d-dev.yaml
k3d-delete: ## Delete the local K3D development cluster
@k3d cluster delete fcos-dev
@k3d cluster delete fcoscore-dev
info: ## Show k3d cluster info
@k3d cluster list

View file

@ -1,5 +1,5 @@
{
description = "fc k8s runtime flake";
description = "fcoscore k8s runtime flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";

View file

@ -23,15 +23,6 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- 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 "fcoscore.zvmlet.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" . ) ( .Values.zvmlet.name) }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
@ -96,6 +87,81 @@ If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value
{{- end -}}
{{- 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 "fcoscore.zenflow.fullname" -}}
{{- printf "%s-zenflow" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "fcoscore.zenflow.host" -}}
{{- printf "%s" (include "fcoscore.zenflow.fullname" . ) -}}
{{- end -}}
{{- define "fcoscore.zenflow.port" -}}
{{- .Values.zvmlet.service.port -}}
{{- end -}}
{{- define "fcoscore.zenflow.url" -}}
{{- printf "http://%s:%s" (include "fcoscore.zenflow.host" . ) (include "fcoscore.zenflow.port" . ) -}}
{{- 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 "fcoscore.zvmlet.fullname" -}}
{{- printf "%s-zvmlet" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "fcoscore.zvmlet.host" -}}
{{- printf "%s" (include "fcoscore.zvmlet.fullname" . ) -}}
{{- end -}}
{{- define "fcoscore.zvmlet.port" -}}
{{- .Values.zvmlet.service.port | quote -}}
{{- 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 "fcoscore.frontend.fullname" -}}
{{- printf "%s-frontend" (include "common.names.fullname" .) | 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 "fcoscore.gateway.fullname" -}}
{{- printf "%s-gateway" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- define "fcoscore.gateway.host" -}}
{{- printf "%s" (include "fcoscore.gateway.fullname" . ) -}}
{{- end -}}
{{- define "fcoscore.gateway.port" -}}
{{- .Values.gateway.service.port | quote -}}
{{- end -}}
{{- define "fcoscore.gateway.url" -}}
{{- printf "http://%s:%s" (include "fcoscore.gateway.host" . ) (include "fcoscore.gateway.port" . ) -}}
{{- end -}}
{{/*
Return the Fab City Core secret name
*/}}
{{- define "fcoscore.secretName" -}}
{{- default (include "common.names.fullname" .) -}}
{{- end -}}
{{/*
Return true if a secret object for FabCityOS should be created
*/}}
@ -105,13 +171,6 @@ Return true if a secret object for FabCityOS should be created
{{- end -}}
{{- end -}}
{{/*
Return the zenflow secret name
*/}}
{{- define "zenflow.secretName" -}}
{{- default (include "common.names.fullname" .) -}}
{{- end -}}
{{/*
Return the Postgresql hostname
*/}}
@ -217,6 +276,10 @@ Return the Postgresql postgres password secret key
{{- end -}}
{{- end -}}
{{- define "fcoscore.meilisearch.host" -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "meilisearch" "chartValues" .Values.meilisearch "context" $) -}}
{{- 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).
@ -225,18 +288,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- include "common.names.dependency.fullname" (dict "chartName" "postgresql" "chartValues" .Values.postgresql "context" $) -}}
{{- end -}}
{{- define "fcoscore.zvmlet.host" -}}
{{- printf "%s" (include "fcoscore.zvmlet.fullname" . ) -}}
{{- end -}}
{{- define "fcoscore.zvmlet.port" -}}
{{- .Values.zvmlet.service.port | quote -}}
{{- end -}}
{{- define "fcoscore.meilisearch.host" -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "meilisearch" "chartValues" .Values.meilisearch "context" $) -}}
{{- end }}
{{- define "fcoscore.meilisearch.port" -}}
{{- .Values.meilisearch.service.port -}}
{{- end -}}

View file

@ -1,282 +0,0 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Chart.Name }}-{{ .Values.zenflow.name }}"
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Values.zenflow.name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.zenflow.repository }}:{{ .Values.zenflow.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.zenflow.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
{{- if or .Values.postgresql.enabled .Values.externalDatabase.create }}
- name: DB_HOST
value: {{ template "fcoscore.database.host" . }}
- name: DB_PORT
value: {{ template "fcoscore.database.port" . }}
- name: DB_NAME
value: {{ template "fcoscore.database.name" . }}
- name: DB_USER
value: {{ template "fcoscore.database.user" . }}
- name: DB_PASS
valueFrom:
secretKeyRef:
name: {{ include "fcoscore.database.secretName" . }}
key: {{ include "fcoscore.database.secretPasswordKey" . }}
{{- end }}
- name: ROOM_HOST
value: {{ template "fcoscore.zvmlet.host" . }}
- name: ROOM_PORT
value: {{ template "fcoscore.zvmlet.port" . }}
- name: ROOM_SALT
valueFrom:
secretKeyRef:
name: {{ include "zenflow.secretName" . }}
key: room-salt
- name: ADMIN_KEY
valueFrom:
secretKeyRef:
name: {{ include "zenflow.secretName" . }}
key: admin-key
ports:
- name: http
containerPort: {{ .Values.zenflow.service.port }}
protocol: TCP
# livenessProbe:
# httpGet:
# path: /
# port: http
# readinessProbe:
# httpGet:
# path: /
# port: http
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 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Chart.Name }}-{{ .Values.zvmlet.name }}"
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Values.zvmlet.name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.zvmlet.repository }}:{{ .Values.zvmlet.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.zvmlet.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: HTTP_PORT
value: {{ .Values.zvmlet.service.port | quote }}
ports:
- name: http
containerPort: {{ .Values.zvmlet.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /docs/
port: http
readinessProbe:
httpGet:
path: /docs/
port: http
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 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Chart.Name }}-{{ .Values.frontend.name }}"
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Values.frontend.name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.frontend.repository }}:{{ .Values.frontend.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.frontend.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: PORT
value: {{ .Values.frontend.service.port | quote }}
- name: BASE_URL
value: "https://gateway0.interfacer.dyne.org"
- name: NEXT_PUBLIC_ZENFLOWS_ADMIN
valueFrom:
secretKeyRef:
name: {{ include "zenflow.secretName" . }}
key: admin-key
- name: NEXT_PUBLIC_INVITATION_KEY
valueFrom:
secretKeyRef:
name: {{ include "zenflow.secretName" . }}
key: invitation-key
ports:
- name: http
containerPort: {{ .Values.frontend.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
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,95 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fcoscore.frontend.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "fcoscore.frontend.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.frontend.repository }}:{{ .Values.frontend.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.frontend.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: PORT
value: {{ .Values.frontend.service.port | quote }}
- name: BASE_URL
# TODO:
# value: "{{ include "fcoscore.gateway.url" . }}"
value: https://gateway0.interfacer.dyne.org/
- name: NEXT_PUBLIC_ZENFLOWS_ADMIN
valueFrom:
secretKeyRef:
name: {{ include "fcoscore.secretName" . }}
key: admin-key
- name: NEXT_PUBLIC_INVITATION_KEY
valueFrom:
secretKeyRef:
name: {{ include "fcoscore.secretName" . }}
key: invitation-key
ports:
- name: http
containerPort: {{ .Values.frontend.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
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,29 @@
---
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "fcoscore.frontend.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "fcoscore.frontend.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "fcoscore.frontend.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.zenflow.service.type }}
ports:
- port: {{ .Values.zenflow.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}

View file

@ -0,0 +1,75 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fcoscore.gateway.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "fcoscore.gateway.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.gateway.repository }}:{{ .Values.gateway.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.gateway.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: ZENFLOWS
value: {{ template "fcoscore.zenflow.url" . }}
- name: PORT
value: {{ template "fcoscore.zvmlet.port" . }}
ports:
- name: http
containerPort: {{ .Values.gateway.service.port }}
protocol: TCP
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,29 @@
---
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "fcoscore.gateway.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "fcoscore.gateway.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "fcoscore.gateway.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.gateway.service.type }}
ports:
- port: {{ .Values.gateway.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}

View file

@ -1,62 +0,0 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "fcoscore.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
---
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- 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: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -1,48 +0,0 @@
---
apiVersion: v1
kind: Service
metadata:
name: "{{ .Chart.Name }}-{{ .Values.zenflow.name }}"
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.zenflow.service.type }}
ports:
- port: {{ .Values.zenflow.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
name: "{{ .Chart.Name }}-{{ .Values.zvmlet.name }}"
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.zvmlet.service.type }}
ports:
- port: {{ .Values.zvmlet.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}
---
apiVersion: v1
kind: Service
metadata:
name: "{{ .Chart.Name }}-{{ .Values.frontend.name }}"
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.frontend.service.type }}
ports:
- port: {{ .Values.frontend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}

View file

@ -0,0 +1,100 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fcoscore.zenflow.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "fcoscore.zenflow.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.zenflow.repository }}:{{ .Values.zenflow.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.zenflow.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
{{- if or .Values.postgresql.enabled .Values.externalDatabase.create }}
- name: DB_HOST
value: {{ template "fcoscore.database.host" . }}
- name: DB_PORT
value: {{ template "fcoscore.database.port" . }}
- name: DB_NAME
value: {{ template "fcoscore.database.name" . }}
- name: DB_USER
value: {{ template "fcoscore.database.user" . }}
- name: DB_PASS
valueFrom:
secretKeyRef:
name: {{ include "fcoscore.database.secretName" . }}
key: {{ include "fcoscore.database.secretPasswordKey" . }}
{{- end }}
- name: ROOM_HOST
value: {{ template "fcoscore.zvmlet.host" . }}
- name: ROOM_PORT
value: {{ template "fcoscore.zvmlet.port" . }}
- name: ROOM_SALT
valueFrom:
secretKeyRef:
name: {{ include "fcoscore.secretName" . }}
key: room-salt
- name: ADMIN_KEY
valueFrom:
secretKeyRef:
name: {{ include "fcoscore.secretName" . }}
key: admin-key
ports:
- name: http
containerPort: {{ .Values.zenflow.service.port }}
protocol: TCP
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,29 @@
---
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "fcoscore.zenflow.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "fcoscore.zenflow.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "fcoscore.zenflow.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.zenflow.service.type }}
ports:
- port: {{ .Values.zenflow.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}

View file

@ -0,0 +1,81 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fcoscore.zvmlet.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fcoscore.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fcoscore.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fcoscore.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ include "fcoscore.zvmlet.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.zvmlet.repository }}:{{ .Values.zvmlet.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.zvmlet.pullPolicy }}
{{- if .Values.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
{{- end }}
env:
- name: HTTP_PORT
value: {{ .Values.zvmlet.service.port | quote }}
ports:
- name: http
containerPort: {{ .Values.zvmlet.service.port }}
protocol: TCP
livenessProbe:
httpGet:
path: /docs/
port: http
readinessProbe:
httpGet:
path: /docs/
port: http
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

@ -3,14 +3,14 @@
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "fcoscore.fullname" . }}
name: {{ include "fcoscore.zvmlet.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "fcoscore.fullname" . }}
name: {{ include "fcoscore.zvmlet.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:

View file

@ -0,0 +1,16 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "fcoscore.zvmlet.fullname" . }}
labels:
{{- include "fcoscore.labels" . | nindent 4 }}
spec:
type: {{ .Values.zvmlet.service.type }}
ports:
- port: {{ .Values.zvmlet.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "fcoscore.selectorLabels" . | nindent 4 }}

View file

@ -176,7 +176,6 @@ affinity: {}
## @param image.debug Enable image debug mode
##
zenflow:
name: zenflow
registry: docker.io
repository: fabcityhamburg/zenflows
## Specify a imagePullPolicy
@ -207,7 +206,6 @@ zenflow:
salt: ""
zvmlet:
name: zvmlet
registry: docker.io
repository: fabcityhamburg/zvmlet
## Specify a imagePullPolicy
@ -233,7 +231,6 @@ zvmlet:
port: 3000
frontend:
name: interfacer-gui
registry: docker.io
repository: fabcityhamburg/interfacer-gui
## Specify a imagePullPolicy
@ -256,7 +253,32 @@ frontend:
debug: false
service:
type: ClusterIP
port: 3030
port: 8080
gateway:
registry: docker.io
repository: fabcityhamburg/interfacer-gateway
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images
##
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
## e.g:
## pullSecrets:
## - myRegistryKeySecretName
##
pullSecrets: []
## Set to true if you would like to see extra information on logs
##
# Overrides the image tag whose default is the chart appVersion.
tag: ""
debug: false
service:
type: ClusterIP
port: 4040
## Persistence Parameters
## ref: https://kubernetes.io/docs/user-guide/persistent-volumes/
@ -384,7 +406,7 @@ postgresql:
enabled: true
auth:
username: zenflow
database: fcos_zenflow
database: fcoscore_zenflow
audit:
logHostname: true
logConnections: true