From 910c28e47bd0a2d011eb36b5356fa05bcd7ab794 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Wed, 1 Mar 2023 18:10:31 +0100 Subject: [PATCH] feat: migrate from Gitea to Forgejo --- k8s/configure_cluster.yaml | 10 +++--- .../values.drone-runner-docker.yml.j2 | 15 +++++++- k8s/roles/gitea/tasks/main.yml | 35 +++++++++++-------- ...ues.gitea.yml.j2 => values.forgejo.yml.j2} | 5 ++- 4 files changed, 44 insertions(+), 21 deletions(-) rename k8s/roles/gitea/templates/{values.gitea.yml.j2 => values.forgejo.yml.j2} (95%) diff --git a/k8s/configure_cluster.yaml b/k8s/configure_cluster.yaml index dd629d4..488a059 100644 --- a/k8s/configure_cluster.yaml +++ b/k8s/configure_cluster.yaml @@ -2,9 +2,9 @@ hosts: localhost roles: # - role: gateway-api - - role: prometheus - - role: postgres - - role: hcloud - - role: minio + #- role: prometheus + #- role: postgres + #- role: hcloud + #- role: minio - role: gitea - - role: drone + #- role: drone diff --git a/k8s/roles/drone/templates/values.drone-runner-docker.yml.j2 b/k8s/roles/drone/templates/values.drone-runner-docker.yml.j2 index 85bffe0..bad13b8 100644 --- a/k8s/roles/drone/templates/values.drone-runner-docker.yml.j2 +++ b/k8s/roles/drone/templates/values.drone-runner-docker.yml.j2 @@ -5,4 +5,17 @@ env: DRONE_RUNNER_PRIVILEGED_IMAGES: code.icb4dc0.de/inetmock/inetmock DRONE_RPC_HOST: drone.drone.svc.cluster.local:8080 DRONE_RPC_PROTO: http - DRONE_RUNNER_CAPACITY: 1 \ No newline at end of file + DRONE_RUNNER_CAPACITY: 1 + +affinity: + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + podAffinityTerm: + labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - drone-runner-docker + topologyKey: kubernetes.io/hostname diff --git a/k8s/roles/gitea/tasks/main.yml b/k8s/roles/gitea/tasks/main.yml index 9884c63..7480b7d 100644 --- a/k8s/roles/gitea/tasks/main.yml +++ b/k8s/roles/gitea/tasks/main.yml @@ -4,35 +4,42 @@ name: gitea api_version: v1 kind: Namespace + state: absent + definition: + metadata: + labels: + prometheus: default + +- name: Create forgejo namespace + kubernetes.core.k8s: + name: forgejo + api_version: v1 + kind: Namespace state: present definition: metadata: labels: prometheus: default -- name: Create Gitea admin credentials +- name: Create Forgejo admin credentials kubernetes.core.k8s: state: present definition: apiVersion: v1 kind: Secret metadata: - name: gitea-admin-credentials - namespace: gitea + name: forgejo-admin-credentials + namespace: forgejo data: username: "{{ gitea.adminUser | b64encode }}" password: "{{ gitea.adminPassword | b64encode }}" -- name: Add Gitea chart repo - kubernetes.core.helm_repository: - name: gitea - repo_url: https://dl.gitea.io/charts/ - -- name: Deploy Gitea chart +- name: Deploy Forgejo chart kubernetes.core.helm: - name: gitea - chart_ref: gitea/gitea - release_namespace: gitea - chart_version: 7.0.2 + name: forgejo + chart_ref: oci://codeberg.org/forgejo-contrib/forgejo + release_namespace: forgejo + release_state: present + chart_version: 0.3.1 update_repo_cache: true - release_values: "{{ lookup('template', 'values.gitea.yml.j2') | from_yaml }}" + release_values: "{{ lookup('template', 'values.forgejo.yml.j2') | from_yaml }}" diff --git a/k8s/roles/gitea/templates/values.gitea.yml.j2 b/k8s/roles/gitea/templates/values.forgejo.yml.j2 similarity index 95% rename from k8s/roles/gitea/templates/values.gitea.yml.j2 rename to k8s/roles/gitea/templates/values.forgejo.yml.j2 index 6364a16..d9b9591 100644 --- a/k8s/roles/gitea/templates/values.gitea.yml.j2 +++ b/k8s/roles/gitea/templates/values.forgejo.yml.j2 @@ -3,6 +3,9 @@ service: type: NodePort nodePort: 32022 +image: + tag: "1.18.3-1" + ingress: enabled: true hosts: @@ -26,7 +29,7 @@ persistence: gitea: admin: - existingSecret: gitea-admin-credentials + existingSecret: forgejo-admin-credentials metrics: enabled: true serviceMonitor: