From 1cb03b03581e131ead8a57a0da72c584b6f9adc8 Mon Sep 17 00:00:00 2001 From: "roi.kramer" Date: Mon, 2 May 2022 11:11:02 +0300 Subject: [PATCH] wip --- csdp/hybrid/appset.yaml | 109 -------------------------------- csdp/hybrid/kustomization.yaml | 34 +++------- csdp/managed/appset.yaml | 109 -------------------------------- csdp/managed/kustomization.yaml | 38 +++-------- 4 files changed, 20 insertions(+), 270 deletions(-) delete mode 100644 csdp/hybrid/appset.yaml delete mode 100644 csdp/managed/appset.yaml diff --git a/csdp/hybrid/appset.yaml b/csdp/hybrid/appset.yaml deleted file mode 100644 index 6331f92..0000000 --- a/csdp/hybrid/appset.yaml +++ /dev/null @@ -1,109 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: AppProject -metadata: - annotations: - argocd.argoproj.io/sync-options: PruneLast=true - argocd.argoproj.io/sync-wave: "-2" - creationTimestamp: null - name: csdp - namespace: default # replace -spec: - clusterResourceWhitelist: - - group: "*" - kind: "*" - description: csdp project - destinations: - - namespace: "*" - server: "*" - namespaceResourceWhitelist: - - group: "*" - kind: "*" - sourceRepos: - - "*" - ---- -apiVersion: argoproj.io/v1alpha1 -kind: ApplicationSet -metadata: - annotations: - argocd.argoproj.io/sync-wave: "0" - name: csdp - namespace: default # replace -spec: - syncPolicy: - preserveResourcesOnDeletion: true - generators: - - git: - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - revision: RUNTIME_VERSION - directories: - - path: csdp/hybrid/* - requeueAfterSeconds: 15 - template: - metadata: - finalizers: - - resources-finalizer.argocd.argoproj.io - spec: - destination: {} - project: "" - source: - repoURL: "" - - git: - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - revision: RUNTIME_VERSION - directories: - - path: csdp/hybrid/argo-cd - requeueAfterSeconds: 15 - template: - metadata: {} - spec: - destination: {} - project: "" - source: - repoURL: "" - - git: - files: - - path: csdp/hybrid/**/config_dir.json - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - requeueAfterSeconds: 15 - revision: RUNTIME_VERSION - template: - metadata: - finalizers: - - resources-finalizer.argocd.argoproj.io - spec: - destination: {} - project: "" - source: - repoURL: "" - directory: - exclude: "{{exclude}}" - include: "{{include}}" - recurse: true - template: - metadata: - labels: - app.kubernetes.io/name: "{{path.basenameNormalized}}" - codefresh.io/entity: "component" - codefresh.io/internal: "true" - name: csdp-{{path.basenameNormalized}} - namespace: default # replace - spec: - destination: - namespace: default # replace - server: "https://kubernetes.default.svc" - ignoreDifferences: - - group: argoproj.io - jsonPointers: - - /status - kind: Application - project: csdp - source: - path: csdp/hybrid/{{path.basenameNormalized}} - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - targetRevision: RUNTIME_VERSION # replace with runtime version - syncPolicy: - automated: - allowEmpty: true - prune: true - selfHeal: true diff --git a/csdp/hybrid/kustomization.yaml b/csdp/hybrid/kustomization.yaml index b3be18e..0de1fd2 100644 --- a/csdp/hybrid/kustomization.yaml +++ b/csdp/hybrid/kustomization.yaml @@ -1,28 +1,14 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - appset.yaml + - ../base -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: - - name: csdp-runtime-version - behavior: create - literals: - - version=v0.0.312 - -replacements: - - source: - kind: ConfigMap - name: csdp-runtime-version - fieldPath: data.version - targets: - - select: - kind: ApplicationSet - name: csdp - fieldPaths: - - spec.generators.0.git.revision - - spec.generators.1.git.revision - - spec.generators.2.git.revision - - spec.template.spec.source.targetRevision +patches: + - target: + version: v1alpha1 + group: argoproj.io + kind: ApplicationSet + patch: |- + - op: replace + path: /spec/template/spec/source/path + value: csdp/hybrid/{{path.basenameNormalized}} diff --git a/csdp/managed/appset.yaml b/csdp/managed/appset.yaml deleted file mode 100644 index 1d760b7..0000000 --- a/csdp/managed/appset.yaml +++ /dev/null @@ -1,109 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: AppProject -metadata: - annotations: - argocd.argoproj.io/sync-options: PruneLast=true - argocd.argoproj.io/sync-wave: "-2" - creationTimestamp: null - name: csdp - namespace: default # replace -spec: - clusterResourceWhitelist: - - group: "*" - kind: "*" - description: csdp project - destinations: - - namespace: "*" - server: "*" - namespaceResourceWhitelist: - - group: "*" - kind: "*" - sourceRepos: - - "*" - ---- -apiVersion: argoproj.io/v1alpha1 -kind: ApplicationSet -metadata: - annotations: - argocd.argoproj.io/sync-wave: "0" - name: csdp - namespace: default # replace -spec: - syncPolicy: - preserveResourcesOnDeletion: true - generators: - - git: - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - revision: RUNTIME_VERSION - directories: - - path: csdp/managed/* - requeueAfterSeconds: 15 - template: - metadata: - finalizers: - - resources-finalizer.argocd.argoproj.io - spec: - destination: {} - project: "" - source: - repoURL: "" - - git: - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - revision: RUNTIME_VERSION - directories: - - path: csdp/managed/argo-cd - requeueAfterSeconds: 15 - template: - metadata: {} - spec: - destination: {} - project: "" - source: - repoURL: "" - - git: - files: - - path: csdp/managed/**/config_dir.json - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - requeueAfterSeconds: 15 - revision: RUNTIME_VERSION - template: - metadata: - finalizers: - - resources-finalizer.argocd.argoproj.io - spec: - destination: {} - project: "" - source: - repoURL: "" - directory: - exclude: "{{exclude}}" - include: "{{include}}" - recurse: true - template: - metadata: - labels: - app.kubernetes.io/name: "{{path.basenameNormalized}}" - codefresh.io/entity: "component" - codefresh.io/internal: "true" - name: csdp-{{path.basenameNormalized}} - namespace: default # replace - spec: - destination: - namespace: default # replace - server: "https://kubernetes.default.svc" - ignoreDifferences: - - group: argoproj.io - jsonPointers: - - /status - kind: Application - project: csdp - source: - path: csdp/managed/{{path.basenameNormalized}} - repoURL: https://github.com/codefresh-io/csdp-official-poc.git - targetRevision: RUNTIME_VERSION # replace with runtime version - syncPolicy: - automated: - allowEmpty: true - prune: true - selfHeal: true diff --git a/csdp/managed/kustomization.yaml b/csdp/managed/kustomization.yaml index 0e278c2..f7f0519 100644 --- a/csdp/managed/kustomization.yaml +++ b/csdp/managed/kustomization.yaml @@ -1,32 +1,14 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - appset.yaml + - ../base -generatorOptions: - disableNameSuffixHash: true - -configMapGenerator: - - name: codefresh-cm - behavior: create - options: - labels: - app.kubernetes.io/managed-by: codefresh - codefresh.io/entity: runtimeDef - literals: - - version=v0.0.313 - -replacements: - - source: - kind: ConfigMap - name: codefresh-cm - fieldPath: data.version - targets: - - select: - kind: ApplicationSet - name: csdp - fieldPaths: - - spec.generators.0.git.revision - - spec.generators.1.git.revision - - spec.generators.2.git.revision - - spec.template.spec.source.targetRevision +patches: + - target: + version: v1alpha1 + group: argoproj.io + kind: ApplicationSet + patch: |- + - op: replace + path: /spec/template/spec/source/path + value: csdp/managed/{{path.basenameNormalized}}