---

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


namespace: operators


labels:
  - includeSelectors: true
    pairs:
      app.kubernetes.io/instance: cluster
      app.kubernetes.io/name: prometheus-operator
      app.kubernetes.io/part-of: prometheus-operator


resources:
  - crd/CustomResourceDefinition-prometheusrules.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-scrapeconfigs.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-alertmanagerconfigs.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-servicemonitors.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-alertmanagers.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-thanosrulers.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-podmonitors.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-probes.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-prometheusagents.monitoring.coreos.com.yaml
  - crd/CustomResourceDefinition-prometheuses.monitoring.coreos.com.yaml
  - serviceaccount.yaml
  - clusterrole.yaml
  - clusterrolebinding.yaml
  - deployment.yaml
  - service.yaml


replacements:
  - source:
      kind: Deployment
      name: prometheus-operator
      fieldPath: metadata.namespace
    targets:
      - select:
          kind: ClusterRoleBinding
          name: prometheus-operator

        fieldPaths:
          - subjects.[name=prometheus-operator].namespace


patches:
  # yamllint disable rule:indentation
  - patch: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        annotations:
          argocd.argoproj.io/sync-options: ServerSideApply=true
        name: prometheusagents.monitoring.coreos.com
  - patch: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        annotations:
          argocd.argoproj.io/sync-options: ServerSideApply=true
        name: prometheuses.monitoring.coreos.com
  - patch: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        annotations:
          argocd.argoproj.io/sync-options: ServerSideApply=true
        name: scrapeconfigs.monitoring.coreos.com
  - patch: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        annotations:
          argocd.argoproj.io/sync-options: ServerSideApply=true
        name: thanosrulers.monitoring.coreos.com
  - patch: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        annotations:
          argocd.argoproj.io/sync-options: ServerSideApply=true
        name: alertmanagerconfigs.monitoring.coreos.com
  - patch: |-
      apiVersion: apiextensions.k8s.io/v1
      kind: CustomResourceDefinition
      metadata:
        annotations:
          argocd.argoproj.io/sync-options: ServerSideApply=true
        name: alertmanagers.monitoring.coreos.com
  # yamllint enable rule:indentation
