apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: nextgen-mattermost
  namespace: argocd
spec:
  project: default
  source:
    repoURL: http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform..git
    targetRevision: HEAD
    path: k8s/nextgen
  destination:
    server: https://kubernetes.default.svc
    namespace: nextgen
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
      - Validate=false
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: nextgen-infisical
  namespace: argocd
spec:
  project: default
  sources:
    - repoURL: https://dl.cloudsmith.io/public/infisical/helm-charts/helm/charts/
      chart: infisical-standalone
      targetRevision: 1.8.0
      helm:
        valueFiles:
          - $values/k8s/nextgen/40-infisical-values.yaml
    - repoURL: http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform..git
      targetRevision: HEAD
      ref: values
  destination:
    server: https://kubernetes.default.svc
    namespace: nextgen
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: next-gen-main
  namespace: argocd
spec:
  project: default
  source:
    repoURL: http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform..git
    targetRevision: HEAD
    path: k8s/nextgen/next-gen-chart
    helm:
      parameters:
        - name: branchName
          value: main
        - name: ingress.host
          value: next-gen.techarvest.co.zw
  destination:
    server: https://kubernetes.default.svc
    namespace: nextgen
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: next-gen-branches
  namespace: argocd
spec:
  generators:
    - list:
        elements:
          - branch: main
          - branch: dev

  template:
    metadata:
      name: 'next-gen-{{branch}}'
    spec:
      project: default
      source:
        repoURL: http://gitea.geocrop.svc.cluster.local:3000/fchinembiri/geocrop-platform..git
        targetRevision: HEAD
        path: k8s/nextgen/next-gen-chart
        helm:
          parameters:
            - name: branchName
              value: '{{branch}}'
            - name: ingress.host
              value: '{{branch}}.next-gen.techarvest.co.zw'
      destination:
        server: https://kubernetes.default.svc
        namespace: nextgen
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
