From 93253958768f1c5888fa36068c8315d3d7f1e601 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Tue, 14 Jan 2025 15:11:40 +0000 Subject: [PATCH] feat: Add HA harbor database --- services/harbor/1.16.0/database.yaml | 33 +++++++++++++++++++ services/harbor/1.16.0/database/cluster.yaml | 33 +++++++++++++++++++ .../harbor/1.16.0/database/kustomization.yaml | 4 +++ services/harbor/1.16.0/defaults/database.yaml | 18 ++++++++++ .../1.16.0/defaults/{cm.yaml => harbor.yaml} | 8 ++++- .../harbor/1.16.0/defaults/kustomization.yaml | 3 +- services/harbor/1.16.0/kustomization.yaml | 1 + services/harbor/1.16.0/release.yaml | 1 + .../harbor/1.16.0/release/kustomization.yaml | 4 +++ 9 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 services/harbor/1.16.0/database.yaml create mode 100644 services/harbor/1.16.0/database/cluster.yaml create mode 100644 services/harbor/1.16.0/database/kustomization.yaml create mode 100644 services/harbor/1.16.0/defaults/database.yaml rename services/harbor/1.16.0/defaults/{cm.yaml => harbor.yaml} (82%) create mode 100644 services/harbor/1.16.0/release/kustomization.yaml diff --git a/services/harbor/1.16.0/database.yaml b/services/harbor/1.16.0/database.yaml new file mode 100644 index 0000000000..0a759cb2ee --- /dev/null +++ b/services/harbor/1.16.0/database.yaml @@ -0,0 +1,33 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: harbor-database + namespace: ${releaseNamespace} +spec: + force: false + prune: true + wait: true + interval: 6h + retryInterval: 1m + path: ./services/harbor/1.16.0/database + dependsOn: + - name: ncr-system-namespace + - name: cloudnative-pg + sourceRef: + kind: GitRepository + name: management + namespace: kommander-flux + timeout: 1m + postBuild: + substituteFrom: + - kind: ConfigMap + name: substitution-vars + healthChecks: + - apiVersion: helm.toolkit.fluxcd.io/v2 + kind: HelmRelease + name: harbor-database + namespace: ${releaseNamespace} + - apiVersion: postgresql.cnpg.io + kind: Cluster + name: harbor-database-cluster + namespace: ${releaseNamespace} diff --git a/services/harbor/1.16.0/database/cluster.yaml b/services/harbor/1.16.0/database/cluster.yaml new file mode 100644 index 0000000000..bd7f1060a9 --- /dev/null +++ b/services/harbor/1.16.0/database/cluster.yaml @@ -0,0 +1,33 @@ +--- + apiVersion: helm.toolkit.fluxcd.io/v2 + kind: HelmRelease + metadata: + name: harbor-database + namespace: ${releaseNamespace} + spec: + chart: + spec: + chart: cluster + sourceRef: + kind: HelmRepository + name: cloudnative-pg.github.io-charts + namespace: kommander-flux + version: 0.2.0 + interval: 15s + install: + crds: CreateReplace + remediation: + retries: 30 + upgrade: + crds: CreateReplace + remediation: + retries: 30 + timeout: 5m0s + releaseName: harbor-database + targetNamespace: ncr-system + valuesFrom: + - kind: ConfigMap + name: harbor-database-0.2.0-d2iq-defaults + - kind: ConfigMap + name: harbor-database-overrides + optional: true diff --git a/services/harbor/1.16.0/database/kustomization.yaml b/services/harbor/1.16.0/database/kustomization.yaml new file mode 100644 index 0000000000..993fbde1d6 --- /dev/null +++ b/services/harbor/1.16.0/database/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - cluster.yaml diff --git a/services/harbor/1.16.0/defaults/database.yaml b/services/harbor/1.16.0/defaults/database.yaml new file mode 100644 index 0000000000..3d0d34f68a --- /dev/null +++ b/services/harbor/1.16.0/defaults/database.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: harbor-database-0.2.0-d2iq-defaults + namespace: ${releaseNamespace} +data: + values.yaml: | + --- + type: postgresql + mode: standalone + cluster: + instances: 3 + storage: + size: 10Gi + initdb: + database: harbor + backups: + enabled: false diff --git a/services/harbor/1.16.0/defaults/cm.yaml b/services/harbor/1.16.0/defaults/harbor.yaml similarity index 82% rename from services/harbor/1.16.0/defaults/cm.yaml rename to services/harbor/1.16.0/defaults/harbor.yaml index 264bc5c2b0..a2a0b06945 100644 --- a/services/harbor/1.16.0/defaults/cm.yaml +++ b/services/harbor/1.16.0/defaults/harbor.yaml @@ -29,7 +29,13 @@ data: type: internal database: - type: internal + type: external + external: + host: "harbor-database-cluster-rw" + port: "5432" + username: "harbor" + coreDatabase: "harbor" + existingSecret: "harbor-database-cluster-app" core: priorityClassName: dkp-critical-priority diff --git a/services/harbor/1.16.0/defaults/kustomization.yaml b/services/harbor/1.16.0/defaults/kustomization.yaml index 77c753a51a..bc91e7e7f7 100644 --- a/services/harbor/1.16.0/defaults/kustomization.yaml +++ b/services/harbor/1.16.0/defaults/kustomization.yaml @@ -1,4 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - cm.yaml + - harbor.yaml + - database.yaml diff --git a/services/harbor/1.16.0/kustomization.yaml b/services/harbor/1.16.0/kustomization.yaml index b6f4462aa6..2face1db09 100644 --- a/services/harbor/1.16.0/kustomization.yaml +++ b/services/harbor/1.16.0/kustomization.yaml @@ -4,3 +4,4 @@ resources: - release.yaml - ncr-system-namespace.yaml - pre-install.yaml + - database.yaml diff --git a/services/harbor/1.16.0/release.yaml b/services/harbor/1.16.0/release.yaml index 0b83c3d486..298cd340c5 100644 --- a/services/harbor/1.16.0/release.yaml +++ b/services/harbor/1.16.0/release.yaml @@ -13,6 +13,7 @@ spec: dependsOn: - name: ncr-system-namespace - name: harbor-pre-install + - name: harbor-database sourceRef: kind: GitRepository name: management diff --git a/services/harbor/1.16.0/release/kustomization.yaml b/services/harbor/1.16.0/release/kustomization.yaml new file mode 100644 index 0000000000..62caead8ae --- /dev/null +++ b/services/harbor/1.16.0/release/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - harbor.yaml