From 829cc1777efdbb163fe066a084c9cab7a1091660 Mon Sep 17 00:00:00 2001 From: guppy Date: Sun, 21 May 2023 14:10:47 +0200 Subject: [PATCH] Add Gitea-helm-ha for testing --- group_vars/all | 14 ++++++++---- roles/gitea-helm-ha/tasks/main.yaml | 19 ++++++++++++++++ roles/gitea-helm-ha/templates/values.yaml.j2 | 24 ++++++++++++++++++++ roles/gitea-helm/templates/values.yaml.j2 | 6 ++--- roles/openebs/templates/nfs.yaml | 16 +++++++++++++ 5 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 roles/gitea-helm-ha/tasks/main.yaml create mode 100644 roles/gitea-helm-ha/templates/values.yaml.j2 create mode 100644 roles/openebs/templates/nfs.yaml diff --git a/group_vars/all b/group_vars/all index 234a039..c3c898c 100644 --- a/group_vars/all +++ b/group_vars/all @@ -17,10 +17,16 @@ lb: subnet: 192.168.230.0/24 # Paramètre propre à notre application Gitea # extrenalips doit être dans le réseau du LoadBalancer mais ne doit pas entrer en conflit avec le pool ou l'IP des nodes -gitea: - replicacount: 1 - servicetype: LoadBalancer - externalips: 192.168.230.10 +#gitea: +# storageclass: "" +# FIXME: NFS storage not working +# storageclass: nfs-client +# servicetype: LoadBalancer +# externalips: 192.168.230.10 +# FIXME: gitea-ha not working (because NFS ?) +#gitea-ha: +# replica: 2 +# storageclass: nfs-client # Variable utilisé uniquement pour le téléchargement de CRI-O #os: "Debian_11" # Version de Kubernetes - utilisé pour le téchargement de CRI-O diff --git a/roles/gitea-helm-ha/tasks/main.yaml b/roles/gitea-helm-ha/tasks/main.yaml new file mode 100644 index 0000000..433cc85 --- /dev/null +++ b/roles/gitea-helm-ha/tasks/main.yaml @@ -0,0 +1,19 @@ +# To get the default file +# helm show values gitea-charts/gitea > values.yaml +- name: Get values + template: + src: values.yaml.j2 + dest: /tmp/values.yaml + +- name: install helm-git plugin + shell: helm plugin install https://github.com/aslafy-z/helm-git --version 0.15.1 + +- name: remove old gitea repo if exist + shell: helm repo remove gitea-charts + ignore_errors: true + +- name: install gitea-ha via helm + shell: | + helm repo add gitea-charts git+https://gitea.com/gitea/helm-chart@/?ref=deployment + helm repo update + helm install -f /tmp/values.yaml gitea gitea-charts/gitea --version 0.0.0 diff --git a/roles/gitea-helm-ha/templates/values.yaml.j2 b/roles/gitea-helm-ha/templates/values.yaml.j2 new file mode 100644 index 0000000..60cb866 --- /dev/null +++ b/roles/gitea-helm-ha/templates/values.yaml.j2 @@ -0,0 +1,24 @@ +image: + tag: "dev" + PullPolicy: "Always" + rootless: true + +replicaCount: {{ gitea-helm-ha.replica }} + +persistence: + enabled: true + accessModes: + - ReadWriteMany + storageClass: {{ gitea-helm-ha.storageclass }} + +redis-cluster: + enabled: false + global: + redis: + password: gitea + +gitea: + config: + indexer: + ISSUE_INDEXER_ENABLED: true + REPO_INDEXER_ENABLED: false diff --git a/roles/gitea-helm/templates/values.yaml.j2 b/roles/gitea-helm/templates/values.yaml.j2 index aef6fc0..25e71eb 100644 --- a/roles/gitea-helm/templates/values.yaml.j2 +++ b/roles/gitea-helm/templates/values.yaml.j2 @@ -14,14 +14,14 @@ global: ## - myRegistryKeySecretName ## imagePullSecrets: [] - storageClass: "" + storageClass: {{ gitea.storageclass }} hostAliases: [] # - ip: 192.168.137.2 # hostnames: # - example.com ## @param replicaCount number of replicas for the statefulset -replicaCount: {{ gitea.replicacount }} +replicaCount: 1 ## @param clusterDomain cluster domain clusterDomain: cluster.local @@ -225,7 +225,7 @@ persistence: - ReadWriteOnce labels: {} annotations: {} - storageClass: + storageClass: {{ gitea.storageclass }} subPath: ## @param extraVolumes Additional volumes to mount to the Gitea statefulset diff --git a/roles/openebs/templates/nfs.yaml b/roles/openebs/templates/nfs.yaml new file mode 100644 index 0000000..5778146 --- /dev/null +++ b/roles/openebs/templates/nfs.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: openebs-hostpath + annotations: + storageclass.kubernetes.io/is-default-class: "true" + openebs.io/cas-type: local + cas.openebs.io/config: | + - name: StorageType + value: "hostpath" + - name: BasePath + value: "/var/openebs/local/" +provisioner: openebs.io/local +volumeBindingMode: WaitForFirstConsumer +reclaimPolicy: Delete