Skip to content

Commit

Permalink
openshift
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly committed Feb 13, 2024
1 parent fac10b1 commit ecf8697
Show file tree
Hide file tree
Showing 15 changed files with 211 additions and 91 deletions.
6 changes: 0 additions & 6 deletions tests/e2e-openshift/kafka/05-assert.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions tests/e2e-openshift/kafka/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: kafka
spec:
steps:
- name: step-00
try:
- apply:
file: 00-create-kafka-instance.yaml
- assert:
file: 00-assert.yaml
- apply:
file: 01-create-kafka-topics.yaml
- assert:
file: 01-assert.yaml
- apply:
file: 02-otel-kakfa-receiver.yaml
- assert:
file: 02-assert.yaml
- apply:
file: 03-otel-kakfa-exporter.yaml
- assert:
file: 03-assert.yaml
- apply:
file: 04-generate-traces.yaml
- assert:
file: 04-assert.yaml
catch:
- script:
content: ./tests/e2e-openshift/kafka/check_traces.sh
4 changes: 0 additions & 4 deletions tests/e2e-openshift/monitoring/00-assert.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions tests/e2e-openshift/monitoring/03-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ rules:
- get
- list
- watch

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand All @@ -25,9 +24,3 @@ subjects:
- kind: ServiceAccount
name: prometheus-user-workload
namespace: openshift-user-workload-monitoring

---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
commands:
- script: ./tests/e2e-openshift/monitoring/check_metrics.sh
36 changes: 36 additions & 0 deletions tests/e2e-openshift/monitoring/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: monitoring
spec:
steps:
- catch:
- script:
content: ./tests/e2e-openshift/monitoring/check_user_workload_monitoring.sh
name: step-00
try:
- apply:
file: 00-workload-monitoring.yaml
- name: step-01
try:
- apply:
file: 01-otel-collector.yaml
- assert:
file: 01-assert.yaml
- name: step-02
try:
- apply:
file: 02-generate-traces.yaml
- assert:
file: 02-assert.yaml
- catch:
- script:
content: ./tests/e2e-openshift/monitoring/check_metrics.sh
name: step-03
try:
- apply:
file: 03-create-monitoring-roles.yaml
- assert:
file: 03-assert.yaml
30 changes: 12 additions & 18 deletions tests/e2e-openshift/multi-cluster/02-otlp-receiver.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: ./generate_certs.sh

---
apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
name: otlp-receiver
namespace: kuttl-multi-cluster-receive
spec:
mode: "deployment"
ingress:
type: route
route:
termination: "passthrough"
volumes:
- name: kuttl-certs
configMap:
name: kuttl-certs
volumeMounts:
- name: kuttl-certs
mountPath: /certs
config: |
receivers:
otlp:
Expand All @@ -47,3 +29,15 @@ spec:
receivers: [otlp]
processors: []
exporters: [otlp]
ingress:
route:
termination: passthrough
type: route
mode: deployment
volumeMounts:
- mountPath: /certs
name: kuttl-certs
volumes:
- configMap:
name: kuttl-certs
name: kuttl-certs
63 changes: 37 additions & 26 deletions tests/e2e-openshift/multi-cluster/03-otlp-sender.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kuttl-multi-cluster
namespace: kuttl-multi-cluster-send

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kuttl-multi-cluster
rules:
- apiGroups: ["config.openshift.io"]
resources: ["infrastructures", "infrastructures/status"]
verbs: ["get", "watch", "list"]
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["namespaces"]
verbs: ["get", "watch", "list"]

- apiGroups:
- config.openshift.io
resources:
- infrastructures
- infrastructures/status
verbs:
- get
- watch
- list
- apiGroups:
- apps
resources:
- replicasets
verbs:
- get
- watch
- list
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- watch
- list
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- watch
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuttl-multi-cluster
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kuttl-multi-cluster
subjects:
- kind: ServiceAccount
name: kuttl-multi-cluster
namespace: kuttl-multi-cluster-send
roleRef:
kind: ClusterRole
name: kuttl-multi-cluster
apiGroup: rbac.authorization.k8s.io

---
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: ./create_otlp_sender.sh
6 changes: 0 additions & 6 deletions tests/e2e-openshift/multi-cluster/05-assert.yaml

This file was deleted.

37 changes: 37 additions & 0 deletions tests/e2e-openshift/multi-cluster/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: multi-cluster
spec:
steps:
- name: step-00
try:
- apply:
file: 00-create-namespaces.yaml
- assert:
file: 00-assert.yaml
- apply:
file: 01-create-jaeger.yaml
- assert:
file: 01-assert.yaml
- script:
content: ./generate_certs.sh
- apply:
file: 02-otlp-receiver.yaml
- assert:
file: 02-assert.yaml
- script:
content: ./create_otlp_sender.sh
- apply:
file: 03-otlp-sender.yaml
- assert:
file: 03-assert.yaml
- apply:
file: 04-generate-traces.yaml
- assert:
file: 04-assert.yaml
catch:
- script:
content: ./tests/e2e-openshift/multi-cluster/check_traces.sh
4 changes: 0 additions & 4 deletions tests/e2e-openshift/otlp-metrics-traces/01-assert.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions tests/e2e-openshift/otlp-metrics-traces/04-assert.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions tests/e2e-openshift/otlp-metrics-traces/05-assert.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions tests/e2e-openshift/otlp-metrics-traces/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: otlp-metrics-traces
spec:
steps:
- name: step-00
try:
- apply:
file: 00-install-jaeger.yaml
- assert:
file: 00-assert.yaml
- name: step-01
try:
- apply:
file: 01-workload-monitoring.yaml
- apply:
file: 02-otel-metrics-collector.yaml
- assert:
file: 02-assert.yaml
- apply:
file: 03-metrics-traces-gen.yaml
- assert:
file: 03-assert.yaml
catch:
- script:
content: ./tests/e2e-openshift/otlp-metrics-traces/check_user_workload_monitoring.sh
- script:
content: ./tests/e2e-openshift/otlp-metrics-traces/check_traces.sh
- script:
content: ./tests/e2e-openshift/otlp-metrics-traces/check_metrics.sh
9 changes: 0 additions & 9 deletions tests/e2e-openshift/route/01-report-empty-otlphttp-spans.yaml

This file was deleted.

23 changes: 23 additions & 0 deletions tests/e2e-openshift/route/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: route
spec:
steps:
- name: step-00
try:
- apply:
file: 00-install.yaml
- assert:
file: 00-assert.yaml
- name: step-01
try:
- script:
content: |
#!/bin/bash
set -ex
# Export empty payload and check of collector accepted it with 2xx status code
otlp_http_host=$(kubectl get route otlp-http-simplest-route -n $NAMESPACE -o jsonpath='{.spec.host}')
for i in {1..40}; do curl --fail -ivX POST http://${otlp_http_host}:80/v1/traces -H "Content-Type: application/json" -d '{}' && break || sleep 1; done

0 comments on commit ecf8697

Please sign in to comment.