From 578cd7b2384a1a1790ed33ddd526f211f79db845 Mon Sep 17 00:00:00 2001 From: shadowlegend Date: Wed, 9 Apr 2025 16:35:38 +0700 Subject: [PATCH] chore: add volume snapshot crd+controller and configure longhorn --- k8s-infra/apps.yml | 65 +++++++++++++++++++++++++++ k8s-infra/default-volume-snapshot.yml | 12 +++++ k8s-infra/kustomization.yml | 4 ++ k8s-infra/postgresql-image.yml | 14 ++++++ 4 files changed, 95 insertions(+) create mode 100644 k8s-infra/default-volume-snapshot.yml create mode 100644 k8s-infra/postgresql-image.yml diff --git a/k8s-infra/apps.yml b/k8s-infra/apps.yml index 616d068..5f030a0 100644 --- a/k8s-infra/apps.yml +++ b/k8s-infra/apps.yml @@ -94,3 +94,68 @@ spec: server: https://kubernetes.default.svc namespace: vector +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: ingress-apisix + namespace: argocd +spec: + syncPolicy: + automated: + selfHeal: true + syncOptions: + - CreateNamespace=true + project: default + sources: + - chart: apisix + repoURL: https://charts.apiseven.com + targetRevision: 2.10.0 + helm: + values: | + ingress-controller: + enabled: true + config: + apisix: + adminAPIVersion: v3 + serviceNamespace: ingress-apisix + destination: + server: https://kubernetes.default.svc + namespace: ingress-apisix + +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: longhorn + namespace: argocd +spec: + syncPolicy: + automated: + selfHeal: true + syncOptions: + - CreateNamespace=true + project: default + sources: + - chart: longhorn + repoURL: https://charts.longhorn.io + targetRevision: v1.8.1 + helm: + values: | + preUpgradeChecker: + jobEnabled: false + + persistence: + defaultFsType: xfs + + defaultDiskSelector: + enable: true + selector: "nvme" + + defaultSettings: + createDefaultDiskLabeledNodes: true + + storageReservedPercentageForDefaultDisk: 8 + destination: + server: https://kubernetes.default.svc + namespace: longhorn-system diff --git a/k8s-infra/default-volume-snapshot.yml b/k8s-infra/default-volume-snapshot.yml new file mode 100644 index 0000000..765abd2 --- /dev/null +++ b/k8s-infra/default-volume-snapshot.yml @@ -0,0 +1,12 @@ +--- +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotClass +metadata: + name: longhorn + annotations: + snapshot.storage.kubernetes.io/is-default-class: "true" + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true +driver: driver.longhorn.io +deletionPolicy: Delete +parameters: + type: bak diff --git a/k8s-infra/kustomization.yml b/k8s-infra/kustomization.yml index 00f22be..1b8e241 100644 --- a/k8s-infra/kustomization.yml +++ b/k8s-infra/kustomization.yml @@ -3,5 +3,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: +- https://github.com/kubernetes-csi/external-snapshotter/tree/v8.2.0/client/config/crd +- https://github.com/kubernetes-csi/external-snapshotter/tree/v8.2.0/deploy/kubernetes/snapshot-controller - apps.yml - https://raw.githubusercontent.com/dragonflydb/dragonfly-operator/main/manifests/dragonfly-operator.yaml +- postgresql-image.yml +- default-volume-snapshot.yml diff --git a/k8s-infra/postgresql-image.yml b/k8s-infra/postgresql-image.yml new file mode 100644 index 0000000..7557505 --- /dev/null +++ b/k8s-infra/postgresql-image.yml @@ -0,0 +1,14 @@ +--- +apiVersion: postgresql.cnpg.io/v1 +kind: ClusterImageCatalog +metadata: + name: postgresql + namespace: default + annotations: + argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true +spec: + images: + - major: 16 + image: ghcr.io/cloudnative-pg/postgresql:16.8 + - major: 17 + image: ghcr.io/cloudnative-pg/postgresql:17.4