grafana / k6-operator

An operator for running distributed k6 tests.
Apache License 2.0
592 stars 166 forks source link

ERROR controllers.K6 Failed to launch k6 rule check-for-env-label failed at path /spec/template/metadata/labels/tags.datadoghq.com/env #461

Closed arpitrege123 closed 1 month ago

arpitrege123 commented 2 months ago

Brief summary

error from k6-operator-controller-manager even though the tags are added . ERROR Reconciler error {"controller": "k6", "controllerGroup": "k6.io", "controllerKind": "K6", "K6": {"name":"k6-sample","namespace":"default"}, "namespace": "default", "name": "k6-sample", "reconcileID": "", "error": "admission webhook \"validate.kyverno.svc-ignore\" denied the request: \n\nresource Job/default/k6-sample-initializer was blocked due to the following policies \n\nrequire-dd-label:\n check-for-env-label: 'validation error: The label tags.datadoghq.com/env is required.\n rule check-for-env-label failed at path /spec/template/metadata/labels/tags.datadoghq.com/env/'\n"}

k6-operator version or image

k6-operator:latest

Helm chart version (if applicable)

No response

TestRun / PrivateLoadZone YAML

apiVersion: k6.io/v1alpha1 kind: K6 metadata: name: k6-sample labels: tags.datadoghq.com/env: perf-test tags.datadoghq.com/service: k6-operator annotations: linkerd.io/inject: enabled spec: parallelism: 1 script: configMap: name: k6-test file: k6_script_notifySessionFlow.js template: metadata: labels: tags.datadoghq.com/env: perf-test tags.datadoghq.com/service: k6-operator

Other environment details (if applicable)

No response

Steps to reproduce the problem

Getting error while deploying the above Yaml for k6 crd kubectl apply -f k6run.yaml

Expected behaviour

Should spin up new pod

Actual behaviour

getting error in k6-operator-system logs

arpitrege123 commented 2 months ago

Tried it with kind: TestRun as well , same error

yorugac commented 1 month ago

Hi @arpitrege123, it appears your setup requires k6 pods to have a tags.datadoghq.com/env label. You can set it with .spec.runner.metadata.labels field. You haven't shared your policy, but I assume starter pod will also need those labels: those are set with .spec.starter.metadata.labels field.

arpitrege123 commented 1 month ago

Yes this works after adding the properties in k6 crd definition . thanks