From 0e018aac829e3e3397fa09bfab9da0fb26a7e6ea Mon Sep 17 00:00:00 2001 From: Massaki Archambault Date: Wed, 1 Mar 2023 13:35:08 -0500 Subject: [PATCH] switch back to client-side apply --- Makefile | 16 +++++++++------- .../bundle/kustomization.yaml | 12 ++++++++++++ .../bundle/patches/alertmanagerconfigs.yaml | 5 +++++ .../bundle/patches/alertmanagers.yaml | 5 +++++ .../bundle/patches/podmonitors.yaml | 5 +++++ .../bundle/patches/probes.yaml | 5 +++++ .../bundle/patches/prometheuses.yaml | 5 +++++ .../bundle/patches/prometheusrules.yaml | 5 +++++ .../bundle/patches/servicemonitors.yaml | 5 +++++ .../bundle/patches/thanosrulers.yaml | 5 +++++ .../bases/prometheus-operator/kustomization.yaml | 3 ++- kustomize/bases/prometheus/prometheus.yaml | 2 +- .../prometheus/prometheus-additional.yaml | 3 ++- 13 files changed, 66 insertions(+), 10 deletions(-) create mode 100644 kustomize/bases/prometheus-operator/bundle/kustomization.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/probes.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml create mode 100644 kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml diff --git a/Makefile b/Makefile index 0e819c1..0f29bd5 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,10 @@ KUSTOMIZEFLAGS = KUBECTL = kubectl KUBECTLFLAGS = -KUBECTLDIFFFLAGS = --server-side=true --force-conflicts -KUBECTLAPPLYFLAGS = --server-side=true --force-conflicts --prune +KUBECTLDIFFFLAGS = +KUBECTLDIFFPRINTER = highlight --out-format xterm256 --syntax diff +KUBECTLAPPLYFLAGS = --prune +KUBECTLAPPLYPRINTER = sed -E -e 's/(.+configured)/\o033[32m\1\o033[0m/g' -e 's/(.+pruned)/\o033[31m\1\o033[0m/g' SRC := $(shell find kustomize/ -type f) OUT = build @@ -13,15 +15,15 @@ PRODOUT = $(OUT)/prod.yaml PRODSRC = kustomize/env/prod .PHONY: prod -prod: prod-diff +prod: diff .PHONY: diff -prod-diff: $(PRODOUT) - $(KUBECTL) $(KUBECTLFLAGS) diff $(KUBECTLDIFFFLAGS) -f $(PRODOUT) | highlight --out-format xterm256 --syntax diff +diff: $(PRODOUT) + $(KUBECTL) $(KUBECTLFLAGS) diff $(KUBECTLDIFFFLAGS) -f $(PRODOUT) | $(KUBECTLDIFFCOLOR) .PHONY: apply -prod-apply: $(PRODOUT) - $(KUBECTL) $(KUBECTLFLAGS) apply $(KUBECTLAPPLYFLAGS) -l app.kubernetes.io/managed-by=kustomize -f $(PRODOUT) +apply: $(PRODOUT) + $(KUBECTL) $(KUBECTLFLAGS) apply $(KUBECTLAPPLYFLAGS) -l app.kubernetes.io/managed-by=kustomize -f $(PRODOUT) | $(KUBECTLAPPLYPRINTER) $(PRODOUT): $(SRC) mkdir -p $(OUT) diff --git a/kustomize/bases/prometheus-operator/bundle/kustomization.yaml b/kustomize/bases/prometheus-operator/bundle/kustomization.yaml new file mode 100644 index 0000000..cb9e226 --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.63.0/bundle.yaml + +patches: + - path: patches/alertmanagerconfigs.yaml + - path: patches/alertmanagers.yaml + - path: patches/podmonitors.yaml + - path: patches/probes.yaml + - path: patches/prometheuses.yaml + - path: patches/prometheusrules.yaml + - path: patches/servicemonitors.yaml + - path: patches/thanosrulers.yaml \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml b/kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml new file mode 100644 index 0000000..4ecfc2c --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/alertmanagerconfigs.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: alertmanagerconfigs.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml b/kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml new file mode 100644 index 0000000..cb8dad9 --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/alertmanagers.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: alertmanagers.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml b/kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml new file mode 100644 index 0000000..7ab9b1a --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/podmonitors.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: podmonitors.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/probes.yaml b/kustomize/bases/prometheus-operator/bundle/patches/probes.yaml new file mode 100644 index 0000000..5aa9bde --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/probes.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: probes.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml b/kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml new file mode 100644 index 0000000..0e2c6a3 --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/prometheuses.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: prometheuses.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml b/kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml new file mode 100644 index 0000000..7d6399a --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/prometheusrules.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: prometheusrules.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml b/kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml new file mode 100644 index 0000000..c9005bf --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/servicemonitors.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: servicemonitors.monitoring.coreos.com \ No newline at end of file diff --git a/kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml b/kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml new file mode 100644 index 0000000..0cdb537 --- /dev/null +++ b/kustomize/bases/prometheus-operator/bundle/patches/thanosrulers.yaml @@ -0,0 +1,5 @@ +$patch: delete +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: thanosrulers.monitoring.coreos.com diff --git a/kustomize/bases/prometheus-operator/kustomization.yaml b/kustomize/bases/prometheus-operator/kustomization.yaml index 22e64e1..204dcb4 100644 --- a/kustomize/bases/prometheus-operator/kustomization.yaml +++ b/kustomize/bases/prometheus-operator/kustomization.yaml @@ -1,5 +1,6 @@ resources: - - https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.63.0/bundle.yaml + - bundle/ + - https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.63.0/stripped-down-crds.yaml namespace: kube-system diff --git a/kustomize/bases/prometheus/prometheus.yaml b/kustomize/bases/prometheus/prometheus.yaml index 0c46c96..5a2008d 100644 --- a/kustomize/bases/prometheus/prometheus.yaml +++ b/kustomize/bases/prometheus/prometheus.yaml @@ -40,7 +40,7 @@ spec: cpu: 2000m memory: 2Gi limits: - cpu: 3000m + cpu: 2000m memory: 2Gi storage: volumeClaimTemplate: diff --git a/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml b/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml index ad0941e..da94e1c 100644 --- a/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml +++ b/kustomize/env/prod/configurations/prometheus/prometheus-additional.yaml @@ -1,3 +1,4 @@ - job_name: additional/bastion-haproxy static_configs: - - targets: ["192.168.20.10:8080"] \ No newline at end of file + - targets: ["192.168.20.10:8080"] + \ No newline at end of file