apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- chart/upstream.yaml
- argocd-redis-ha-proxy-network-policy.yaml
- argocd-redis-ha-server-network-policy.yaml

patchesJson6902:
- target:
    version: v1
    group: ""
    kind: ConfigMap
    name: argocd-redis-ha-health-configmap
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: ConfigMap
    name: argocd-redis-ha-configmap
    namespace: argocd
  path: overlays/remove-namespace.yaml  
- target:
    version: v1
    group: ""
    kind: ServiceAccount
    name: argocd-redis-ha
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: ServiceAccount
    name: argocd-redis-ha-haproxy
    namespace: argocd
  path: overlays/remove-namespace.yaml 
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: Role
    name: argocd-redis-ha
    namespace: argocd
  path: overlays/remove-namespace.yaml 
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: Role
    name: argocd-redis-ha-haproxy
    namespace: argocd
  path: overlays/remove-namespace.yaml 
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: RoleBinding
    name: argocd-redis-ha
    namespace: argocd
  path: overlays/remove-namespace.yaml      
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: RoleBinding
    name: argocd-redis-ha-haproxy
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-0
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-1
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-2
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-haproxy
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    group: apps
    version: v1
    kind: Deployment
    name: argocd-redis-ha-haproxy
    namespace: argocd
  path: overlays/remove-namespace.yaml
- target:
    group: apps
    version: v1
    kind: StatefulSet
    name: argocd-redis-ha-server
    namespace: argocd
  path: overlays/remove-namespace.yaml

# Replace helm's app/release/chart/heritage labels with argocd common labels
- target:
    version: v1
    group: ""
    kind: ConfigMap
    name: argocd-redis-ha-health-configmap
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: ConfigMap
    name: argocd-redis-ha-configmap
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-0
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-1
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-2
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha
  path: overlays/modify-labels.yaml
- target:
    group: apps
    version: v1
    kind: StatefulSet
    name: argocd-redis-ha-server
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: ServiceAccount
    name: argocd-redis-ha
  path: overlays/modify-labels.yaml
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: Role
    name: argocd-redis-ha
  path: overlays/modify-labels.yaml
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: Role
    name: argocd-redis-ha-haproxy
  path: overlays/modify-labels.yaml
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: RoleBinding
    name: argocd-redis-ha
  path: overlays/modify-labels.yaml
- target:
    group: rbac.authorization.k8s.io
    version: v1
    kind: RoleBinding
    name: argocd-redis-ha-haproxy
  path: overlays/modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: ServiceAccount
    name: argocd-redis-ha-haproxy
  path: overlays/haproxy-modify-labels.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-haproxy
  path: overlays/haproxy-modify-labels.yaml
- target:
    group: apps
    version: v1
    kind: Deployment
    name: argocd-redis-ha-haproxy
  path: overlays/haproxy-modify-labels.yaml

# add pod template labels
- target:
    group: apps
    version: v1
    kind: StatefulSet
    name: argocd-redis-ha-server
  path: overlays/statefulset-labels.yaml
- target:
    group: apps
    version: v1
    kind: Deployment
    name: argocd-redis-ha-haproxy
  path: overlays/deployment-labels.yaml

# remove pod template nodeSelector
- target:
    group: apps
    version: v1
    kind: Deployment
    name: argocd-redis-ha-haproxy
  path: overlays/deployment-nodeSelector.yaml

# remove pod template tolerations
- target:
    group: apps
    version: v1
    kind: Deployment
    name: argocd-redis-ha-haproxy
  path: overlays/deployment-tolerations.yaml

# remove pod template resources
- target:
    group: apps
    version: v1
    kind: Deployment
    name: argocd-redis-ha-haproxy
  path: overlays/deployment-resources.yaml
- target:
    group: apps
    version: v1
    kind: StatefulSet
    name: argocd-redis-ha-server
  path: overlays/statefulset-resources.yaml

# update service selectors to match
- target:
    version: v1
    kind: Service
    group: ""
    name: argocd-redis-ha-announce-0
  path: overlays/service-selector.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-1
  path: overlays/service-selector.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-announce-2
  path: overlays/service-selector.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha
  path: overlays/service-selector.yaml
- target:
    version: v1
    group: ""
    kind: Service
    name: argocd-redis-ha-haproxy
  path: overlays/haproxy-service-selector.yaml

