Skip to content

Commit 09cac33

Browse files
eddycharlyswiatekm
andauthoredFeb 16, 2024
chore: chainsaw improvements (open-telemetry#2642)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Mikołaj Świątek <mail+sumo@mikolajswiatek.com>
1 parent a62a081 commit 09cac33

File tree

26 files changed

+189
-293
lines changed

26 files changed

+189
-293
lines changed
 

‎CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ KUBEBUILDER_ASSETS=$(./bin/setup-envtest use -p path 1.23) go test ./pkg...
120120

121121
To run the end-to-end tests, you'll need [`kind`](https://kind.sigs.k8s.io) and [`chainsaw`](https://kyverno.github.io/chainsaw). Refer to their documentation for installation instructions.
122122

123-
Once they are installed, the tests can be executed with `make prepare-e2e`, which will build an image to use with the tests, followed by `make e2e`. Each call to the `e2e` target will setup a fresh `kind` cluster, making it safe to be executed multiple times with a single `prepare-e2e` step.
123+
Once they are installed, the tests can be executed with `make prepare-e2e`, which will build an image to use with the tests, followed by `make e2e`. Each call to the `e2e` target will set up a fresh `kind` cluster, making it safe to be executed multiple times with a single `prepare-e2e` step.
124124

125125
The tests are located under `tests/e2e` and are written to be used with `chainsaw`. Refer to their documentation to understand how tests are written.
126126

127-
To evert the changes made by the `make prepare-e2e` run `make reset`.
127+
To revert the changes made by the `make prepare-e2e` run `make reset`.
128128

129129
### OpenShift End to End tests
130130
To run the end-to-end tests written for OpenShift, you'll need a OpenShift cluster.

‎Makefile

+3-16
Original file line numberDiff line numberDiff line change
@@ -361,18 +361,13 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
361361
ENVTEST ?= $(LOCALBIN)/setup-envtest
362362
CHLOGGEN ?= $(LOCALBIN)/chloggen
363363
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint
364+
CHAINSAW ?= $(LOCALBIN)/chainsaw
364365

365366
KUSTOMIZE_VERSION ?= v5.0.3
366367
CONTROLLER_TOOLS_VERSION ?= v0.12.0
367368
GOLANGCI_LINT_VERSION ?= v1.54.0
368369
KIND_VERSION ?= v0.20.0
369-
370-
# Checks if chainsaw is in your PATH
371-
ifneq ($(shell which chainsaw),)
372-
CHAINSAW ?= $(shell which chainsaw)
373-
else
374-
CHAINSAW ?= $(LOCALBIN)/chainsaw
375-
endif
370+
CHAINSAW_VERSION ?= v0.1.4
376371

377372
.PHONY: install-tools
378373
install-tools: kustomize golangci-lint kind controller-gen envtest crdoc kind operator-sdk chainsaw
@@ -406,15 +401,7 @@ crdoc: ## Download crdoc locally if necessary.
406401

407402
.PHONY: chainsaw
408403
chainsaw: ## Find or download chainsaw
409-
ifeq (, $(shell which chainsaw))
410-
@{ \
411-
set -e ;\
412-
go install github.com/kyverno/chainsaw@v0.1.4 ;\
413-
}
414-
CHAINSAW ?= $(GOBIN)/chainsaw
415-
else
416-
CHAINSAW ?= $(shell which chainsaw)
417-
endif
404+
$(call go-get-tool,$(CHAINSAW), github.com/kyverno/chainsaw,$(CHAINSAW_VERSION))
418405

419406
# go-get-tool will 'go get' any package $2 and install it to $1.
420407
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))

‎tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml

+5-17
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,16 @@
22
apiVersion: chainsaw.kyverno.io/v1alpha1
33
kind: Test
44
metadata:
5-
creationTimestamp: null
65
name: instrumentation-apache-httpd
76
spec:
7+
namespaceTemplate:
8+
metadata:
9+
annotations:
10+
openshift.io/sa.scc.uid-range: 1000/1000
11+
openshift.io/sa.scc.supplemental-groups: 3000/1000
812
steps:
913
- name: step-00
1014
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=3000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2715
- apply:
2816
file: 00-install-collector.yaml
2917
- apply:

‎tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-dotnet-musl
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=2000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-dotnet
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=2000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-go
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 0/0
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
@@ -14,12 +19,6 @@ spec:
1419
file: 00-install-instrumentation.yaml
1520
- name: step-01
1621
try:
17-
- script:
18-
content: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=0/0
19-
--overwrite
20-
- script:
21-
content: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000
22-
--overwrite
2322
- script:
2423
content: ./add-scc.sh
2524
- apply:

‎tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-java-other-ns
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-01
1015
try:
@@ -15,22 +20,6 @@ spec:
1520
name: my-other-ns
1621
- name: step-02
1722
try:
18-
- command:
19-
args:
20-
- annotate
21-
- namespace
22-
- ${NAMESPACE}
23-
- openshift.io/sa.scc.uid-range=1000/1000
24-
- --overwrite
25-
entrypoint: kubectl
26-
- command:
27-
args:
28-
- annotate
29-
- namespace
30-
- ${NAMESPACE}
31-
- openshift.io/sa.scc.supplemental-groups=2000/1000
32-
- --overwrite
33-
entrypoint: kubectl
3423
- apply:
3524
file: 02-install-collector.yaml
3625
- apply:

‎tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-java
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=2000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-nginx-contnr-secctx
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 3000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=3000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-nginx-multicontainer
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 3000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=3000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-nginx
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 3000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=3000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-nodejs
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=2000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-python
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=2000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml

+5-16
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,14 @@ metadata:
55
creationTimestamp: null
66
name: instrumentation-sdk
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 2000/1000
813
steps:
914
- name: step-00
1015
try:
11-
- command:
12-
args:
13-
- annotate
14-
- namespace
15-
- ${NAMESPACE}
16-
- openshift.io/sa.scc.uid-range=1000/1000
17-
- --overwrite
18-
entrypoint: kubectl
19-
- command:
20-
args:
21-
- annotate
22-
- namespace
23-
- ${NAMESPACE}
24-
- openshift.io/sa.scc.supplemental-groups=2000/1000
25-
- --overwrite
26-
entrypoint: kubectl
2716
- apply:
2817
file: 00-install-collector.yaml
2918
- apply:

‎tests/e2e-prometheuscr/create-sm-prometheus-exporters/08-install.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ rules:
6464
verbs:
6565
- get
6666
---
67+
apiVersion: rbac.authorization.k8s.io/v1
68+
kind: ClusterRoleBinding
69+
metadata:
70+
name: simplest-targetallocator-create-sm-prometheus
71+
roleRef:
72+
apiGroup: rbac.authorization.k8s.io
73+
kind: ClusterRole
74+
name: create-sm-prometheus
75+
subjects:
76+
- kind: ServiceAccount
77+
name: ta
78+
namespace: create-sm-prometheus
79+
---
6780
apiVersion: opentelemetry.io/v1alpha1
6881
kind: OpenTelemetryCollector
6982
metadata:

‎tests/e2e-prometheuscr/create-sm-prometheus-exporters/chainsaw-test.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,6 @@ spec:
6060
file: 07-error.yaml
6161
- name: step-08
6262
try:
63-
- command:
64-
args:
65-
- create
66-
- clusterrolebinding
67-
- simplest-targetallocator-create-sm-prometheus
68-
- --clusterrole=create-sm-prometheus
69-
- --serviceaccount=create-sm-prometheus:ta
70-
entrypoint: kubectl
7163
- apply:
7264
file: 08-install.yaml
7365
- assert:

‎tests/e2e-targetallocator/targetallocator-features/00-install.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ rules:
2727
- list
2828
- watch
2929
---
30+
apiVersion: rbac.authorization.k8s.io/v1
31+
kind: ClusterRoleBinding
32+
metadata:
33+
name: (join('-', ['default-view', $namespace]))
34+
roleRef:
35+
apiGroup: rbac.authorization.k8s.io
36+
kind: ClusterRole
37+
name: targetallocator-features
38+
subjects:
39+
- kind: ServiceAccount
40+
name: ta
41+
namespace: ($namespace)
42+
---
3043
apiVersion: opentelemetry.io/v1alpha1
3144
kind: OpenTelemetryCollector
3245
metadata:

‎tests/e2e-targetallocator/targetallocator-features/chainsaw-test.yaml

+6-26
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,19 @@ metadata:
55
creationTimestamp: null
66
name: targetallocator-features
77
spec:
8+
namespaceTemplate:
9+
metadata:
10+
annotations:
11+
openshift.io/sa.scc.uid-range: 1000/1000
12+
openshift.io/sa.scc.supplemental-groups: 3000/1000
813
steps:
914
- catch:
1015
- podLogs:
1116
selector: app.kubernetes.io/component=opentelemetry-targetallocator
1217
name: step-00
1318
try:
14-
- command:
15-
args:
16-
- -n
17-
- $NAMESPACE
18-
- create
19-
- clusterrolebinding
20-
- default-view-$NAMESPACE
21-
- --clusterrole=targetallocator-features
22-
- --serviceaccount=$NAMESPACE:ta
23-
entrypoint: kubectl
24-
- command:
25-
args:
26-
- annotate
27-
- namespace
28-
- ${NAMESPACE}
29-
- openshift.io/sa.scc.uid-range=1000/1000
30-
- --overwrite
31-
entrypoint: kubectl
32-
- command:
33-
args:
34-
- annotate
35-
- namespace
36-
- ${NAMESPACE}
37-
- openshift.io/sa.scc.supplemental-groups=3000/1000
38-
- --overwrite
39-
entrypoint: kubectl
4019
- apply:
20+
template: true
4121
file: 00-install.yaml
4222
- assert:
4323
file: 00-assert.yaml

‎tests/e2e-targetallocator/targetallocator-kubernetessd/00-install.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,32 @@ rules:
9292
verbs:
9393
- get
9494
---
95+
apiVersion: rbac.authorization.k8s.io/v1
96+
kind: ClusterRoleBinding
97+
metadata:
98+
name: (join('-', ['ta', $namespace]))
99+
roleRef:
100+
apiGroup: rbac.authorization.k8s.io
101+
kind: ClusterRole
102+
name: targetallocator-kubernetessd
103+
subjects:
104+
- kind: ServiceAccount
105+
name: ta
106+
namespace: ($namespace)
107+
---
108+
apiVersion: rbac.authorization.k8s.io/v1
109+
kind: ClusterRoleBinding
110+
metadata:
111+
name: (join('-', ['collector', $namespace]))
112+
roleRef:
113+
apiGroup: rbac.authorization.k8s.io
114+
kind: ClusterRole
115+
name: collector-kubernetessd
116+
subjects:
117+
- kind: ServiceAccount
118+
name: collector
119+
namespace: ($namespace)
120+
---
95121
apiVersion: opentelemetry.io/v1alpha1
96122
kind: OpenTelemetryCollector
97123
metadata:

‎tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml

+7-22
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,18 @@ metadata:
66
name: targetallocator-kubernetessd
77
spec:
88
steps:
9-
- catch:
10-
- script:
11-
content: ./tests/e2e/smoke-daemonset/check-daemonset.sh
12-
- podLogs:
13-
selector: app.kubernetes.io/managed-by=opentelemetry-operator
14-
name: step-00
9+
- name: step-00
1510
try:
16-
- command:
17-
args:
18-
- create
19-
- clusterrolebinding
20-
- ta-$NAMESPACE
21-
- --clusterrole=targetallocator-kubernetessd
22-
- --serviceaccount=$NAMESPACE:ta
23-
entrypoint: kubectl
24-
- command:
25-
args:
26-
- create
27-
- clusterrolebinding
28-
- collector-$NAMESPACE
29-
- --clusterrole=collector-kubernetessd
30-
- --serviceaccount=$NAMESPACE:collector
31-
entrypoint: kubectl
3211
- apply:
12+
template: true
3313
file: 00-install.yaml
3414
- assert:
3515
file: 00-assert.yaml
16+
catch:
17+
- script:
18+
content: ./tests/e2e/smoke-daemonset/check-daemonset.sh
19+
- podLogs:
20+
selector: app.kubernetes.io/managed-by=opentelemetry-operator
3621
- name: step-01
3722
try:
3823
- apply:

‎tests/e2e-targetallocator/targetallocator-prometheuscr/00-install.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,32 @@ rules:
101101
verbs:
102102
- get
103103
---
104+
apiVersion: rbac.authorization.k8s.io/v1
105+
kind: ClusterRoleBinding
106+
metadata:
107+
name: (join('-', ['ta', $namespace]))
108+
roleRef:
109+
apiGroup: rbac.authorization.k8s.io
110+
kind: ClusterRole
111+
name: targetallocator-prometheuscr
112+
subjects:
113+
- kind: ServiceAccount
114+
name: ta
115+
namespace: ($namespace)
116+
---
117+
apiVersion: rbac.authorization.k8s.io/v1
118+
kind: ClusterRoleBinding
119+
metadata:
120+
name: (join('-', ['collector', $namespace]))
121+
roleRef:
122+
apiGroup: rbac.authorization.k8s.io
123+
kind: ClusterRole
124+
name: collector-prometheuscr
125+
subjects:
126+
- kind: ServiceAccount
127+
name: collector
128+
namespace: ($namespace)
129+
---
104130
apiVersion: opentelemetry.io/v1alpha1
105131
kind: OpenTelemetryCollector
106132
metadata:

‎tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml

+5-20
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,16 @@ metadata:
66
name: targetallocator-prometheuscr
77
spec:
88
steps:
9-
- catch:
10-
- podLogs:
11-
selector: app.kubernetes.io/managed-by=opentelemetry-operator
12-
name: step-00
9+
- name: step-00
1310
try:
14-
- command:
15-
args:
16-
- create
17-
- clusterrolebinding
18-
- ta-$NAMESPACE
19-
- --clusterrole=targetallocator-prometheuscr
20-
- --serviceaccount=$NAMESPACE:ta
21-
entrypoint: kubectl
22-
- command:
23-
args:
24-
- create
25-
- clusterrolebinding
26-
- collector-$NAMESPACE
27-
- --clusterrole=collector-prometheuscr
28-
- --serviceaccount=$NAMESPACE:collector
29-
entrypoint: kubectl
3011
- apply:
12+
template: true
3113
file: 00-install.yaml
3214
- assert:
3315
file: 00-assert.yaml
16+
catch:
17+
- podLogs:
18+
selector: app.kubernetes.io/managed-by=opentelemetry-operator
3419
- name: step-01
3520
try:
3621
- apply:

‎tests/e2e/prometheus-config-validation/00-promreceiver-allocatorconfig.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ rules:
1919
- list
2020
- watch
2121
---
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: ClusterRoleBinding
24+
metadata:
25+
name: (join('-', ['default-view', $namespace]))
26+
roleRef:
27+
apiGroup: rbac.authorization.k8s.io
28+
kind: ClusterRole
29+
name: promreceiver-allocatorconfig
30+
subjects:
31+
- kind: ServiceAccount
32+
name: ta
33+
namespace: ($namespace)
34+
---
2235
apiVersion: opentelemetry.io/v1alpha1
2336
kind: OpenTelemetryCollector
2437
metadata:

‎tests/e2e/prometheus-config-validation/chainsaw-test.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ spec:
88
steps:
99
- name: step-00
1010
try:
11-
- script:
12-
content: |
13-
kubectl -n $NAMESPACE \
14-
create clusterrolebinding default-view-$NAMESPACE \
15-
--clusterrole=promreceiver-allocatorconfig \
16-
--serviceaccount=$NAMESPACE:ta
1711
- apply:
12+
template: true
1813
file: 00-promreceiver-allocatorconfig.yaml
1914
- assert:
2015
file: 00-assert.yaml

‎tests/e2e/smoke-targetallocator/00-install.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ rules:
1919
- list
2020
- watch
2121
---
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: ClusterRoleBinding
24+
metadata:
25+
name: (join('-', ['default-view', $namespace]))
26+
roleRef:
27+
apiGroup: rbac.authorization.k8s.io
28+
kind: ClusterRole
29+
name: smoke-targetallocator
30+
subjects:
31+
- kind: ServiceAccount
32+
name: ta
33+
namespace: ($namespace)
34+
---
2235
apiVersion: opentelemetry.io/v1alpha1
2336
kind: OpenTelemetryCollector
2437
metadata:

‎tests/e2e/smoke-targetallocator/chainsaw-test.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@ spec:
1111
selector: app.kubernetes.io/component=opentelemetry-targetallocator
1212
name: step-00
1313
try:
14-
- command:
15-
args:
16-
- -n
17-
- $NAMESPACE
18-
- create
19-
- clusterrolebinding
20-
- default-view-$NAMESPACE
21-
- --clusterrole=smoke-targetallocator
22-
- --serviceaccount=$NAMESPACE:ta
23-
entrypoint: kubectl
2414
- apply:
15+
template: true
2516
file: 00-install.yaml
2617
- assert:
2718
file: 00-assert.yaml

0 commit comments

Comments
 (0)
Please sign in to comment.