From c5fd0ca5c64b2187bb64f93c4ceaec6195182a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Cluseau?= Date: Wed, 4 Oct 2023 21:38:09 +0200 Subject: [PATCH] step-0 --- templates/app.yaml | 3 +- templates/pre-sync.yaml | 3 +- templates/sync.yaml | 1 + values.yaml | 10 ++-- z-template.yaml | 114 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 z-template.yaml diff --git a/templates/app.yaml b/templates/app.yaml index 340ac8c..e9462b5 100644 --- a/templates/app.yaml +++ b/templates/app.yaml @@ -29,6 +29,5 @@ spec: - name: app command: [ "app" ] image: "{{ .Values.app.repo }}:{{ .Values.app.tag }}" - imagePullPolicy: Always # while debugging - #imagePullPolicy: IfNotPresent + imagePullPolicy: IfNotPresent diff --git a/templates/pre-sync.yaml b/templates/pre-sync.yaml index be8ffe6..a4bcc27 100644 --- a/templates/pre-sync.yaml +++ b/templates/pre-sync.yaml @@ -1,5 +1,5 @@ {{ if .Values.etcd.backup }} - +# ------------------------------------------------------------------------ --- apiVersion: batch/v1 kind: Job @@ -18,7 +18,6 @@ spec: volumeMounts: - mountPath: /data name: data - subPath: etcd command: - etcdctl - --endpoints=http://etcd:2379 diff --git a/templates/sync.yaml b/templates/sync.yaml index 28890c4..d97e868 100644 --- a/templates/sync.yaml +++ b/templates/sync.yaml @@ -15,6 +15,7 @@ spec: containers: - name: migrate image: {{ .Values.migrate.repo }}:{{ .Values.migrate.tag }} + imagePullPolicy: Always # XXX remove command: - migrate {{ end }} diff --git a/values.yaml b/values.yaml index 9ba8aa5..a939bfa 100644 --- a/values.yaml +++ b/values.yaml @@ -9,11 +9,15 @@ app: migrate: repo: gitea.demos.novit.tech/demo/migrate #tag: v1 - tag: v2 + #tag: v2 etcd: - backup: true - tag: v3.5.9 + backup: false + #backup: true + + tag: v3.5.8 + #tag: v3.5.9 + storage: class: local request: 1Gi diff --git a/z-template.yaml b/z-template.yaml new file mode 100644 index 0000000..386dfbc --- /dev/null +++ b/z-template.yaml @@ -0,0 +1,114 @@ +--- +# Source: mini-app/templates/app.yaml +apiVersion: v1 +kind: Service +metadata: + name: app +spec: + selector: + app: app + ports: + - port: 80 +--- +# Source: mini-app/templates/etcd.yaml +apiVersion: v1 +kind: Service +metadata: + name: etcd +spec: + selector: + app: etcd + ports: + - port: 2379 +--- +# Source: mini-app/templates/app.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: app +spec: + replicas: 1 + selector: + matchLabels: + app: app + template: + metadata: + labels: + app: app + spec: + containers: + - name: app + command: [ "app" ] + image: "gitea.demos.novit.tech/demo/app:v0.0.1" + imagePullPolicy: IfNotPresent +--- +# Source: mini-app/templates/etcd.yaml +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: etcd + annotations: + argocd.argoproj.io/sync-wave: "1" +spec: + replicas: 1 + selector: + matchLabels: + app: etcd + template: + metadata: + labels: + app: etcd + spec: + containers: + - name: etcd + image: quay.io/coreos/etcd:v3.5.8 + imagePullPolicy: IfNotPresent + command: + - etcd + - --initial-cluster-state=new + - --data-dir=/data + - --advertise-client-urls=http://etcd-0.etcd:2379 + - --listen-client-urls=http://[::]:2379 + volumeMounts: + - mountPath: /data + name: data + subPath: etcd + volumeClaimTemplates: + - metadata: + name: data + spec: + storageClassName: "local" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +# Source: mini-app/templates/ingress.yaml +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: mini-app + labels: + helm.sh/chart: mini-app-1.0.0 + app.kubernetes.io/name: mini-app + app.kubernetes.io/instance: mini-app + app.kubernetes.io/version: "1.0.0" + app.kubernetes.io/managed-by: Helm + +spec: + tls: + - hosts: + - "app.demos.novit.tech" + secretName: app-crt + rules: + - host: "app.demos.novit.tech" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: app + port: + number: 80