Skip to content

Commit

Permalink
[kube-prometheus-stack] Use kubectl replace to upgrade prometheuses CRD
Browse files Browse the repository at this point in the history
Fixes prometheus-community#1500

Signed-off-by: Mathieu Parent <[email protected]>
  • Loading branch information
sathieu committed Nov 17, 2021
1 parent 09b3de4 commit 3b79239
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 20.0.1
version: 20.1.0
appVersion: 0.52.0
kubeVersion: ">=1.16.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheu
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
kubectl replace -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.52.0/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml
Expand Down
1 change: 1 addition & 0 deletions charts/kube-prometheus-stack/crds/crd-prometheuses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
argocd.argoproj.io/sync-options: Replace=true
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: prometheuses.monitoring.coreos.com
Expand Down
6 changes: 5 additions & 1 deletion charts/kube-prometheus-stack/hack/update_crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,9 @@ for line in "${FILES[@]}" ; do
URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE"
echo "# ${URL}" > ../crds/"${DESTINATION}"
curl -L "${URL}" >> ../crds/"${DESTINATION}"

# CRD is too long
# https://github.com/prometheus-community/helm-charts/issues/1500
if [ "$SOURCE" = monitoring.coreos.com_prometheuses.yaml ]; then
sed -i 's@^ annotations:@ annotations:\n argocd.argoproj.io/sync-options: Replace=true@' ../crds/"${DESTINATION}"
fi
done

0 comments on commit 3b79239

Please sign in to comment.