istio.io/istio@v0.0.0-20240520182934-d79c90f27776/manifests/addons/gen.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # Copyright Istio Authors
     4  #
     5  # Licensed under the Apache License, Version 2.0 (the "License");
     6  # you may not use this file except in compliance with the License.
     7  # You may obtain a copy of the License at
     8  #
     9  #    http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  WD=$(dirname "$0")
    18  WD=$(cd "$WD"; pwd)
    19  
    20  set -eux
    21  
    22  # This script sets up the plain text rendered deployments for addons
    23  # See samples/addons/README.md for more information
    24  
    25  ADDONS="${WD}/../../samples/addons"
    26  DASHBOARDS="${WD}/dashboards"
    27  mkdir -p "${ADDONS}"
    28  TMP=$(mktemp -d)
    29  LOKI_VERSION=${LOKI_VERSION:-"6.0.0"}
    30  GRAFANA_VERSION=${GRAFANA_VERSION:-"7.3.7"}
    31  
    32  # Set up kiali
    33  {
    34  helm3 template kiali-server \
    35    --namespace istio-system \
    36    --version 1.82.0 \
    37    --set deployment.image_version=v1.82 \
    38    --include-crds \
    39    --set nameOverride=kiali \
    40    --set fullnameOverride=kiali \
    41    kiali-server \
    42    --repo https://kiali.org/helm-charts \
    43    -f "${WD}/values-kiali.yaml"
    44  } > "${ADDONS}/kiali.yaml"
    45  
    46  # Set up prometheus
    47  helm3 template prometheus prometheus \
    48    --namespace istio-system \
    49    --version 25.19.1 \
    50    --repo https://prometheus-community.github.io/helm-charts \
    51    -f "${WD}/values-prometheus.yaml" \
    52    > "${ADDONS}/prometheus.yaml"
    53  
    54  function compressDashboard() {
    55    < "${DASHBOARDS}/$1" jq -c  > "${TMP}/$1"
    56  }
    57  
    58  # Set up grafana
    59  {
    60    helm3 template grafana grafana \
    61      --namespace istio-system \
    62      --version "${GRAFANA_VERSION}" \
    63      --repo https://grafana.github.io/helm-charts \
    64      -f "${WD}/values-grafana.yaml"
    65  
    66    # Set up grafana dashboards. Split into 2 and compress to single line json to avoid Kubernetes size limits
    67    compressDashboard "pilot-dashboard.json"
    68    compressDashboard "istio-performance-dashboard.json"
    69    compressDashboard "istio-workload-dashboard.json"
    70    compressDashboard "istio-service-dashboard.json"
    71    compressDashboard "istio-mesh-dashboard.json"
    72    compressDashboard "istio-extension-dashboard.json"
    73    echo -e "\n---\n"
    74    kubectl create configmap -n istio-system istio-grafana-dashboards \
    75      --dry-run=client -oyaml \
    76      --from-file=pilot-dashboard.json="${TMP}/pilot-dashboard.json" \
    77      --from-file=istio-performance-dashboard.json="${TMP}/istio-performance-dashboard.json"
    78  
    79    echo -e "\n---\n"
    80    kubectl create configmap -n istio-system istio-services-grafana-dashboards \
    81      --dry-run=client -oyaml \
    82      --from-file=istio-workload-dashboard.json="${TMP}/istio-workload-dashboard.json" \
    83      --from-file=istio-service-dashboard.json="${TMP}/istio-service-dashboard.json" \
    84      --from-file=istio-mesh-dashboard.json="${TMP}/istio-mesh-dashboard.json" \
    85      --from-file=istio-extension-dashboard.json="${TMP}/istio-extension-dashboard.json"
    86  } > "${ADDONS}/grafana.yaml"
    87  
    88  # Set up loki
    89  {
    90    helm3 template loki loki \
    91      --namespace istio-system \
    92      --version "${LOKI_VERSION}" \
    93      --repo https://grafana.github.io/helm-charts \
    94      -f "${WD}/values-loki.yaml"
    95  } > "${ADDONS}/loki.yaml"