Skip to content

Commit 8457e3d

Browse files
committed
fix: UPDATE_EXPECT
1 parent 867f58e commit 8457e3d

8 files changed

+156
-248
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
Request {
22
method: "PATCH",
3-
uri: "/api/v1/namespaces/keramik-test/configmaps/otel-config?&fieldManager=keramik",
3+
uri: "/apis/rbac.authorization.k8s.io/v1/namespaces/keramik-test/rolebindings/monitoring-role-binding?&fieldManager=keramik",
44
headers: {
55
"accept": "application/json",
66
"content-type": "application/apply-patch+yaml",
77
},
88
body: {
9-
"apiVersion": "v1",
10-
"data": {
11-
"otel-config.yaml": "---\nreceivers:\n # Push based metrics\n otlp:\n protocols:\n grpc:\n endpoint: 0.0.0.0:4317\n # Pull based metrics\n prometheus:\n config:\n scrape_configs:\n - job_name: 'kubernetes-service-endpoints'\n scrape_interval: 10s\n scrape_timeout: 1s\n\n kubernetes_sd_configs:\n - role: pod\n\n # Only container ports named `metrics` will be considered valid targets.\n #\n # Setup relabel rules to give meaning to the following k8s annotations:\n # prometheus/path - URL path of the metrics endpoint\n #\n # Example:\n # annotations:\n # prometheus/path: \"/api/v0/metrics\"\n relabel_configs:\n - source_labels: [__meta_kubernetes_pod_container_port_name]\n action: keep\n regex: \"metrics\"\n - source_labels: [__meta_kubernetes_pod_annotation_prometheus_path]\n action: replace\n target_label: __metrics_path__\n regex: (.+)\n - source_labels: [__meta_kubernetes_namespace]\n action: replace\n target_label: kubernetes_namespace\n - source_labels: [__meta_kubernetes_pod_name]\n action: replace\n target_label: kubernetes_pod\n - source_labels: [__meta_kubernetes_pod_container_name]\n action: replace\n target_label: kubernetes_container\n\nprocessors:\n batch:\n\nexporters:\n # This is unused but can be easily added for debugging.\n logging:\n # can be one of detailed | normal | basic\n verbosity: detailed\n # Log all messages, do not sample\n sampling_initial: 1\n sampling_thereafter: 1\n otlp/jaeger:\n endpoint: jaeger:4317\n tls:\n insecure: true\n prometheus:\n endpoint: 0.0.0.0:9464\n # Keep stale metrics around for 1h before dropping\n # This helps as simulation metrics are stale once the simulation stops.\n metric_expiration: 1h\n resource_to_telemetry_conversion:\n enabled: true\n prometheus/simulation:\n endpoint: 0.0.0.0:9465\n # Keep stale metrics around for 1h before dropping\n # This helps as simulation metrics are stale once the simulation stops.\n metric_expiration: 1h\n resource_to_telemetry_conversion:\n enabled: true\n\nservice:\n pipelines:\n traces:\n receivers: [otlp]\n processors: [batch]\n exporters: [otlp/jaeger]\n metrics:\n receivers: [otlp,prometheus]\n processors: [batch]\n exporters: [prometheus]\n metrics/simulation:\n receivers: [otlp]\n processors: [batch]\n exporters: [prometheus/simulation]\n # Enable telemetry on the collector itself\n telemetry:\n logs:\n level: info\n metrics:\n level: detailed\n address: 0.0.0.0:8888"
12-
},
13-
"kind": "ConfigMap",
9+
"apiVersion": "rbac.authorization.k8s.io/v1",
10+
"kind": "RoleBinding",
1411
"metadata": {
1512
"labels": {
1613
"managed-by": "keramik"
1714
},
18-
"name": "otel-config",
15+
"name": "monitoring-role-binding",
1916
"ownerReferences": []
20-
}
17+
},
18+
"roleRef": {
19+
"apiGroup": "rbac.authorization.k8s.io",
20+
"kind": "Role",
21+
"name": "monitoring-role"
22+
},
23+
"subjects": [
24+
{
25+
"kind": "ServiceAccount",
26+
"name": "monitoring-service-account",
27+
"namespace": "keramik-test"
28+
}
29+
]
2130
},
2231
}
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,19 @@
11
Request {
22
method: "PATCH",
3-
uri: "/apis/rbac.authorization.k8s.io/v1/clusterroles/monitoring-cluster-role?&fieldManager=keramik",
3+
uri: "/api/v1/namespaces/keramik-test/serviceaccounts/monitoring-service-account?&fieldManager=keramik",
44
headers: {
55
"accept": "application/json",
66
"content-type": "application/apply-patch+yaml",
77
},
88
body: {
9-
"apiVersion": "rbac.authorization.k8s.io/v1",
10-
"kind": "ClusterRole",
9+
"apiVersion": "v1",
10+
"kind": "ServiceAccount",
1111
"metadata": {
1212
"labels": {
1313
"managed-by": "keramik"
1414
},
15-
"name": "monitoring-cluster-role",
15+
"name": "monitoring-service-account",
1616
"ownerReferences": []
17-
},
18-
"rules": [
19-
{
20-
"apiGroups": [
21-
""
22-
],
23-
"resources": [
24-
"pods"
25-
],
26-
"verbs": [
27-
"get",
28-
"list",
29-
"watch"
30-
]
31-
}
32-
]
17+
}
3318
},
3419
}

operator/src/network/testdata/opentelemetry_crb

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,33 @@
11
Request {
22
method: "PATCH",
3-
uri: "/apis/rbac.authorization.k8s.io/v1/clusterrolebindings/monitoring-cluster-role-binding?&fieldManager=keramik",
3+
uri: "/apis/rbac.authorization.k8s.io/v1/namespaces/keramik-test/roles/monitoring-role?&fieldManager=keramik",
44
headers: {
55
"accept": "application/json",
66
"content-type": "application/apply-patch+yaml",
77
},
88
body: {
99
"apiVersion": "rbac.authorization.k8s.io/v1",
10-
"kind": "ClusterRoleBinding",
10+
"kind": "Role",
1111
"metadata": {
1212
"labels": {
1313
"managed-by": "keramik"
1414
},
15-
"name": "monitoring-cluster-role-binding",
15+
"name": "monitoring-role",
1616
"ownerReferences": []
1717
},
18-
"roleRef": {
19-
"apiGroup": "rbac.authorization.k8s.io",
20-
"kind": "ClusterRole",
21-
"name": "monitoring-cluster-role"
22-
},
23-
"subjects": [
18+
"rules": [
2419
{
25-
"kind": "ServiceAccount",
26-
"name": "monitoring-service-account",
27-
"namespace": "keramik-test"
20+
"apiGroups": [
21+
""
22+
],
23+
"resources": [
24+
"pods"
25+
],
26+
"verbs": [
27+
"get",
28+
"list",
29+
"watch"
30+
]
2831
}
2932
]
3033
},
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,83 @@
11
Request {
22
method: "PATCH",
3-
uri: "/api/v1/namespaces/keramik-test/serviceaccounts/monitoring-service-account?&fieldManager=keramik",
3+
uri: "/apis/apps/v1/namespaces/keramik-test/statefulsets/prometheus?&fieldManager=keramik",
44
headers: {
55
"accept": "application/json",
66
"content-type": "application/apply-patch+yaml",
77
},
88
body: {
9-
"apiVersion": "v1",
10-
"kind": "ServiceAccount",
9+
"apiVersion": "apps/v1",
10+
"kind": "StatefulSet",
1111
"metadata": {
1212
"labels": {
1313
"managed-by": "keramik"
1414
},
15-
"name": "monitoring-service-account",
15+
"name": "prometheus",
1616
"ownerReferences": []
17+
},
18+
"spec": {
19+
"replicas": 1,
20+
"selector": {
21+
"matchLabels": {
22+
"app": "prometheus"
23+
}
24+
},
25+
"serviceName": "",
26+
"template": {
27+
"metadata": {
28+
"labels": {
29+
"app": "prometheus"
30+
}
31+
},
32+
"spec": {
33+
"containers": [
34+
{
35+
"command": [
36+
"/bin/prometheus",
37+
"--web.enable-lifecycle",
38+
"--web.enable-remote-write-receiver",
39+
"--config.file=/config/prom-config.yaml"
40+
],
41+
"image": "prom/prometheus:v2.45.6",
42+
"name": "prometheus",
43+
"ports": [
44+
{
45+
"containerPort": 9090,
46+
"name": "webui"
47+
}
48+
],
49+
"resources": {
50+
"limits": {
51+
"cpu": "250m",
52+
"ephemeral-storage": "1Gi",
53+
"memory": "1Gi"
54+
},
55+
"requests": {
56+
"cpu": "250m",
57+
"ephemeral-storage": "1Gi",
58+
"memory": "1Gi"
59+
}
60+
},
61+
"volumeMounts": [
62+
{
63+
"mountPath": "/config",
64+
"name": "config",
65+
"readOnly": true
66+
}
67+
]
68+
}
69+
],
70+
"volumes": [
71+
{
72+
"configMap": {
73+
"defaultMode": 493,
74+
"name": "prom-config"
75+
},
76+
"name": "config"
77+
}
78+
]
79+
}
80+
}
1781
}
1882
},
1983
}
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,22 @@
11
Request {
22
method: "PATCH",
3-
uri: "/api/v1/namespaces/keramik-test/services/otel?&fieldManager=keramik",
3+
uri: "/api/v1/namespaces/keramik-test/configmaps/otel-config?&fieldManager=keramik",
44
headers: {
55
"accept": "application/json",
66
"content-type": "application/apply-patch+yaml",
77
},
88
body: {
99
"apiVersion": "v1",
10-
"kind": "Service",
10+
"data": {
11+
"otel-config.yaml": "---\nreceivers:\n # Push based metrics\n otlp:\n protocols:\n grpc:\n endpoint: 0.0.0.0:4317\n # Pull based metrics\n prometheus/scrape_configs:\n config:\n scrape_configs:\n - job_name: 'kubernetes-service-endpoints'\n scrape_interval: 10s\n scrape_timeout: 1s\n\n kubernetes_sd_configs:\n - role: pod\n namespaces:\n own_namespace: true\n # Only container ports named `metrics` will be considered valid targets.\n #\n # Setup relabel rules to give meaning to the following k8s annotations:\n # prometheus/path - URL path of the metrics endpoint\n #\n # Example:\n # annotations:\n # prometheus/path: \"/api/v0/metrics\"\n relabel_configs:\n - source_labels: [__meta_kubernetes_pod_container_port_name]\n action: keep\n regex: \"metrics\"\n - source_labels: [__meta_kubernetes_pod_annotation_prometheus_path]\n action: replace\n target_label: __metrics_path__\n regex: (.+)\n - source_labels: [__meta_kubernetes_namespace]\n action: replace\n target_label: kubernetes_namespace\n - source_labels: [__meta_kubernetes_pod_name]\n action: replace\n target_label: kubernetes_pod\n - source_labels: [__meta_kubernetes_pod_container_name]\n action: replace\n target_label: kubernetes_container\n\nprocessors:\n batch:\n\nexporters:\n # This is unused but can be easily added for debugging.\n logging:\n # can be one of detailed | normal | basic\n verbosity: detailed\n # Log all messages, do not sample\n sampling_initial: 1\n sampling_thereafter: 1\n prometheus/endpoint:\n endpoint: 0.0.0.0:9464\n # Keep stale metrics around for 1h before dropping\n # This helps as simulation metrics are stale once the simulation stops.\n metric_expiration: 1h\n resource_to_telemetry_conversion:\n enabled: true\n # Remote write to prometheus\n prometheusremotewrite:\n endpoint: \"http://prometheus:9090/api/v1/write\"\n tls:\n insecure: true\n\nservice:\n pipelines:\n metrics:\n receivers: [otlp,prometheus/scrape_configs]\n processors: [batch]\n exporters: [prometheus/endpoint,prometheusremotewrite]\n # Enable telemetry on the collector itself\n telemetry:\n logs:\n level: debug\n metrics:\n level: detailed\n address: 0.0.0.0:8888\n"
12+
},
13+
"kind": "ConfigMap",
1114
"metadata": {
1215
"labels": {
1316
"managed-by": "keramik"
1417
},
15-
"name": "otel",
18+
"name": "otel-config",
1619
"ownerReferences": []
17-
},
18-
"spec": {
19-
"ports": [
20-
{
21-
"name": "otlp-receiver",
22-
"port": 4317,
23-
"protocol": "TCP",
24-
"targetPort": 4317
25-
},
26-
{
27-
"name": "all-metrics",
28-
"port": 9464,
29-
"protocol": "TCP",
30-
"targetPort": 9464
31-
},
32-
{
33-
"name": "sim-metrics",
34-
"port": 9465,
35-
"protocol": "TCP",
36-
"targetPort": 9465
37-
},
38-
{
39-
"name": "self-metrics",
40-
"port": 8888,
41-
"protocol": "TCP",
42-
"targetPort": 8888
43-
}
44-
],
45-
"selector": {
46-
"app": "otel"
47-
},
48-
"type": "ClusterIP"
4920
}
5021
},
5122
}

0 commit comments

Comments
 (0)