From 221e1b8bcee8ce75f514d02794e43cfcc6a06920 Mon Sep 17 00:00:00 2001 From: Edward Cheng Date: Mon, 15 Jul 2024 01:43:04 +1000 Subject: [PATCH] refactor --- .../ingress-nginx/base/kustomization.yaml | 0 .../ingress-nginx/base/values.yaml | 0 .../ingress-nginx/env/k3s-cluster/config.json | 0 .../env/k3s-cluster/configmap.yaml | 0 .../env/k3s-cluster/kustomization.yaml | 0 .../ingress-nginx/env/k3s-cluster/values.yaml | 0 ...{k3s-cluster.yaml => k3s-cluster-app.yaml} | 25 +------ projects/k3s-cluster-infra.yaml | 69 +++++++++++++++++++ projects/k3s-cluster-res.yaml | 69 +++++++++++++++++++ projects/proj.yaml | 22 ++++++ 10 files changed, 162 insertions(+), 23 deletions(-) rename {apps => infrastructures}/ingress-nginx/base/kustomization.yaml (100%) rename {apps => infrastructures}/ingress-nginx/base/values.yaml (100%) rename {apps => infrastructures}/ingress-nginx/env/k3s-cluster/config.json (100%) rename {apps => infrastructures}/ingress-nginx/env/k3s-cluster/configmap.yaml (100%) rename {apps => infrastructures}/ingress-nginx/env/k3s-cluster/kustomization.yaml (100%) rename {apps => infrastructures}/ingress-nginx/env/k3s-cluster/values.yaml (100%) rename projects/{k3s-cluster.yaml => k3s-cluster-app.yaml} (79%) create mode 100644 projects/k3s-cluster-infra.yaml create mode 100644 projects/k3s-cluster-res.yaml create mode 100644 projects/proj.yaml diff --git a/apps/ingress-nginx/base/kustomization.yaml b/infrastructures/ingress-nginx/base/kustomization.yaml similarity index 100% rename from apps/ingress-nginx/base/kustomization.yaml rename to infrastructures/ingress-nginx/base/kustomization.yaml diff --git a/apps/ingress-nginx/base/values.yaml b/infrastructures/ingress-nginx/base/values.yaml similarity index 100% rename from apps/ingress-nginx/base/values.yaml rename to infrastructures/ingress-nginx/base/values.yaml diff --git a/apps/ingress-nginx/env/k3s-cluster/config.json b/infrastructures/ingress-nginx/env/k3s-cluster/config.json similarity index 100% rename from apps/ingress-nginx/env/k3s-cluster/config.json rename to infrastructures/ingress-nginx/env/k3s-cluster/config.json diff --git a/apps/ingress-nginx/env/k3s-cluster/configmap.yaml b/infrastructures/ingress-nginx/env/k3s-cluster/configmap.yaml similarity index 100% rename from apps/ingress-nginx/env/k3s-cluster/configmap.yaml rename to infrastructures/ingress-nginx/env/k3s-cluster/configmap.yaml diff --git a/apps/ingress-nginx/env/k3s-cluster/kustomization.yaml b/infrastructures/ingress-nginx/env/k3s-cluster/kustomization.yaml similarity index 100% rename from apps/ingress-nginx/env/k3s-cluster/kustomization.yaml rename to infrastructures/ingress-nginx/env/k3s-cluster/kustomization.yaml diff --git a/apps/ingress-nginx/env/k3s-cluster/values.yaml b/infrastructures/ingress-nginx/env/k3s-cluster/values.yaml similarity index 100% rename from apps/ingress-nginx/env/k3s-cluster/values.yaml rename to infrastructures/ingress-nginx/env/k3s-cluster/values.yaml diff --git a/projects/k3s-cluster.yaml b/projects/k3s-cluster-app.yaml similarity index 79% rename from projects/k3s-cluster.yaml rename to projects/k3s-cluster-app.yaml index bbf4b61..3987395 100644 --- a/projects/k3s-cluster.yaml +++ b/projects/k3s-cluster-app.yaml @@ -1,31 +1,10 @@ apiVersion: argoproj.io/v1alpha1 -kind: AppProject -metadata: - creationTimestamp: null - name: k3s-cluster - namespace: argocd -spec: - clusterResourceWhitelist: - - group: '*' - kind: '*' - description: k3s-cluster project - destinations: - - namespace: '*' - server: '*' - namespaceResourceWhitelist: - - group: '*' - kind: '*' - sourceRepos: - - '*' -status: {} ---- -apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: annotations: - argocd.argoproj.io/sync-wave: "0" + argocd.argoproj.io/sync-wave: "4" creationTimestamp: null - name: k3s-cluster + name: applications namespace: argocd spec: generators: diff --git a/projects/k3s-cluster-infra.yaml b/projects/k3s-cluster-infra.yaml new file mode 100644 index 0000000..e09f6aa --- /dev/null +++ b/projects/k3s-cluster-infra.yaml @@ -0,0 +1,69 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + annotations: + argocd.argoproj.io/sync-wave: "3" + creationTimestamp: null + name: infrastructures + namespace: argocd +spec: + generators: + - git: + files: + - path: infrastructures/**/k3s-cluster/config.json + repoURL: https://github.com/3dwardch3ng/home-cluster-ops.git + requeueAfterSeconds: 20 + revision: "" + template: + metadata: {} + spec: + destination: {} + project: "" + source: + repoURL: "" + - git: + files: + - path: infrastructures/**/k3s-cluster/config_dir.json + repoURL: https://github.com/3dwardch3ng/home-cluster-ops.git + requeueAfterSeconds: 20 + revision: "" + template: + metadata: {} + spec: + destination: {} + project: "" + source: + directory: + exclude: '{{ exclude }}' + include: '{{ include }}' + jsonnet: {} + recurse: true + repoURL: "" + syncPolicy: {} + template: + metadata: + labels: + app.kubernetes.io/managed-by: argocd + app.kubernetes.io/name: '{{ appName }}' + name: '{{ userGivenName }}' + namespace: argocd + spec: + destination: + namespace: '{{ destNamespace }}' + server: '{{ destServer }}' + ignoreDifferences: + - group: argoproj.io + jsonPointers: + - /status + kind: Application + project: k3s-cluster + source: + path: '{{ srcPath }}' + repoURL: '{{ srcRepoURL }}' + targetRevision: '{{ srcTargetRevision }}' + syncPolicy: + automated: + allowEmpty: true + prune: true + selfHeal: true +status: {} \ No newline at end of file diff --git a/projects/k3s-cluster-res.yaml b/projects/k3s-cluster-res.yaml new file mode 100644 index 0000000..1d4383c --- /dev/null +++ b/projects/k3s-cluster-res.yaml @@ -0,0 +1,69 @@ +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + annotations: + argocd.argoproj.io/sync-wave: "2" + creationTimestamp: null + name: resources + namespace: argocd +spec: + generators: + - git: + files: + - path: resources/**/k3s-cluster/config.json + repoURL: https://github.com/3dwardch3ng/home-cluster-ops.git + requeueAfterSeconds: 20 + revision: "" + template: + metadata: {} + spec: + destination: {} + project: "" + source: + repoURL: "" + - git: + files: + - path: apps/**/k3s-cluster/config_dir.json + repoURL: https://github.com/3dwardch3ng/home-cluster-ops.git + requeueAfterSeconds: 20 + revision: "" + template: + metadata: {} + spec: + destination: {} + project: "" + source: + directory: + exclude: '{{ exclude }}' + include: '{{ include }}' + jsonnet: {} + recurse: true + repoURL: "" + syncPolicy: {} + template: + metadata: + labels: + app.kubernetes.io/managed-by: argocd + app.kubernetes.io/name: '{{ appName }}' + name: '{{ userGivenName }}' + namespace: argocd + spec: + destination: + namespace: '{{ destNamespace }}' + server: '{{ destServer }}' + ignoreDifferences: + - group: argoproj.io + jsonPointers: + - /status + kind: Application + project: k3s-cluster + source: + path: '{{ srcPath }}' + repoURL: '{{ srcRepoURL }}' + targetRevision: '{{ srcTargetRevision }}' + syncPolicy: + automated: + allowEmpty: true + prune: true + selfHeal: true +status: {} \ No newline at end of file diff --git a/projects/proj.yaml b/projects/proj.yaml new file mode 100644 index 0000000..2c954c6 --- /dev/null +++ b/projects/proj.yaml @@ -0,0 +1,22 @@ +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + annotations: + argocd.argoproj.io/sync-wave: "1" + creationTimestamp: null + name: k3s-cluster + namespace: argocd +spec: + clusterResourceWhitelist: + - group: '*' + kind: '*' + description: k3s-cluster project + destinations: + - namespace: '*' + server: '*' + namespaceResourceWhitelist: + - group: '*' + kind: '*' + sourceRepos: + - '*' +status: {} \ No newline at end of file