-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wojciech Międzybrodzki
committed
Dec 23, 2024
1 parent
051c488
commit f8fc907
Showing
8 changed files
with
190 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Platformex App chart | ||
--- | ||
|
||
TODO: | ||
- [ ] 1st working version | ||
- [ ] example values file with all possible options used | ||
- [ ] simple stupid test | ||
- [ ] json schema | ||
- [ ] deployment.containers required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{{- define "platformex.deployment.replicas" }} | ||
{{- if .deployment.worker | default false}} | ||
{{- include "platformex.deployment.worker.replicas" . }} | ||
{{- else }} | ||
replicas: {{ .deployment.replicas }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.volumes" }} | ||
{{- if .deployment.volumes }} | ||
volumes: | ||
{{- toYaml .deployment.volumes | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.nodeSelector" }} | ||
{{- if .deployment.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml .deployment.nodeSelector | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.imagePullSecrets" }} | ||
{{- if .deployment.imagePullSecrets }} | ||
{{- else }} | ||
imagePullSecrets: {{- range .root.Values.global.defaults.imagePullSecrets }} | ||
- {{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.envFrom" }} | ||
{{- if .envFrom }} | ||
envFrom: | ||
{{- toYaml .envFrom | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.env" }} | ||
env: | ||
{{- range $name, $env := .container.env }} | ||
- name: {{ $name }} | ||
{{- if typeIs "string" $env }} | ||
value: {{ $env }} | ||
{{- else if hasKey $env "valueFrom" }} | ||
valueFrom: | ||
{{- toYaml $env.valueFrom | nindent 4 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.volumeMounts" }} | ||
{{- if .volumeMounts }} | ||
volumeMounts: | ||
{{- range .volumeMounts }} | ||
- {{- toYaml . | nindent 2 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.deployment.worker.replicas" }} | ||
{{- if eq .instance.enableWorkers true}} | ||
replicas: {{ .deployment.replicas }} | ||
{{- else }} | ||
replicas: 0 | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- define "platformex.globalLabels" }} | ||
{{- range $key, $value := $.Values.global.labels }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "platformex.kubernetesAppLabels" }} | ||
app.kubernetes.io/name: {{ .name }} | ||
app.kubernetes.io/instance: {{ .iname | quote }} | ||
{{- end }} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
{{- range $iname, $instance := .Values.instances }} | ||
{{- range $dname, $deployment := $instance.deployments }} | ||
{{- $deploymentContext := dict "iname" $iname "instance" $instance "name" $dname "deployment" $deployment "root" $ }} | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ $dname }} | ||
annotations: | ||
labels: | ||
{{- include "platformex.kubernetesAppLabels" $deploymentContext | indent 10 }} | ||
{{- include "platformex.globalLabels" $ | indent 10 }} | ||
spec: | ||
revisionHistoryLimit: 3 | ||
{{- include "platformex.deployment.replicas" $deploymentContext | indent 6 }} | ||
selector: | ||
matchLabels: | ||
{{- include "platformex.kubernetesAppLabels" $deploymentContext | indent 10 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "platformex.kubernetesAppLabels" $deploymentContext | indent 12 }} | ||
{{- include "platformex.globalLabels" $ | indent 12 }} | ||
spec: | ||
{{- include "platformex.deployment.volumes" $deploymentContext | indent 10 }} | ||
{{- include "platformex.deployment.nodeSelector" $deploymentContext | indent 10 }} | ||
{{- include "platformex.deployment.imagePullSecrets" $deploymentContext | indent 10 }} | ||
{{- if $deployment.initContainers }} | ||
initContainers: | ||
{{- range $icName, $initContainer := $deployment.initContainers }} | ||
{{- $icContext := dict "iname" $iname "instance" $instance "name" $icName "container" $initContainer "root" $ }} | ||
- name: {{ $icName }} | ||
{{- include "platformex.deployment.volumeMounts" $initContainer | indent 14 }} | ||
{{- include "platformex.deployment.envFrom" $icContext | indent 14 }} | ||
{{- include "platformex.deployment.env" $icContext | indent 14 }} | ||
{{- /* {{- include "platformex.deployment.imagePullPolicy" $icContext | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.image" $icContext | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.command" $initContainer | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.lifecycle" $initContainer | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.ports" $initContainer | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.liveness" $initContainer | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.readiness" $initContainer | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.startup" $initContainer | indent 14 }}*/}} | ||
{{- /* {{- include "platformex.deployment.resources" $initContainer | indent 14 }}*/}} | ||
{{- end }} | ||
{{- end }} | ||
containers: | ||
{{- range $cName, $container := $deployment.containers }} | ||
{{- $icContext := dict "iname" $iname "instance" $instance "name" $cName "container" $container "root" $ }} | ||
- name: {{ $cName }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
global: | ||
labels: | ||
ops.kodzik.cloud/chart: "platformex" | ||
defaults: | ||
imagePullSecrets: | ||
- "oci-kodzik" | ||
imageRepository: "oci.kodzik.cloud/public/demo" | ||
|
||
envPresets: | ||
common: | ||
APP_ENV: prod | ||
worker: | ||
WORKER_MODE: 1 | ||
cron: | ||
CRON_MODE: 1 | ||
|
||
images: | ||
default: | ||
testowy: | ||
imageRepository: "oci.kodzik.cloud/public/demko" | ||
imageTag: "1.0.0" | ||
|
||
instances: | ||
default: | ||
enableCrons: false | ||
enableWorkers: false | ||
crons: [] | ||
deployments: | ||
testowy: | ||
replicas: 3 | ||
initContainers: | ||
pszemek: | ||
volumeMounts: | ||
- mountPath: /var/lib/xyz-conf/.my.cnf | ||
name: sum-volum | ||
subPath: derp.cnf | ||
env: | ||
EIP: "true" | ||
PASSWORD: | ||
valueFrom: | ||
secretKeyRef: | ||
key: password | ||
name: app-secret | ||
containers: [] | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.