File tree Expand file tree Collapse file tree
tests/templates/kuttl/metrics Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22apiVersion : kuttl.dev/v1beta1
33kind : TestStep
44commands :
5- - script : >
6- envsubst '$NAMESPACE' < 01_rbac.yaml |
7- kubectl apply -n $NAMESPACE -f -
5+ - script : |
6+ PROMETHEUS_HELM_RELEASE_NAME=prometheus-$NAMESPACE
7+ PROMETHEUS_HELM_CHART_NAME=kube-prometheus-stack
8+
9+ # `kube-prometheus-stack.fullname` in the Prometheus Helm Chart is used to create the
10+ # ServiceAccount names. It is set to `<.Release.Name>-<.Chart.Name>` and truncated to
11+ # 26 characters, see
12+ # https://github.com/prometheus-community/helm-charts/blob/kube-prometheus-stack-81.2.2/charts/kube-prometheus-stack/templates/_helpers.tpl#L22
13+ KUBE_PROMETHEUS_STACK_FULLNAME=$PROMETHEUS_HELM_RELEASE_NAME-$PROMETHEUS_HELM_CHART_NAME
14+ export KUBE_PROMETHEUS_STACK_FULLNAME=${KUBE_PROMETHEUS_STACK_FULLNAME:0:26}
15+
16+ envsubst '$KUBE_PROMETHEUS_STACK_FULLNAME' < 01_rbac.yaml | \
17+ kubectl apply --namespace=$NAMESPACE --filename=-
Original file line number Diff line number Diff line change 1818 verbs :
1919 - use
2020---
21- # `fullnameOverride` in the Prometheus Helm values must be set to `prometheus-$NAMESPACE`, so that
22- # the ServiceAccounts are created with the names listed in this RoleBinding.
2321kind : RoleBinding
2422apiVersion : rbac.authorization.k8s.io/v1
2523metadata :
@@ -28,11 +26,11 @@ subjects:
2826 - kind : ServiceAccount
2927 name : test-service-account
3028 - kind : ServiceAccount
31- name : prometheus-$NAMESPACE -admission
29+ name : $KUBE_PROMETHEUS_STACK_FULLNAME -admission
3230 - kind : ServiceAccount
33- name : prometheus-$NAMESPACE -operator
31+ name : $KUBE_PROMETHEUS_STACK_FULLNAME -operator
3432 - kind : ServiceAccount
35- name : prometheus-$NAMESPACE -prometheus
33+ name : $KUBE_PROMETHEUS_STACK_FULLNAME -prometheus
3634roleRef :
3735 apiGroup : rbac.authorization.k8s.io
3836 kind : Role
Original file line number Diff line number Diff line change @@ -3,14 +3,13 @@ apiVersion: kuttl.dev/v1beta1
33kind : TestStep
44commands :
55 # Append the namespace to the Helm release name so that cluster-wide resources get unique names.
6- # `fullnameOverride` is set to `prometheus-$NAMESPACE`, so that the ServiceAccounts are created
7- # with the names that are defined in `test-role-binding`.
8- - script : >
9- helm install prometheus-$NAMESPACE
10- --namespace $NAMESPACE
11- --version 80.14.2
12- --values 10_kube-prometheus-stack-values.yaml
13- --set fullnameOverride=prometheus-$NAMESPACE
14- --wait
15- oci://ghcr.io/prometheus-community/charts/kube-prometheus-stack
6+ - script : |
7+ PROMETHEUS_HELM_RELEASE_NAME=prometheus-$NAMESPACE
8+
9+ helm install $PROMETHEUS_HELM_RELEASE_NAME \
10+ --namespace $NAMESPACE \
11+ --version 81.2.2 \
12+ --values 10_kube-prometheus-stack-values.yaml \
13+ --wait \
14+ oci://ghcr.io/prometheus-community/charts/kube-prometheus-stack
1615 timeout: 600
You can’t perform that action at this time.
0 commit comments