diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..92779768 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,192 @@ +name: dashboard-check +on: +# push: +# branches: +# - "*.*" +# pull_request: +# branches: +# - "master" + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + inputs: + folders: + description: 'Folders' + required: true + default: 'all' + type: string + kubedb_version: + description: 'KubeDB Version' + required: true + default: 'v2024.8.21' #needs to be dynamic + type: string +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-dashboard-check + cancel-in-progress: true +jobs: + config: + name: Configure Inputs + runs-on: label-detector + outputs: + folders: ${{ steps.defaulter.outputs.folders }} + kubedb_version : ${{ steps.defaulter.outputs.kubedb_version }} + steps: + - name: Defaulter + id: defaulter + env: + FOLDERS: "all" + KUBEDB_VERSION: ${{ inputs.kubedb_version }} + run: | + echo "folders=${FOLDERS:-all}" >> $GITHUB_OUTPUT + echo "kubedb_version=${KUBEDB_VERSION:-v2024.8.21}" >> $GITHUB_OUTPUT + test: + name: Test + runs-on: firecracker + needs: config + strategy: + fail-fast: false + matrix: + k8s: [v1.27.3] + steps: + - uses: actions/checkout@v4 + with: + ref: workflow + +# - name: Setup tmate session +# uses: mxschmitt/action-tmate@v3 +# with: +# detached: true + + - name: Set up Go 1.22 + uses: actions/setup-go@v4 + with: + go-version: '1.22' + id: go + + - name: Install Homebrew + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + - uses: Homebrew/actions/setup-homebrew@master + + - name: Prepare host + run: | + brew instal gh kubectl helm kind + + - name: Prepare git + env: + GITHUB_USER: 1gtm + GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} + run: | + set -x + git config --global user.name "1gtm" + git config --global user.email "1gtm@appscode.com" + git config --global \ + url."https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com".insteadOf \ + "https://github.com" + + - name: Create Kubernetes ${{ matrix.k8s }} cluster + id: kind + uses: engineerd/setup-kind@v0.5.0 + with: + version: v0.20.0 + config: hack/kubernetes/kind.yaml + image: kindest/node:${{ matrix.k8s }} + + - name: Prepare cluster for testing + id: local-path + run: | + echo "waiting for nodes to be ready ..." + kubectl wait --for=condition=Ready nodes --all --timeout=5m + kubectl get nodes + kubectl wait --for=condition=Ready pods -n kube-system --all --timeout=10m + kubectl get pods -n kube-system + + - name: Install cert-manager + run: | + kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml + + - name: Issue License + env: + BYTEBUILDERS_LICENSE_TOKEN: ${{ secrets.BYTEBUILDERS_LICENSE_TOKEN }} + run: | + export KUBECONFIG="${HOME}/.kube/config" + CLUSTER_UID=$(kubectl get ns kube-system -o=jsonpath='{.metadata.uid}') + curl -X POST -o /tmp/kubedb-license.txt -d "name=1gtm&email=1gtm@appscode.com&product=kubedb-enterprise&cluster=${CLUSTER_UID}&tos=true&token=${BYTEBUILDERS_LICENSE_TOKEN}" https://license-issuer.appscode.com/issue-license + curl -X POST -o /tmp/platform-license.txt -d "name=1gtm&email=1gtm@appscode.com&product=platform&cluster=${CLUSTER_UID}&tos=true&token=${BYTEBUILDERS_LICENSE_TOKEN}" https://license-issuer.appscode.com/issue-license + + - name: Install Longhorn + run: | + helm repo add longhorn https://charts.longhorn.io + helm repo update + helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.6.2 --wait --burst-limit=10000 + + - name: Install KubeDB + run: | + helm install kubedb oci://ghcr.io/appscode-charts/kubedb \ + --version ${{ needs.config.outputs.kubedb_version }} \ + --namespace kubedb --create-namespace \ + --set-file global.license=/tmp/kubedb-license.txt \ + --set global.featureGates.Druid=true \ + --set global.featureGates.FerretDB=true \ + --set global.featureGates.Memcached=true \ + --set global.featureGates.MSSQLServer=true \ + --set global.featureGates.PerconaXtraDB=true \ + --set global.featureGates.PgBouncer=true \ + --set global.featureGates.Pgpool=true \ + --set global.featureGates.ProxySQL=true \ + --set global.featureGates.RabbitMQ=true \ + --set global.featureGates.Singlestore=true \ + --set global.featureGates.Solr=true \ + --set global.featureGates.ZooKeeper=true \ + --wait --burst-limit=10000 --debug + + - name: Install KubeDB CLI + run: | + cd .. + git clone https://github.com/kubedb/cli.git + cd cli + go install ./... + + - name: Install Prometheus + run: | + helm repo add prometheus-community https://prometheus-community.github.io/helm-charts + helm repo update + helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --create-namespace --wait --burst-limit=10000 + + - name: Install Panopticon + run: | + helm repo add appscode https://charts.appscode.com/stable/ + helm repo update + helm install panopticon appscode/panopticon \ + -n kubeops --create-namespace \ + --set monitoring.agent=prometheus.io/operator \ + --set monitoring.serviceMonitor.labels.release=prometheus \ + --set-file license=/tmp/kubedb-license.txt \ + --wait --burst-limit=10000 + sleep 5s + kubectl wait --for=condition=ready pod -l "app.kubernetes.io/name=panopticon,app.kubernetes.io/instance=panopticon" -n kubeops --timeout=10m + + - name: Apply MetricsConfigurations + run: | + helm repo add appscode https://charts.appscode.com/stable/ + helm repo update + helm upgrade -i kubedb-metrics appscode/kubedb-metrics -n kubedb --create-namespace --version=${{ needs.config.outputs.kubedb }} --wait + + - name: Prepare smaples + run: | + cd .. + git clone https://github.com/kubedb/samples.git + cd samples + git checkout mssql-monitoring + + - name: Check Dashboard Metrics + env: + SINGLESTORE_LICENSE_USERNAME: ${{ secrets.SINGLESTORE_LICENSE_USERNAME }} + SINGLESTORE_LICENSE_PASSWORD: ${{ secrets.SINGLESTORE_LICENSE_PASSWORD }} + FOLDERS: ${{ needs.config.outputs.folders }} + run: | + echo "SINGLESTORE_LICENSE_USERNAME=$(echo $SINGLESTORE_LICENSE_USERNAME)" >> ./hack/scripts/.env + echo "SINGLESTORE_LICENSE_PASSWORD=$(echo $SINGLESTORE_LICENSE_PASSWORD)" >> ./hack/scripts/.env + echo "FOLDERS=$(echo $FOLDERS)" >> ./hack/scripts/.env + bash hack/scripts/check-dashboard.sh \ No newline at end of file diff --git a/connectcluster/connectcluster-connect.json b/connectcluster/connectcluster-connect.json index 45d66e58..ac7fdb9e 100644 --- a/connectcluster/connectcluster-connect.json +++ b/connectcluster/connectcluster-connect.json @@ -749,7 +749,7 @@ "targets": [ { "exemplar": true, - "expr": "kafka_connect_app_info{instance=~\"$instance\",start_time_ms!=\"\"}", + "expr": "kafka_connect_app_info{instance=~\"$instance\"}", "hide": false, "interval": "", "legendFormat": "", @@ -781,7 +781,7 @@ "refId": "D" }, { - "expr": "sum by (pod) (kafka_connect_worker__connector_startup_failure_total{namespace=~\"$namespace\",pod=~\"$app-.+$\"})", + "expr": "sum by (pod) (kafka_connect_worker_connector_startup_failure_total{namespace=~\"$namespace\",pod=~\"$app-.+$\"})", "format": "table", "instant": true, "interval": "", diff --git a/druid/druid_summary_dashboard.json b/druid/druid_summary_dashboard.json index 1022ffc4..911ec149 100644 --- a/druid/druid_summary_dashboard.json +++ b/druid/druid_summary_dashboard.json @@ -2434,7 +2434,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-brokers-\\\\d+$|$app-coordinators-\\\\d+$|$app-historicals-\\\\d+$|$app-middlemanagers-\\\\d+$|$app-routers-\\\\d+$|$app-overlords-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2518,7 +2518,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-brokers-\\\\d+$|$app-coordinators-\\\\d+$|$app-historicals-\\\\d+$|$app-middlemanagers-\\\\d+$|$app-routers-\\\\d+$|$app-overlords-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2602,7 +2602,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-brokers-\\\\d+$|$app-coordinators-\\\\d+$|$app-historicals-\\\\d+$|$app-middlemanagers-\\\\d+$|$app-routers-\\\\d+$|$app-overlords-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/elasticsearch/elasticsearch_summary_dashboard.json b/elasticsearch/elasticsearch_summary_dashboard.json index ea117e30..a26c3845 100644 --- a/elasticsearch/elasticsearch_summary_dashboard.json +++ b/elasticsearch/elasticsearch_summary_dashboard.json @@ -2567,7 +2567,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2651,7 +2651,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2735,7 +2735,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/hack/kubernetes/kind.yaml b/hack/kubernetes/kind.yaml new file mode 100644 index 00000000..8490d6a1 --- /dev/null +++ b/hack/kubernetes/kind.yaml @@ -0,0 +1,15 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: + - role: control-plane + kubeadmConfigPatches: + - | + apiVersion: kubeadm.k8s.io/v1beta2 + kind: ClusterConfiguration + metadata: + name: config + apiServer: + extraArgs: + enable-admission-plugins: "NodeRestriction,OwnerReferencesPermissionEnforcement" + - role: worker + - role: worker \ No newline at end of file diff --git a/hack/scripts/check-dashboard.sh b/hack/scripts/check-dashboard.sh new file mode 100644 index 00000000..5d186241 --- /dev/null +++ b/hack/scripts/check-dashboard.sh @@ -0,0 +1,183 @@ +#!/bin/bash +#set -e + +declare -A kind=(["connectcluster"]="ConnectCluster" ["druid"]="Druid" ["elasticsearch"]="Elasticsearch" ["kafka"]="Kafka" ["mariadb"]="MariaDB" + ["mongodb"]="MongoDB" ["mysql"]="MySQL" ["perconaxtradb"]="PerconaXtraDB" ["pgpool"]="Pgpool" ["postgres"]="Postgres" ["proxysql"]="ProxySQL" + ["rabbitmq"]="RabbitMQ" ["redis"]="Redis" ["singlestore"]="Singlestore" ["solr"]="Solr" ["zookeeper"]="ZooKeeper" ["mssqlserver"]="MSSQLServer") + +# export the ENVs from .env file +if [ -f .env ]; then + export $(grep -v '^#' .env | xargs) +fi + +# folder_array will hold all the folder names that we are going to check +readarray -t folder_array < <(ls) +IFS=',' read -r -a user_array <<< "$FOLDERS" +if [ $FOLDERS != "all" ]; then + folder_array=("${user_array[@]}") +fi +echo "folder_array = ${folder_array}" + +PROMETHEUS_SERVICE_NAMESPACE="monitoring" +PROMETHEUS_SERVICE_NAME="prometheus-kube-prometheus-prometheus" +kubectl port-forward svc/${PROMETHEUS_SERVICE_NAME} 9090:9090 -n ${PROMETHEUS_SERVICE_NAMESPACE} & +# `$!` is a special variable in bash that holds the PID of the most recently executed background command. +PORT_FORWARD_PID=$! + +# Give port-forwarding some time to establish +sleep 5 + +create_db_dependencies() { + folder="$1" + echo "folder=$folder" + if [ "$folder" == "druid" ]; then + kubectl create configmap -n demo my-init-script \ + --from-literal=init.sql="$(curl -fsSL https://raw.githubusercontent.com/kubedb/samples/master/druid/monitoring/mysql-init-script.sql)" + + helm repo add minio https://operator.min.io/ + helm upgrade --install --namespace "minio-operator" --create-namespace "minio-operator" minio/operator --set operator.replicaCount=1 --wait + helm upgrade --install --namespace "demo" --create-namespace druid-minio minio/tenant \ + --set tenant.pools[0].servers=1 \ + --set tenant.pools[0].volumesPerServer=1 \ + --set tenant.pools[0].size=1Gi \ + --set tenant.certificate.requestAutoCert=false \ + --set tenant.pools[0].name="default" \ + --set tenant.buckets[0].name="druid" \ + --wait + + kubectl apply -f ../samples/druid/monitoring/mysql.yaml + kubectl apply -f ../samples/druid/monitoring/zookeeper.yaml + + kubectl wait --for=jsonpath='{.status.phase}'=Ready MySQL mysql -n demo --timeout=10m + kubectl wait --for=jsonpath='{.status.phase}'=Ready ZooKeeper zookeeper -n demo --timeout=10m + fi + + if [ "$folder" == "pgpool" ]; then + kubectl apply -f ../samples/pgpool/monitoring/conf.yaml + kubectl apply -f ../samples/pgpool/monitoring/postgres.yaml + kubectl wait --for=jsonpath='{.status.phase}'=Ready Postgres postgres -n demo --timeout=10m + fi + + if [ "$folder" == "singlestore" ]; then + kubectl create secret generic -n demo license-secret \ + --from-literal=username=$SINGLESTORE_LICENSE_USERNAME \ + --from-literal=password=$SINGLESTORE_LICENSE_PASSWORD + fi + + if [ "$folder" == "solr" ]; then + kubectl apply -f ../samples/solr/monitoring/zookeeper.yaml + kubectl wait --for=jsonpath='{.status.phase}'=Ready ZooKeeper zookeeper -n demo --timeout=10m + fi + + if [ "$folder" == "connectcluster" ]; then + kubectl apply -f ../samples/kafka/connectcluster/monitoring/kafka.yaml + kubectl wait --for=jsonpath='{.status.phase}'=Ready Kafka kafka -n demo --timeout=10m + + kubectl apply -f ../samples/kafka/connectcluster/monitoring/connect-cluster.yaml + kubectl wait --for=jsonpath='{.status.phase}'=Ready ConnectCluster connectcluster -n demo --timeout=10m + + kubectl apply -f ../samples/kafka/connectcluster/monitoring/file-source.yaml + fi + + if [ "$folder" == "redis" ]; then + kubectl apply -f ../samples/redis/monitoring/sentinel.yaml + kubectl wait --for=jsonpath='{.status.phase}'=Ready RedisSentinel sentinel -n demo --timeout=10m + fi + sleep 2s +} + +cleanup() { + path="$1" + folder="$2" + if [ $folder == "connectcluster" ]; then + kubectl delete -f ../samples/kafka/connectcluster/monitoring/connect-cluster.yaml + fi + kubectl delete -f $path +} + +check_dashboard_for_non_dbs() { + sleep 60s # waiting for the metrics to be generated + folder="$1" + inside_files_array="$2" + for file in "${inside_files_array[@]}"; do + if [[ $file == *.json ]]; then + dashboard_name="${file::-5}" + echo "checking for dashboard $dashboard_name" + url="https://raw.githubusercontent.com/appscode/grafana-dashboards/master/$folder/$file" + echo "$HOME/go/bin/kubectl-dba monitor dashboard -u $url -o=true --prom-svc-name=prometheus-kube-prometheus-prometheus --prom-svc-namespace=monitoring --prom-svc-port=9090" + $HOME/go/bin/kubectl-dba monitor dashboard -u $url -d=false --prom-svc-name=prometheus-kube-prometheus-prometheus --prom-svc-namespace=monitoring --prom-svc-port=9090 + fi + done +} + +wait_for_prometheus_target() { + target="$1" + echo "checking if $target-stats target exist in prometheus...." + for (( i=1; i<=600; i++ )); do + # Curl the Prometheus API to get the targets and extract the pool information + Targets=$(curl -s http://localhost:9090/api/v1/targets | jq -r '.data.activeTargets[] | .labels.service') + if echo "$Targets" | grep -q "$target"; then + echo "$target target found in prometheus" + sleep 30s + break + fi + sleep 5s + done +} + + +kubectl create ns demo + +for folder in "${folder_array[@]}"; do + if [[ -v kind["$folder"] ]]; then + echo "db name: $folder" + + readarray -t inside_files_array < <(ls "$folder") + + path=../samples/"$folder"/monitoring/ + + if [ "$folder" == "connectcluster" ]; then + path=../samples/kafka/connectcluster/monitoring/ + fi + + create_db_dependencies "$folder" + + kubectl apply -f $path + kubectl wait --for=jsonpath='{.status.phase}'=Ready ${kind[$folder]} $folder -n demo --timeout=10m + + wait_for_prometheus_target "$folder-stats" + + for file in "${inside_files_array[@]}"; do + if [[ $file == *.json ]]; then + dashboard_name="${file::-5}" + echo "checking for dashboard $dashboard_name" + echo "$HOME/go/bin/kubectl-dba monitor dashboard $folder $folder -n demo $dashboard_name --prom-svc-name=prometheus-kube-prometheus-prometheus --prom-svc-namespace=monitoring --prom-svc-port=9090 -b=workflow" + $HOME/go/bin/kubectl-dba monitor dashboard $folder $folder -n demo $dashboard_name --prom-svc-name=prometheus-kube-prometheus-prometheus --prom-svc-namespace=monitoring --prom-svc-port=9090 -b=workflow + fi + done + cleanup "$path" "$folder" + + elif [ "$folder" == "stash" ]; then + echo "non db object name: $folder" + readarray -t inside_files_array < <(ls "$folder") + + bash ./hack/scripts/stash-flow.sh + wait_for_prometheus_target "stash-stash-enterprise" + check_dashboard_for_non_dbs "$folder" "$inside_files_array" + + cleanup "./hack/yamls/stash" + + elif [ "$folder" == "policy" ]; then + echo "non db object name: $folder" + readarray -t inside_files_array < <(ls "$folder") + + bash ./hack/scripts/policy-flow.sh + wait_for_prometheus_target "falco-ui-server" + check_dashboard_for_non_dbs "$folder" "$inside_files_array" + + cleanup "./hack/yamls/policy" + fi + +done + +kill $PORT_FORWARD_PID \ No newline at end of file diff --git a/hack/scripts/policy-flow.sh b/hack/scripts/policy-flow.sh new file mode 100644 index 00000000..c35cf605 --- /dev/null +++ b/hack/scripts/policy-flow.sh @@ -0,0 +1,11 @@ +set -e + +helm repo add gatekeeper https://open-policy-agent.github.io/gatekeeper/charts +helm install gatekeeper/gatekeeper --name-template=gatekeeper --namespace gatekeeper-system --create-namespace --set replicas=1 --set constraintViolationsLimit=100 --wait + +helm upgrade -i kube-ui-server appscode/kube-ui-server -n kubeops --create-namespace --version=v2024.5.17 --wait + +kubectl apply -f ./hack/yamls/policy/constraint-template.yaml +sleep 5 +kubectl apply -f ./hack/yamls/policy/constraint.yaml + diff --git a/hack/scripts/stash-flow.sh b/hack/scripts/stash-flow.sh new file mode 100644 index 00000000..e37688d0 --- /dev/null +++ b/hack/scripts/stash-flow.sh @@ -0,0 +1,66 @@ +set -e + +helm repo add minio https://operator.min.io/ +helm upgrade --install --namespace "minio-operator" --create-namespace "stash-minio-operator" minio/operator --set operator.replicaCount=1 --wait +helm upgrade --install --namespace "demo" --create-namespace stash-minio minio/tenant \ + --set tenant.pools[0].servers=1 \ + --set tenant.pools[0].volumesPerServer=1 \ + --set tenant.pools[0].size=1Gi \ + --set tenant.certificate.requestAutoCert=false \ + --set tenant.pools[0].name="default" \ + --set tenant.buckets[0].name="stash" \ + --wait + +echo -n 'changeit' > RESTIC_PASSWORD +echo -n 'minio' > AWS_ACCESS_KEY_ID +echo -n 'minio123' > AWS_SECRET_ACCESS_KEY +kubectl create secret generic -n demo minio-secret \ + --from-file=./RESTIC_PASSWORD \ + --from-file=./AWS_ACCESS_KEY_ID \ + --from-file=./AWS_SECRET_ACCESS_KEY + +helm install stash oci://ghcr.io/appscode-charts/stash \ + --version v2024.4.8 \ + --namespace stash --create-namespace \ + --set features.enterprise=true \ + --set stash-enterprise.monitoring.agent=prometheus.io/operator \ + --set stash-enterprise.monitoring.backup=true \ + --set stash-enterprise.monitoring.operator=true \ + --set stash-enterprise.monitoring.serviceMonitor.labels.release=prometheus \ + --set-file global.license=/tmp/kubedb-license.txt \ + --wait --burst-limit=10000 + +curl -o kubectl-stash.tar.gz -fsSL https://github.com/stashed/cli/releases/download/v0.34.0/kubectl-stash-linux-amd64.tar.gz \ + && tar zxvf kubectl-stash.tar.gz \ + && chmod +x kubectl-stash-linux-amd64 \ + && sudo mv kubectl-stash-linux-amd64 /usr/local/bin/kubectl-stash \ + && rm kubectl-stash.tar.gz LICENSE.md + +kubectl apply -f ./hack/yamls/stash/repository.yaml +sleep 10 + +kubectl apply -f ./hack/yamls/stash/mongodb_standalone.yaml +kubectl wait --for=jsonpath='{.status.phase}'=Ready MongoDB mongodb-standalone -n demo --timeout=10m + +kubectl apply -f ./hack/yamls/stash/backupconfiguration.yaml +kubectl wait --for=jsonpath='{.status.phase}'=Ready BackupConfiguration mg-st-backup -n demo --timeout=10m + +kubectl-stash trigger mg-st-backup -n demo + +retries=0 +while true; do + backupsession_count=$(kubectl get backupsession -n demo -l "stash.appscode.com/invoker-name=mg-st-backup" | wc -l) + if [ $backupsession_count -ge 0 ]; then + break + elif [ $retries -ge 5 ]; then + echo "backupsession not creating for backupconfiguration 'mg-st-backup'" + exit 1 + fi + retries=$((retries + 1)) + sleep 5 +done + + +sleep 10s +kubectl apply -f ./hack/yamls/stash/restoresession.yaml +kubectl wait --for=jsonpath='{.status.phase}'=Succeeded RestoreSession mg-st-restore -n demo --timeout=10m diff --git a/hack/yamls/policy/constraint-template.yaml b/hack/yamls/policy/constraint-template.yaml new file mode 100644 index 00000000..ad7c1cae --- /dev/null +++ b/hack/yamls/policy/constraint-template.yaml @@ -0,0 +1,58 @@ +apiVersion: templates.gatekeeper.sh/v1 +kind: ConstraintTemplate +metadata: + name: k8sreplicalimits + annotations: + metadata.gatekeeper.sh/title: "Replica Limits" + metadata.gatekeeper.sh/version: 1.0.2 + description: >- + Requires that objects with the field `spec.replicas` (Deployments, + ReplicaSets, etc.) specify a number of replicas within defined ranges. +spec: + crd: + spec: + names: + kind: K8sReplicaLimits + validation: + # Schema for the `parameters` field + openAPIV3Schema: + type: object + properties: + ranges: + type: array + description: Allowed ranges for numbers of replicas. Values are inclusive. + items: + type: object + description: A range of allowed replicas. Values are inclusive. + properties: + min_replicas: + description: The minimum number of replicas allowed, inclusive. + type: integer + max_replicas: + description: The maximum number of replicas allowed, inclusive. + type: integer + targets: + - target: admission.k8s.gatekeeper.sh + rego: | + package k8sreplicalimits + + object_name = input.review.object.metadata.name + object_kind = input.review.kind.kind + + violation[{"msg": msg}] { + spec := input.review.object.spec + not input_replica_limit(spec) + msg := sprintf("The provided number of replicas is not allowed for %v: %v. Allowed ranges: %v", [object_kind, object_name, input.parameters]) + } + + input_replica_limit(spec) { + provided := spec.replicas + count(input.parameters.ranges) > 0 + range := input.parameters.ranges[_] + value_within_range(range, provided) + } + + value_within_range(range, value) { + range.min_replicas <= value + range.max_replicas >= value + } \ No newline at end of file diff --git a/hack/yamls/policy/constraint.yaml b/hack/yamls/policy/constraint.yaml new file mode 100644 index 00000000..82bfec79 --- /dev/null +++ b/hack/yamls/policy/constraint.yaml @@ -0,0 +1,13 @@ +apiVersion: constraints.gatekeeper.sh/v1beta1 +kind: K8sReplicaLimits +metadata: + name: replica-limits +spec: + match: + kinds: + - apiGroups: ["apps"] + kinds: ["Deployment"] + parameters: + ranges: + - min_replicas: 3 + max_replicas: 50 \ No newline at end of file diff --git a/hack/yamls/stash/backupconfiguration.yaml b/hack/yamls/stash/backupconfiguration.yaml new file mode 100644 index 00000000..4453421f --- /dev/null +++ b/hack/yamls/stash/backupconfiguration.yaml @@ -0,0 +1,18 @@ +apiVersion: stash.appscode.com/v1beta1 +kind: BackupConfiguration +metadata: + name: mg-st-backup + namespace: demo +spec: + schedule: "*/50 * * * *" + repository: + name: minio-repo + target: + ref: + apiVersion: appcatalog.appscode.com/v1alpha1 + kind: AppBinding + name: mongodb-standalone + retentionPolicy: + name: keep-last-5 + keepLast: 5 + prune: true diff --git a/hack/yamls/stash/mongodb_standalone.yaml b/hack/yamls/stash/mongodb_standalone.yaml new file mode 100644 index 00000000..9ea8b3c8 --- /dev/null +++ b/hack/yamls/stash/mongodb_standalone.yaml @@ -0,0 +1,22 @@ +apiVersion: kubedb.com/v1alpha2 +kind: MongoDB +metadata: + name: mongodb-standalone + namespace: demo +spec: + version: "4.4.26" + terminationPolicy: WipeOut + storage: + storageClassName: "standard" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + monitor: + agent: prometheus.io/operator + prometheus: + serviceMonitor: + labels: + release: prometheus + interval: 10s \ No newline at end of file diff --git a/hack/yamls/stash/repository.yaml b/hack/yamls/stash/repository.yaml new file mode 100644 index 00000000..2e18b938 --- /dev/null +++ b/hack/yamls/stash/repository.yaml @@ -0,0 +1,16 @@ +apiVersion: stash.appscode.com/v1alpha1 +kind: Repository +metadata: + name: minio-repo + namespace: demo +spec: + usagePolicy: + allowedNamespaces: + from: Same + backend: + s3: + endpoint: http://minio.demo.svc.cluster.local:80 + bucket: myminio + region: us-east-1 + prefix: /hhh/sayed/ + storageSecretName: minio-secret \ No newline at end of file diff --git a/hack/yamls/stash/restoresession.yaml b/hack/yamls/stash/restoresession.yaml new file mode 100644 index 00000000..67ced428 --- /dev/null +++ b/hack/yamls/stash/restoresession.yaml @@ -0,0 +1,15 @@ +apiVersion: stash.appscode.com/v1beta1 +kind: RestoreSession +metadata: + name: mg-st-restore + namespace: demo +spec: + repository: + name: minio-repo + target: + ref: + apiVersion: appcatalog.appscode.com/v1alpha1 + kind: AppBinding + name: mongodb-standalone + rules: + - snapshots: [latest] \ No newline at end of file diff --git a/kafka/kafka_summary.json b/kafka/kafka_summary.json index 63654ac3..ac54134b 100644 --- a/kafka/kafka_summary.json +++ b/kafka/kafka_summary.json @@ -2434,7 +2434,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2518,7 +2518,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2602,7 +2602,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-.+$\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/mariadb/mariadb-summary.json b/mariadb/mariadb-summary.json index 18b0e80d..48c9a7bc 100644 --- a/mariadb/mariadb-summary.json +++ b/mariadb/mariadb-summary.json @@ -2434,7 +2434,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2518,7 +2518,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2602,7 +2602,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/mongodb/mongodb-pod-dashboard.json b/mongodb/mongodb-pod-dashboard.json index 75e7ebe9..3e2aa90a 100644 --- a/mongodb/mongodb-pod-dashboard.json +++ b/mongodb/mongodb-pod-dashboard.json @@ -195,7 +195,7 @@ "targets": [ { "exemplar": false, - "expr": "sum(rate(mongodb_ss_opcounters{pod=~\"$pod\",type!=\"command\"}[$interval]) or irate(mongodb_ss_opcounters{pod=~\"$pod\",type!=\"command\"}[5m]))", + "expr": "sum(rate(mongodb_ss_opcounters{pod=~\"$pod\",legacy_op_type!=\"command\"}[$interval]) or irate(mongodb_ss_opcounters{pod=~\"$pod\",legacy_op_type!=\"command\"}[5m]))", "interval": "$interval", "legendFormat": "", "refId": "A" @@ -261,7 +261,7 @@ "targets": [ { "exemplar": false, - "expr": "avg by (service) (rate(mongodb_ss_opLatencies_latency{service=~\"${app}-stats\"}[$interval]) / (rate(mongodb_ss_opLatencies_ops{service=~\"${app}-stats\"}[$interval]) > 0) or irate(mongodb_ss_opLatencies_latency{service=~\"${app}-stats\"}[5m]) / (irate(mongodb_ss_opLatencies_ops{service=~\"${app}-stats\"}[5m]) > 0))\n", + "expr": "avg by (service) (rate(mongodb_ss_opLatencies_latency{service=~\"$app-stats\"}[$interval]) / (rate(mongodb_ss_opLatencies_ops{service=~\"$app-stats\"}[$interval]) > 0) or irate(mongodb_ss_opLatencies_latency{service=~\"$app-stats\"}[5m]) / (irate(mongodb_ss_opLatencies_ops{service=~\"$app-stats\"}[5m]) > 0))\n", "interval": "$interval", "legendFormat": "", "refId": "A" @@ -478,7 +478,7 @@ "targets": [ { "exemplar": false, - "expr": "avg by (service,op_type) (rate(mongodb_ss_opLatencies_latency{service=~\"${app}-stats\"}[$interval]) / (rate(mongodb_ss_opLatencies_ops{service=~\"${app}-stats\"}[$interval]) > 0) or irate(mongodb_ss_opLatencies_latency{service=~\"${app}-stats\"}[5m]) / (irate(mongodb_ss_opLatencies_ops{service=~\"${app}-stats\"}[5m]) > 0))", + "expr": "avg by (service,op_type) (rate(mongodb_ss_opLatencies_latency{service=~\"$app-stats\"}[$interval]) / (rate(mongodb_ss_opLatencies_ops{service=~\"$app-stats\"}[$interval]) > 0) or irate(mongodb_ss_opLatencies_latency{service=~\"$app-stats\"}[5m]) / (irate(mongodb_ss_opLatencies_ops{service=~\"$app-stats\"}[5m]) > 0))", "interval": "$interval", "legendFormat": "{{op_type}}", "range": true, @@ -1890,7 +1890,7 @@ "name": "pod", "options": [], "query": { - "query": "label_values(mongodb_up{namespace=~\"$namespace\",service=\"${app}-stats\"}, pod)", + "query": "label_values(mongodb_up{namespace=~\"$namespace\",service=\"$app-stats\"}, pod)", "refId": "Prometheus-pod-Variable-Query" }, "refresh": 2, diff --git a/mongodb/mongodb-summary-dashboard.json b/mongodb/mongodb-summary-dashboard.json index 29ab4d8f..c135d708 100644 --- a/mongodb/mongodb-summary-dashboard.json +++ b/mongodb/mongodb-summary-dashboard.json @@ -2473,7 +2473,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$|$app-shard\\\\d+-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2557,7 +2557,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$|$app-shard\\\\d+-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2641,7 +2641,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$|$app-shard\\\\d+-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/mysql/mysql_summary_dashboard.json b/mysql/mysql_summary_dashboard.json index f808cefd..3770505f 100644 --- a/mysql/mysql_summary_dashboard.json +++ b/mysql/mysql_summary_dashboard.json @@ -2517,7 +2517,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2601,7 +2601,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2685,7 +2685,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/perconaxtradb/perconaxtradb-summary.json b/perconaxtradb/perconaxtradb-summary.json index bbf5e0d0..638321f1 100644 --- a/perconaxtradb/perconaxtradb-summary.json +++ b/perconaxtradb/perconaxtradb-summary.json @@ -2434,7 +2434,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2518,7 +2518,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2602,7 +2602,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/postgres/postgres_summary_dashboard.json b/postgres/postgres_summary_dashboard.json index 38fc0d2e..d61fc88f 100644 --- a/postgres/postgres_summary_dashboard.json +++ b/postgres/postgres_summary_dashboard.json @@ -2977,7 +2977,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -3061,7 +3061,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -3145,7 +3145,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/rabbitmq/rabbitmq-summary.json b/rabbitmq/rabbitmq-summary.json index 90c28bc3..d17cbe8d 100644 --- a/rabbitmq/rabbitmq-summary.json +++ b/rabbitmq/rabbitmq-summary.json @@ -2434,7 +2434,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2518,7 +2518,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2602,7 +2602,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/redis/redis_summary_dashboard.json b/redis/redis_summary_dashboard.json index 8d8007cf..443f29db 100644 --- a/redis/redis_summary_dashboard.json +++ b/redis/redis_summary_dashboard.json @@ -2563,7 +2563,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$|$app-shard\\\\d+-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2647,7 +2647,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$|$app-shard\\\\d+-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2731,7 +2731,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$|$app-shard\\\\d+-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/redis/sentinel_summary_dashbaord.json b/redis/sentinel_summary_dashbaord.json index fe26d21d..b5bc60e4 100644 --- a/redis/sentinel_summary_dashbaord.json +++ b/redis/sentinel_summary_dashbaord.json @@ -2563,7 +2563,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2647,7 +2647,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2731,7 +2731,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/singlestore/singlestore_summary_dashboard.json b/singlestore/singlestore_summary_dashboard.json index 396d8155..3c49d4f5 100644 --- a/singlestore/singlestore_summary_dashboard.json +++ b/singlestore/singlestore_summary_dashboard.json @@ -2434,7 +2434,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-aggregator-\\\\d+$|$app-leaf-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2518,7 +2518,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-aggregator-\\\\d+$|$app-leaf-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2602,7 +2602,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-aggregator-\\\\d+$|$app-leaf-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/solr/solr-summary.json b/solr/solr-summary.json index 0d9924cd..6c8c6d5f 100644 --- a/solr/solr-summary.json +++ b/solr/solr-summary.json @@ -2491,7 +2491,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-overseer-\\\\d+$|$app-coordinator-\\\\d+$|$app-data-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-overseer-\\\\d+$|$app-coordinator-\\\\d+$|$app-data-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2575,7 +2575,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-overseer-\\\\d+$|$app-coordinator-\\\\d+$|$app-data-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-overseer-\\\\d+$|$app-coordinator-\\\\d+$|$app-data-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2659,7 +2659,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-overseer-\\\\d+$|$app-coordinator-\\\\d+$|$app-data-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-overseer-\\\\d+$|$app-coordinator-\\\\d+$|$app-data-\\\\d+$|$app-\\\\d+$\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}", diff --git a/zookeeper/zookeeper_summary_dashboard.json b/zookeeper/zookeeper_summary_dashboard.json index b52bbdab..6942c23b 100644 --- a/zookeeper/zookeeper_summary_dashboard.json +++ b/zookeeper/zookeeper_summary_dashboard.json @@ -2551,7 +2551,7 @@ "targets": [ { "exemplar": true, - "expr": "kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}", + "expr": "kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}", "format": "table", "instant": true, "interval": "", @@ -2637,7 +2637,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) )* 100", + "expr": "(kubelet_volume_stats_used_bytes{} / on(persistentvolumeclaim) group_left(pod) (kubelet_volume_stats_capacity_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) )* 100", "instant": true, "interval": "", "legendFormat": "{{pod}}", @@ -2725,7 +2725,7 @@ "targets": [ { "exemplar": true, - "expr": "(kubelet_volume_stats_used_bytes + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"$app-\\\\d+$\",namespace=~\"$namespace\"}) ", + "expr": "(kubelet_volume_stats_used_bytes{} + on(persistentvolumeclaim) group_left(pod) kube_pod_spec_volumes_persistentvolumeclaims_info{pod=~\"^$app.*\",namespace=~\"$namespace\"}) ", "interval": "", "intervalFactor": 1, "legendFormat": "{{pod}}",