diff --git a/charts/prometheus-operator-crds/Chart.yaml b/charts/prometheus-operator-crds/Chart.yaml index 3214f4138d63..2ccfb696bd54 100644 --- a/charts/prometheus-operator-crds/Chart.yaml +++ b/charts/prometheus-operator-crds/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 type: application -version: 19.0.0 +version: 19.1.0 name: prometheus-operator-crds icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/assets/prometheus_logo-cb55bb5c346.png description: | diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagerconfigs.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagerconfigs.yaml index 2e46878b8131..063b6bb48192 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagerconfigs.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagerconfigs.yaml @@ -1,3 +1,4 @@ +{{- if .Values.alertmanagerconfigs.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagerconfigs.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -10039,3 +10040,4 @@ spec: type: object served: true storage: true +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagers.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagers.yaml index 04bd80e8c266..d5138394449a 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagers.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-alertmanagers.yaml @@ -1,3 +1,4 @@ +{{- if .Values.alertmanagers.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -9134,3 +9135,4 @@ spec: specReplicasPath: .spec.replicas statusReplicasPath: .status.replicas status: {} +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-podmonitors.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-podmonitors.yaml index dcb71f7ce51e..137f28266c10 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-podmonitors.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-podmonitors.yaml @@ -1,3 +1,4 @@ +{{- if .Values.podmonitors.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -1209,3 +1210,4 @@ spec: type: object served: true storage: true +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-probes.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-probes.yaml index 05a757756494..82c6e9117880 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-probes.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-probes.yaml @@ -1,3 +1,4 @@ +{{- if .Values.probes.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -1176,3 +1177,4 @@ spec: type: object served: true storage: true +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusagents.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusagents.yaml index 83d820a304f2..fc13b4b14ed8 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusagents.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusagents.yaml @@ -1,3 +1,4 @@ +{{- if .Values.prometheusagents.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheusagents.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -10839,3 +10840,4 @@ spec: specReplicasPath: .spec.shards statusReplicasPath: .status.shards status: {} +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheuses.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheuses.yaml index db9744ee3ac2..44f3178bacd2 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheuses.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheuses.yaml @@ -1,3 +1,4 @@ +{{- if .Values.prometheuses.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -13090,3 +13091,4 @@ spec: specReplicasPath: .spec.shards statusReplicasPath: .status.shards status: {} +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusrules.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusrules.yaml index dd13e8fd2339..5cd528ba2598 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusrules.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-prometheusrules.yaml @@ -1,3 +1,4 @@ +{{- if .Values.prometheusrules.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -161,3 +162,4 @@ spec: type: object served: true storage: true +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-scrapeconfigs.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-scrapeconfigs.yaml index 36c7bd617006..eccbd31226ea 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-scrapeconfigs.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-scrapeconfigs.yaml @@ -1,3 +1,4 @@ +{{- if .Values.scrapeconfigs.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_scrapeconfigs.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -12516,3 +12517,4 @@ spec: type: object served: true storage: true +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-servicemonitors.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-servicemonitors.yaml index 64e19e48b656..bb0c16523cbc 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-servicemonitors.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-servicemonitors.yaml @@ -1,3 +1,4 @@ +{{- if .Values.servicemonitors.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -1231,3 +1232,4 @@ spec: type: object served: true storage: true +{{- end -}} diff --git a/charts/prometheus-operator-crds/charts/crds/templates/crd-thanosrulers.yaml b/charts/prometheus-operator-crds/charts/crds/templates/crd-thanosrulers.yaml index 7ebde855fccf..3e0ec9c260cc 100644 --- a/charts/prometheus-operator-crds/charts/crds/templates/crd-thanosrulers.yaml +++ b/charts/prometheus-operator-crds/charts/crds/templates/crd-thanosrulers.yaml @@ -1,3 +1,4 @@ +{{- if .Values.thanosrulers.enabled -}} # https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.81.0/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml --- apiVersion: apiextensions.k8s.io/v1 @@ -8155,3 +8156,4 @@ spec: storage: true subresources: status: {} +{{- end -}} diff --git a/charts/prometheus-operator-crds/hack/update_crds.sh b/charts/prometheus-operator-crds/hack/update_crds.sh index d950ec163437..bfa576de255a 100755 --- a/charts/prometheus-operator-crds/hack/update_crds.sh +++ b/charts/prometheus-operator-crds/hack/update_crds.sh @@ -1,45 +1,51 @@ #!/bin/bash +set -euo pipefail -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) if [[ $(uname -s) = "Darwin" ]]; then - VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')" + VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion: //g')" else - VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')" + VERSION="$(grep ^appVersion "${SCRIPT_DIR}/../Chart.yaml" | sed 's/appVersion:\s//g')" fi -FILES=( - "crd-alertmanagerconfigs.yaml : monitoring.coreos.com_alertmanagerconfigs.yaml" - "crd-alertmanagers.yaml : monitoring.coreos.com_alertmanagers.yaml" - "crd-podmonitors.yaml : monitoring.coreos.com_podmonitors.yaml" - "crd-probes.yaml : monitoring.coreos.com_probes.yaml" - "crd-prometheusagents.yaml : monitoring.coreos.com_prometheusagents.yaml" - "crd-prometheuses.yaml : monitoring.coreos.com_prometheuses.yaml" - "crd-prometheusrules.yaml : monitoring.coreos.com_prometheusrules.yaml" - "crd-scrapeconfigs.yaml : monitoring.coreos.com_scrapeconfigs.yaml" - "crd-servicemonitors.yaml : monitoring.coreos.com_servicemonitors.yaml" - "crd-thanosrulers.yaml : monitoring.coreos.com_thanosrulers.yaml" +CRDS=( + "alertmanagerconfigs : monitoring.coreos.com_alertmanagerconfigs.yaml" + "alertmanagers : monitoring.coreos.com_alertmanagers.yaml" + "podmonitors : monitoring.coreos.com_podmonitors.yaml" + "probes : monitoring.coreos.com_probes.yaml" + "prometheusagents : monitoring.coreos.com_prometheusagents.yaml" + "prometheuses : monitoring.coreos.com_prometheuses.yaml" + "prometheusrules : monitoring.coreos.com_prometheusrules.yaml" + "scrapeconfigs : monitoring.coreos.com_scrapeconfigs.yaml" + "servicemonitors : monitoring.coreos.com_servicemonitors.yaml" + "thanosrulers : monitoring.coreos.com_thanosrulers.yaml" ) -for line in "${FILES[@]}"; do - DESTINATION=$(echo "${line%%:*}" | xargs) - SOURCE=$(echo "${line##*:}" | xargs) +for line in "${CRDS[@]}"; do + CRD=$(echo "${line%%:*}" | xargs) + SOURCE=$(echo "${line##*:}" | xargs) + DESTINATION="crd-${CRD}".yaml - URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE" + URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE" - echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n" + echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n" - echo "# ${URL}" > "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" + echo "# ${URL}" >"${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" - if ! curl --silent --retry-all-errors --fail --location "${URL}" >> "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"; then - echo -e "Failed to download ${URL}!" - exit 1 - fi + if ! curl --silent --retry-all-errors --fail --location "${URL}" >>"${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}"; then + echo -e "Failed to download ${URL}!" + exit 1 + fi - # Update or insert annotations block - if yq -e '.metadata.annotations' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" >/dev/null; then - sed -i '/^ annotations:$/a {{- with .Values.annotations }}\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" - else - sed -i '/^metadata:$/a {{- with .Values.annotations }}\n annotations:\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" - fi + # Update or insert annotations block + if yq -e '.metadata.annotations' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" >/dev/null; then + sed -i '/^ annotations:$/a {{- with .Values.annotations }}\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" + else + sed -i '/^metadata:$/a {{- with .Values.annotations }}\n annotations:\n{{- toYaml . | nindent 4 }}\n{{- end }}' "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" + fi + + # Insert enable option + sed -i "1i\{{- if .Values.${CRD}.enabled -}}" "${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" + echo "{{- end -}}" >>"${SCRIPT_DIR}/../charts/crds/templates/${DESTINATION}" done diff --git a/charts/prometheus-operator-crds/values.yaml b/charts/prometheus-operator-crds/values.yaml index 7990c631929f..f462daf0e279 100644 --- a/charts/prometheus-operator-crds/values.yaml +++ b/charts/prometheus-operator-crds/values.yaml @@ -1,4 +1,55 @@ -## Annotations for CRDs +## Settings for CRDs ## crds: + ## annotations add additional annotations to all CRDs annotations: {} + + ## alertmanagerconfigs configures the AlertManagerConfig CRD + alertmanagerconfigs: + ## enabled defines if the CRD should be installed + enabled: true + + ## alertmanagers configures the AlertManager CRD + alertmanagers: + ## enabled defines if the CRD should be installed + enabled: true + + ## podmonitors configures the PodMonitor CRD + podmonitors: + ## enabled defines if the CRD should be installed + enabled: true + + ## probes configures the Probe CRD + probes: + ## enabled defines if the CRD should be installed + enabled: true + + ## prometheusagents configures the PrometheusAgent CRD + prometheusagents: + ## enabled defines if the CRD should be installed + enabled: true + + ## prometheuses configures the Prometheus CRD + prometheuses: + ## enabled defines if the CRD should be installed + enabled: true + + ## prometheusrules configures the PrometheusRule CRD + prometheusrules: + ## enabled defines if the CRD should be installed + enabled: true + + ## prometheusrules configures the PrometheusRule CRD + scrapeconfigs: + ## enabled defines if the CRD should be installed + enabled: true + + ## servicemonitors configures the ServiceMonitor CRD + servicemonitors: + ## enabled defines if the CRD should be installed + enabled: true + + ## thanosrulers configures the ThanosRuler CRD + thanosrulers: + ## enabled defines if the CRD should be installed + enabled: true