github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/prometheus-community/kube-prometheus-stack/hack/update_crds.sh (about)

     1  #!/bin/bash
     2  
     3  if [[ $(uname -s) = "Darwin" ]]; then
     4      VERSION="$(grep ^appVersion ../Chart.yaml | sed 's/appVersion: //g')"
     5  else
     6      VERSION="$(grep ^appVersion ../Chart.yaml | sed 's/appVersion:\s//g')"
     7  fi
     8  
     9  FILES=(
    10    "crd-alertmanagerconfigs.yaml :  monitoring.coreos.com_alertmanagerconfigs.yaml"
    11    "crd-alertmanagers.yaml       :  monitoring.coreos.com_alertmanagers.yaml"
    12    "crd-podmonitors.yaml         :  monitoring.coreos.com_podmonitors.yaml"
    13    "crd-probes.yaml              :  monitoring.coreos.com_probes.yaml"
    14    "crd-prometheuses.yaml        :  monitoring.coreos.com_prometheuses.yaml"
    15    "crd-prometheusrules.yaml     :  monitoring.coreos.com_prometheusrules.yaml"
    16    "crd-servicemonitors.yaml     :  monitoring.coreos.com_servicemonitors.yaml"
    17    "crd-thanosrulers.yaml        :  monitoring.coreos.com_thanosrulers.yaml"
    18  )
    19  
    20  for line in "${FILES[@]}"; do
    21      DESTINATION=$(echo "${line%%:*}" | xargs)
    22      SOURCE=$(echo "${line##*:}" | xargs)
    23  
    24      URL="https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/$VERSION/example/prometheus-operator-crd/$SOURCE"
    25  
    26      echo -e "Downloading Prometheus Operator CRD with Version ${VERSION}:\n${URL}\n"
    27  
    28      echo "# ${URL}" > ../crds/"${DESTINATION}"
    29  
    30      if ! curl --silent --retry-all-errors --fail --location "${URL}" >> ../crds/"${DESTINATION}"; then
    31        echo -e "Failed to download ${URL}!"
    32        exit 1
    33      fi
    34  done