diff --git a/charts/k8s-monitoring-test/README.md b/charts/k8s-monitoring-test/README.md index fb92c928d..89e923a16 100644 --- a/charts/k8s-monitoring-test/README.md +++ b/charts/k8s-monitoring-test/README.md @@ -12,6 +12,14 @@ A Helm chart for testing the Kubernetes Monitoring Helm chart ## Values +### Test settings + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| attempts | int | `3` | Number of times to retry the test on failure. | +| delay | int | `60` | Delay, in seconds, between test runs. | +| initialDelay | int | `0` | Initial delay, in seconds, before starting the first test run. | + ### General settings | Key | Type | Default | Description | @@ -30,27 +38,26 @@ A Helm chart for testing the Kubernetes Monitoring Helm chart | Key | Type | Default | Description | |-----|------|---------|-------------| -| image.image | string | `"grafana/k8s-monitoring-test"` | Test job image repository. | | image.pullSecrets | list | `[]` | Optional set of image pull secrets. | -| image.registry | string | `"ghcr.io"` | Test job image registry. | -| image.tag | string | `""` | Test job image tag. Default is the chart version. | +| image.registry | string | `"ghcr.io"` | Test pod image registry. | +| image.repository | string | `"grafana/k8s-monitoring-test"` | Test pod image repository. | +| image.tag | string | `""` | Test pod image tag. Default is the chart version. | ### Job settings | Key | Type | Default | Description | |-----|------|---------|-------------| -| job.attempts | int | `10` | How many times to attempt the test job. | -| job.extraAnnotations | object | `{}` | Extra annotations to add to the test job. | -| job.extraLabels | object | `{}` | Extra labels to add to the test job. | -| job.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | nodeSelector to apply to the test job. | -| job.serviceAccount | object | `{"name":""}` | Service Account to use for the test job. | -| job.tolerations | list | `[]` | Tolerations to apply to the test job. | +| pod.extraAnnotations | object | `{}` | Extra annotations to add to the test runner pods. | +| pod.extraLabels | object | `{}` | Extra labels to add to the test runner pods. | +| pod.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | nodeSelector to apply to the test runner pods. | +| pod.serviceAccount | object | `{"name":""}` | Service Account to use for the test runner pods. | +| pod.tolerations | list | `[]` | Tolerations to apply to the test runner pods. | ### Tests | Key | Type | Default | Description | |-----|------|---------|-------------| -| tests | list | `[]` | The tests to run | +| tests | list | `[]` | The tests to run. Each should contain an "env" object and a "queries" list. | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2) diff --git a/charts/k8s-monitoring-test/templates/tests/test-job.yaml b/charts/k8s-monitoring-test/templates/tests/test-pod.yaml similarity index 58% rename from charts/k8s-monitoring-test/templates/tests/test-job.yaml rename to charts/k8s-monitoring-test/templates/tests/test-pod.yaml index bedea8426..1e29c24e5 100644 --- a/charts/k8s-monitoring-test/templates/tests/test-job.yaml +++ b/charts/k8s-monitoring-test/templates/tests/test-pod.yaml @@ -10,19 +10,19 @@ metadata: app.kubernetes.io/instance: {{ $.Release.Name | quote }} app.kubernetes.io/version: {{ $.Chart.AppVersion }} helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" - {{- range $key, $val := $.Values.job.extraLabels }} + {{- range $key, $val := $.Values.pod.extraLabels }} {{ $key }}: {{ $val | quote }} {{- end}} annotations: "helm.sh/hook": test "helm.sh/hook-delete-policy": before-hook-creation "helm.sh/hook-weight": "0" - {{- range $key, $val := $.Values.job.extraAnnotations }} + {{- range $key, $val := $.Values.pod.extraAnnotations }} {{ $key }}: {{ $val | quote }} {{- end}} spec: - {{- if $.Values.job.serviceAccount.name }} - serviceAccountName: {{ $.Values.job.serviceAccount.name }} + {{- if $.Values.pod.serviceAccount.name }} + serviceAccountName: {{ $.Values.pod.serviceAccount.name }} {{- end }} {{- if or $.Values.global.image.pullSecrets $.Values.image.pullSecrets }} imagePullSecrets: @@ -33,18 +33,34 @@ spec: {{- end }} {{- end }} restartPolicy: Never - {{- with $.Values.job.nodeSelector }} + {{- with $.Values.pod.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with $.Values.job.tolerations }} + {{- with $.Values.pod.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} + {{- if $.Values.initialDelay }} + initContainers: + - name: wait + image: "{{ $.Values.global.image.registry | default $.Values.image.registry }}/{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.Version }}" + command: ["bash", "-c", "sleep {{ $.Values.initialDelay | int }}"] + {{- end }} containers: - name: query-test - image: "{{ $.Values.global.image.registry | default $.Values.image.registry }}/{{ $.Values.image.image }}:{{ $.Values.image.tag | default $.Chart.Version }}" - command: ["bash", "-c", "/etc/bin/query-test.sh /etc/test/queries.json"] + image: "{{ $.Values.global.image.registry | default $.Values.image.registry }}/{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.Version }}" + command: + - bash + - -c + - | + for i in $(seq 1 {{ $.Values.attempts | int }}); do + echo "Running test... ($i/{{ $.Values.attempts | int }})" + if /etc/bin/query-test.sh /etc/test/queries.json; then + exit 0 + fi + sleep {{ $.Values.delay | int }} + done envFrom: - secretRef: name: {{ include "k8s-monitoring-test.fullname" $ }}-{{ $i }} diff --git a/charts/k8s-monitoring-test/tests/single_test.yaml b/charts/k8s-monitoring-test/tests/single_test.yaml index bd176e63b..6e19f7dfd 100644 --- a/charts/k8s-monitoring-test/tests/single_test.yaml +++ b/charts/k8s-monitoring-test/tests/single_test.yaml @@ -3,9 +3,9 @@ suite: Single test templates: - configmap.yaml - secret.yaml - - tests/test-job.yaml + - tests/test-pod.yaml tests: - - it: creates a single test Job with a ConfigMap and a Secret + - it: creates a single test Pod with a ConfigMap and a Secret set: tests: - env: @@ -47,6 +47,6 @@ tests: equal: path: stringData["PROMETHEUS_PASSWORD"] value: prompassword - - template: tests/test-job.yaml + - template: tests/test-pod.yaml hasDocuments: count: 1 diff --git a/charts/k8s-monitoring-test/tests/two_test.yaml b/charts/k8s-monitoring-test/tests/two_test.yaml index 9f14c045c..f40c6579e 100644 --- a/charts/k8s-monitoring-test/tests/two_test.yaml +++ b/charts/k8s-monitoring-test/tests/two_test.yaml @@ -3,9 +3,9 @@ suite: Two tests templates: - configmap.yaml - secret.yaml - - tests/test-job.yaml + - tests/test-pod.yaml tests: - - it: creates two tests Jobs, each with a ConfigMap and a Secret + - it: creates two tests Pods, each with a ConfigMap and a Secret set: tests: - env: @@ -113,6 +113,6 @@ tests: path: stringData["PROMETHEUS_PASSWORD"] value: my-password - - template: tests/test-job.yaml + - template: tests/test-pod.yaml hasDocuments: count: 2 diff --git a/charts/k8s-monitoring-test/values.schema.json b/charts/k8s-monitoring-test/values.schema.json index d1363e4eb..c9c311324 100644 --- a/charts/k8s-monitoring-test/values.schema.json +++ b/charts/k8s-monitoring-test/values.schema.json @@ -2,6 +2,12 @@ "$schema": "http://json-schema.org/schema#", "type": "object", "properties": { + "attempts": { + "type": "integer" + }, + "delay": { + "type": "integer" + }, "fullnameOverride": { "type": "string" }, @@ -24,26 +30,29 @@ "image": { "type": "object", "properties": { - "image": { - "type": "string" - }, "pullSecrets": { "type": "array" }, "registry": { "type": "string" }, + "repository": { + "type": "string" + }, "tag": { "type": "string" } } }, - "job": { + "initialDelay": { + "type": "integer" + }, + "nameOverride": { + "type": "string" + }, + "pod": { "type": "object", "properties": { - "attempts": { - "type": "integer" - }, "extraAnnotations": { "type": "object" }, @@ -71,9 +80,6 @@ } } }, - "nameOverride": { - "type": "string" - }, "tests": { "type": "array" } diff --git a/charts/k8s-monitoring-test/values.yaml b/charts/k8s-monitoring-test/values.yaml index 2c7e1ef75..3269cd157 100644 --- a/charts/k8s-monitoring-test/values.yaml +++ b/charts/k8s-monitoring-test/values.yaml @@ -7,53 +7,60 @@ nameOverride: "" # @section -- General settings fullnameOverride: "" -# -- The tests to run +# -- The tests to run. Each should contain an "env" object and a "queries" list. # @section -- Tests tests: [] -job: - # -- How many times to attempt the test job. - # @section -- Job settings - attempts: 10 +# -- Initial delay, in seconds, before starting the first test run. +# @section -- Test settings +initialDelay: 0 + +# -- Number of times to retry the test on failure. +# @section -- Test settings +attempts: 3 + +# -- Delay, in seconds, between test runs. +# @section -- Test settings +delay: 60 - # -- nodeSelector to apply to the test job. +pod: + # -- nodeSelector to apply to the test runner pods. # @section -- Job settings nodeSelector: kubernetes.io/os: linux - # -- Extra annotations to add to the test job. + # -- Extra annotations to add to the test runner pods. # @section -- Job settings extraAnnotations: {} - # -- Extra labels to add to the test job. + # -- Extra labels to add to the test runner pods. # @section -- Job settings extraLabels: {} - # -- Tolerations to apply to the test job. + # -- Tolerations to apply to the test runner pods. # @section -- Job settings tolerations: [] - # -- Service Account to use for the test job. + # -- Service Account to use for the test runner pods. # @section -- Job settings serviceAccount: name: "" image: - # -- Test job image registry. + # -- Test pod image registry. # @section -- Image settings registry: ghcr.io - # -- Test job image repository. + # -- Test pod image repository. # @section -- Image settings - image: grafana/k8s-monitoring-test - # -- Test job image tag. Default is the chart version. + repository: grafana/k8s-monitoring-test + # -- Test pod image tag. Default is the chart version. # @section -- Image settings tag: "" # -- Optional set of image pull secrets. # @section -- Image settings pullSecrets: [] -## Global properties for image pulling override the values defined under `image.registry` and `configReloader.image.registry`. -## If you want to override only one image registry, use the specific fields but if you want to override them all, use `global.image.registry` +## Global properties for overriding the image registry and pull secrets. global: image: # -- Global image registry to use if it needs to be overridden for some specific use cases (e.g local registries, custom images, ...) diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz index 6c5a42b24..90935e11a 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz index 64a9ad2f7..80c2c66ed 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz index 8d0b3d353..9d8b93e77 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz index f7562ded6..233a5d24b 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-frontend-observability-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-frontend-observability-1.0.0.tgz index d22daa36c..e187fa1e2 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-frontend-observability-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-frontend-observability-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz index ee15fb41d..985c8abb4 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz index 78e23d39c..e98efceef 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz index 0def093b8..ca964e3f9 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz index b5e15966c..45ee95e70 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/tests/integration/cluster-monitoring/test-values.yaml b/charts/k8s-monitoring/tests/integration/cluster-monitoring/test-values.yaml index fdaba61b9..0b3ddc328 100644 --- a/charts/k8s-monitoring/tests/integration/cluster-monitoring/test-values.yaml +++ b/charts/k8s-monitoring/tests/integration/cluster-monitoring/test-values.yaml @@ -2,12 +2,12 @@ tests: - env: PROMETHEUS_URL: https://prometheus-server.prometheus.svc:9090/api/v1/query - PROMETHEUS_USERNAME: promuser - PROMETHEUS_PASSWORD: prometheuspassword + PROMETHEUS_USER: promuser + PROMETHEUS_PASS: prometheuspassword LOKI_URL: http://loki.loki.svc:3100/loki/api/v1/query LOKI_TENANTID: 1 - LOKI_USERNAME: loki - LOKI_PASSWORD: lokipassword + LOKI_USER: loki + LOKI_PASS: lokipassword queries: - query: kubernetes_build_info{cluster="cluster-monitoring-feature-test", job="integrations/kubernetes/kubelet"} type: promql @@ -16,9 +16,12 @@ tests: - query: count(kube_node_info{cluster="cluster-monitoring-feature-test", job="integrations/kubernetes/kube-state-metrics"}) type: promql expect: - value: 2 + value: 1 - query: node_exporter_build_info{cluster="cluster-monitoring-feature-test", job="integrations/node-exporter"} type: promql - query: count_over_time({cluster="cluster-monitoring-feature-test", job="integrations/kubernetes/eventhandler"}[1h]) type: logql + +attempts: 3 +delay: 30 diff --git a/charts/k8s-monitoring/tests/integration/cluster-monitoring/values.yaml b/charts/k8s-monitoring/tests/integration/cluster-monitoring/values.yaml index 343d9f2e8..c8dcd9b0a 100644 --- a/charts/k8s-monitoring/tests/integration/cluster-monitoring/values.yaml +++ b/charts/k8s-monitoring/tests/integration/cluster-monitoring/values.yaml @@ -9,8 +9,10 @@ destinations: tenantId: "1" auth: type: basic - username: loki - password: lokipassword + username: promuser + password: prometheuspassword + tls: + insecureSkipVerify: true - name: localLoki type: loki url: http://loki.loki.svc:3100/loki/api/v1/push