From 88a780944da0d6af99557b86d9fb2bcaf0c6da7f Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Tue, 15 Oct 2024 09:44:25 +0200 Subject: [PATCH] Add argocd and bump-tag --- argocd-nginx/base/argocd-ingress.yaml | 22 +++++++ argocd-nginx/base/kustomization.yaml | 2 + .../overlays/prod/argocd-ingress.yaml | 27 +++++++++ argocd-nginx/overlays/prod/kustomization.yaml | 6 ++ .../overlays/test/argocd-ingress.yaml | 27 +++++++++ argocd-nginx/overlays/test/kustomization.yaml | 6 ++ argocd/base/argocd-namespace.yml | 7 +++ argocd/base/kustomization.yaml | 6 ++ argocd/overlays/prod/argocd-cm.yaml | 17 ++++++ .../prod/argocd-repo-server-deployment.yaml | 21 +++++++ .../prod/argocd-server-deployment.yaml | 22 +++++++ argocd/overlays/prod/kustomization.yaml | 8 +++ argocd/overlays/test/argocd-cm.yaml | 17 ++++++ .../test/argocd-repo-server-deployment.yaml | 21 +++++++ .../test/argocd-server-deployment.yaml | 22 +++++++ argocd/overlays/test/kustomization.yaml | 8 +++ bump-tag | 57 +++++++++++++++++++ 17 files changed, 296 insertions(+) create mode 100644 argocd-nginx/base/argocd-ingress.yaml create mode 100644 argocd-nginx/base/kustomization.yaml create mode 100644 argocd-nginx/overlays/prod/argocd-ingress.yaml create mode 100644 argocd-nginx/overlays/prod/kustomization.yaml create mode 100644 argocd-nginx/overlays/test/argocd-ingress.yaml create mode 100644 argocd-nginx/overlays/test/kustomization.yaml create mode 100644 argocd/base/argocd-namespace.yml create mode 100644 argocd/base/kustomization.yaml create mode 100644 argocd/overlays/prod/argocd-cm.yaml create mode 100644 argocd/overlays/prod/argocd-repo-server-deployment.yaml create mode 100644 argocd/overlays/prod/argocd-server-deployment.yaml create mode 100644 argocd/overlays/prod/kustomization.yaml create mode 100644 argocd/overlays/test/argocd-cm.yaml create mode 100644 argocd/overlays/test/argocd-repo-server-deployment.yaml create mode 100644 argocd/overlays/test/argocd-server-deployment.yaml create mode 100644 argocd/overlays/test/kustomization.yaml create mode 100755 bump-tag diff --git a/argocd-nginx/base/argocd-ingress.yaml b/argocd-nginx/base/argocd-ingress.yaml new file mode 100644 index 0000000..5bf2a4c --- /dev/null +++ b/argocd-nginx/base/argocd-ingress.yaml @@ -0,0 +1,22 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: argocd-ingress + namespace: argocd +spec: + ingressClassName: nginx + tls: + - hosts: + - argocd.streams.sunet.se + secretName: tls-secret + rules: + - host: argocd.streams.sunet.se + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: argocd-server + port: + name: https diff --git a/argocd-nginx/base/kustomization.yaml b/argocd-nginx/base/kustomization.yaml new file mode 100644 index 0000000..6802995 --- /dev/null +++ b/argocd-nginx/base/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - argocd-ingress.yaml diff --git a/argocd-nginx/overlays/prod/argocd-ingress.yaml b/argocd-nginx/overlays/prod/argocd-ingress.yaml new file mode 100644 index 0000000..2eccb23 --- /dev/null +++ b/argocd-nginx/overlays/prod/argocd-ingress.yaml @@ -0,0 +1,27 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: argocd-ingress + namespace: argocd +spec: + defaultBackend: + service: + name: argocd-server + port: + number: 80 + ingressClassName: nginx + tls: + - hosts: + - argocd.streams.sunet.se + secretName: tls-secret + rules: + - host: argocd.streams.sunet.se + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: argocd-server + port: + number: 80 diff --git a/argocd-nginx/overlays/prod/kustomization.yaml b/argocd-nginx/overlays/prod/kustomization.yaml new file mode 100644 index 0000000..fca736b --- /dev/null +++ b/argocd-nginx/overlays/prod/kustomization.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: [../../base] +patches: + - path: argocd-ingress.yaml diff --git a/argocd-nginx/overlays/test/argocd-ingress.yaml b/argocd-nginx/overlays/test/argocd-ingress.yaml new file mode 100644 index 0000000..e02af5f --- /dev/null +++ b/argocd-nginx/overlays/test/argocd-ingress.yaml @@ -0,0 +1,27 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: argocd-ingress + namespace: argocd +spec: + defaultBackend: + service: + name: argocd-server + port: + number: 80 + ingressClassName: nginx + tls: + - hosts: + - argocd-test.streams.sunet.se + secretName: tls-secret + rules: + - host: argocd-test.streams.sunet.se + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: argocd-server + port: + number: 80 diff --git a/argocd-nginx/overlays/test/kustomization.yaml b/argocd-nginx/overlays/test/kustomization.yaml new file mode 100644 index 0000000..fca736b --- /dev/null +++ b/argocd-nginx/overlays/test/kustomization.yaml @@ -0,0 +1,6 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: [../../base] +patches: + - path: argocd-ingress.yaml diff --git a/argocd/base/argocd-namespace.yml b/argocd/base/argocd-namespace.yml new file mode 100644 index 0000000..0eaf66b --- /dev/null +++ b/argocd/base/argocd-namespace.yml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: argocd +spec: + finalizers: + - kubernetes diff --git a/argocd/base/kustomization.yaml b/argocd/base/kustomization.yaml new file mode 100644 index 0000000..d2d0f7b --- /dev/null +++ b/argocd/base/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: argocd +resources: +- https://raw.githubusercontent.com/argoproj/argo-cd/v2.12.4/manifests/ha/install.yaml diff --git a/argocd/overlays/prod/argocd-cm.yaml b/argocd/overlays/prod/argocd-cm.yaml new file mode 100644 index 0000000..85b88a9 --- /dev/null +++ b/argocd/overlays/prod/argocd-cm.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/instance: argocd + app.kubernetes.io/name: argocd-cm + app.kubernetes.io/part-of: argocd + name: argocd-cm + namespace: argocd +data: + resource.customizations: | + networking.k8s.io/Ingress: + health.lua: | + hs = {} + hs.status = "Healthy" + return hs + kustomize.buildOptions: --enable-helm diff --git a/argocd/overlays/prod/argocd-repo-server-deployment.yaml b/argocd/overlays/prod/argocd-repo-server-deployment.yaml new file mode 100644 index 0000000..13571ab --- /dev/null +++ b/argocd/overlays/prod/argocd-repo-server-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: repo-server + app.kubernetes.io/name: argocd-repo-server + app.kubernetes.io/part-of: argocd + name: argocd-repo-server + namespace: argocd +spec: + template: + metadata: + labels: + app.kubernetes.io/name: argocd-repo-server + spec: + containers: + - name: argocd-repo-server + env: + - name: ARGOCD_EXEC_TIMEOUT + value: "300s" + diff --git a/argocd/overlays/prod/argocd-server-deployment.yaml b/argocd/overlays/prod/argocd-server-deployment.yaml new file mode 100644 index 0000000..47e8f41 --- /dev/null +++ b/argocd/overlays/prod/argocd-server-deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: server + app.kubernetes.io/name: argocd-server + app.kubernetes.io/part-of: argocd + name: argocd-server + namespace: argocd +spec: + template: + metadata: + labels: + app.kubernetes.io/name: argocd-server + spec: + containers: + - args: + - /usr/local/bin/argocd-server + - --insecure + - --redis + - "argocd-redis-ha-haproxy:6379" + name: argocd-server diff --git a/argocd/overlays/prod/kustomization.yaml b/argocd/overlays/prod/kustomization.yaml new file mode 100644 index 0000000..72efb0e --- /dev/null +++ b/argocd/overlays/prod/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patches: +- path: argocd-server-deployment.yaml +- path: argocd-repo-server-deployment.yaml +- path: argocd-cm.yaml diff --git a/argocd/overlays/test/argocd-cm.yaml b/argocd/overlays/test/argocd-cm.yaml new file mode 100644 index 0000000..85b88a9 --- /dev/null +++ b/argocd/overlays/test/argocd-cm.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app.kubernetes.io/instance: argocd + app.kubernetes.io/name: argocd-cm + app.kubernetes.io/part-of: argocd + name: argocd-cm + namespace: argocd +data: + resource.customizations: | + networking.k8s.io/Ingress: + health.lua: | + hs = {} + hs.status = "Healthy" + return hs + kustomize.buildOptions: --enable-helm diff --git a/argocd/overlays/test/argocd-repo-server-deployment.yaml b/argocd/overlays/test/argocd-repo-server-deployment.yaml new file mode 100644 index 0000000..13571ab --- /dev/null +++ b/argocd/overlays/test/argocd-repo-server-deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: repo-server + app.kubernetes.io/name: argocd-repo-server + app.kubernetes.io/part-of: argocd + name: argocd-repo-server + namespace: argocd +spec: + template: + metadata: + labels: + app.kubernetes.io/name: argocd-repo-server + spec: + containers: + - name: argocd-repo-server + env: + - name: ARGOCD_EXEC_TIMEOUT + value: "300s" + diff --git a/argocd/overlays/test/argocd-server-deployment.yaml b/argocd/overlays/test/argocd-server-deployment.yaml new file mode 100644 index 0000000..47e8f41 --- /dev/null +++ b/argocd/overlays/test/argocd-server-deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app.kubernetes.io/component: server + app.kubernetes.io/name: argocd-server + app.kubernetes.io/part-of: argocd + name: argocd-server + namespace: argocd +spec: + template: + metadata: + labels: + app.kubernetes.io/name: argocd-server + spec: + containers: + - args: + - /usr/local/bin/argocd-server + - --insecure + - --redis + - "argocd-redis-ha-haproxy:6379" + name: argocd-server diff --git a/argocd/overlays/test/kustomization.yaml b/argocd/overlays/test/kustomization.yaml new file mode 100644 index 0000000..72efb0e --- /dev/null +++ b/argocd/overlays/test/kustomization.yaml @@ -0,0 +1,8 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../../base +patches: +- path: argocd-server-deployment.yaml +- path: argocd-repo-server-deployment.yaml +- path: argocd-cm.yaml diff --git a/bump-tag b/bump-tag new file mode 100755 index 0000000..75e5c2f --- /dev/null +++ b/bump-tag @@ -0,0 +1,57 @@ +#!/bin/bash + +set -e + +echo "Fetching any updates from server:" +git pull +echo "" + +if [[ -z ${1} ]]; then + deftag=$(basename "${PWD}") +else + deftag="${1}" +fi +tagpfx=${tag:="${deftag}"} + +last_tag=$(git tag -l "${tagpfx}-*" | sort | tail -1) + +echo "Verifying last tag ${last_tag}:" +(git tag -v "${last_tag}" | grep ^gpg:) || true +# again to not mask exit status of git with grep +git tag -v "${last_tag}" >/dev/null 2>&1 +echo "" + +echo "Differences between tag ${last_tag} and what you are about to sign:" +env PAGER=cat git diff --color "${last_tag}..main" + +iter=1 +ok= +while test -z "$ok"; do + this_tag=$(date "+${tagpfx}-%Y-%m-%d-v$(printf "%02d" ${iter})") + iter=$(( iter + 1)) + case $( ( + echo "${this_tag}" + echo "${last_tag}" + ) | sort | tail -1) in + "${last_tag}") ;; + + "${this_tag}") + ok=yes + ;; + esac +done + +if [ "${deftag}" != "${tagpfx}" ]; then + echo -e "Using new tag \e[94m${this_tag}\e[0m according to pattern in cosmos.conf" +else + echo -e "Using new tag \e[94m${this_tag}\e[0m" +fi + +echo -e "\e[1mONLY SIGN IF YOU APPROVE OF VERIFICATION AND DIFF ABOVE\e[0m" + +# GITTAGEXTRA is for putting things like "-u 2117364A" +# shellcheck disable=SC2086 +git tag ${GITTAGEXTRA} -s "${this_tag}" -m bump. + +git push +git push --tags