Skip to content

Commit cd34807

Browse files
authored
[chore] check resattributes and component error in gce (#2331)
1 parent e57a0e9 commit cd34807

File tree

5 files changed

+193
-3
lines changed

5 files changed

+193
-3
lines changed

.github/workflows/functional_test_v2.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,6 @@ jobs:
351351
(github.ref == 'refs/heads/main')
352352
env:
353353
KUBE_TEST_ENV: gce
354-
SKIP_TESTS: "true"
355354
runs-on: ubuntu-latest
356355
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'Ignore Tests') }}
357356
steps:

functional_tests/functional/functional_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const (
6262
aksValuesDir = "expected_aks_values"
6363
gkeValuesDir = "expected_gke_values"
6464
rosaValuesDir = "expected_rosa_values"
65+
gceValuesDir = "expected_gce_values"
6566
agentLabelSelector = "component=otel-collector-agent"
6667
clusterReceiverLabelSelector = "component=otel-k8s-cluster-receiver"
6768
linuxPodMetricsPath = "/tmp/metrics.json"
@@ -301,6 +302,8 @@ func deployChartsAndApps(t *testing.T, testKubeConfig string) {
301302
addChartInfo("gke_test_values.yaml.tmpl", internal.GetDefaultChartOptions())
302303
case rosaTestKubeEnv:
303304
addChartInfo("rosa_test_values.yaml.tmpl", internal.GetDefaultChartOptions())
305+
case gceTestKubeEnv:
306+
addChartInfo("gce_test_values.yaml.tmpl", internal.GetDefaultChartOptions())
304307
default:
305308
addChartInfo("test_values.yaml.tmpl", internal.GetDefaultChartOptions())
306309
}
@@ -633,7 +636,7 @@ func runHostedClusterTests(t *testing.T, kubeTestEnv string) {
633636
client, err := kubernetes.NewForConfig(kubeConfig)
634637
require.NoError(t, err)
635638
switch kubeTestEnv {
636-
case eksTestKubeEnv, eksAutoModeTestKubeEnv, aksTestKubeEnv, gkeTestKubeEnv, rosaTestKubeEnv:
639+
case eksTestKubeEnv, eksAutoModeTestKubeEnv, aksTestKubeEnv, gkeTestKubeEnv, rosaTestKubeEnv, gceTestKubeEnv:
637640
expectedValuesDir = selectExpectedValuesDir(kubeTestEnv)
638641
t.Run("agent resource attributes validation", func(t *testing.T) {
639642
validateResourceAttributes(t, client, kubeConfig, "agent")
@@ -643,7 +646,6 @@ func runHostedClusterTests(t *testing.T, kubeTestEnv string) {
643646
})
644647

645648
t.Run("component error logs checks", func(t *testing.T) {
646-
// Limiting the journald error check to EKS only, other clusters have different errors that are not fatal
647649
if kubeTestEnv == eksTestKubeEnv {
648650
internal.CheckComponentHealth(t, client, internal.DefaultNamespace, agentLabelSelector, journaldReceiverName)
649651
}
@@ -673,6 +675,8 @@ func selectExpectedValuesDir(kubeTestEnv string) string {
673675
return gkeValuesDir
674676
case rosaTestKubeEnv:
675677
return rosaValuesDir
678+
case gceTestKubeEnv:
679+
return gceValuesDir
676680
default:
677681
return eksValuesDir
678682
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
resourceMetrics:
2+
- resource:
3+
attributes:
4+
- key: cluster_name
5+
value:
6+
stringValue: abcd
7+
- key: customfield1
8+
value:
9+
stringValue: abcd
10+
- key: customfield2
11+
value:
12+
stringValue: abcd
13+
- key: host.name
14+
value:
15+
stringValue: abcd
16+
- key: k8s.cluster.name
17+
value:
18+
stringValue: ci-k8s-cluster
19+
- key: k8s.namespace.name
20+
value:
21+
stringValue: abcd
22+
- key: k8s.node.name
23+
value:
24+
stringValue: abcd
25+
- key: k8s.pod.name
26+
value:
27+
stringValue: abcd
28+
- key: k8s.pod.uid
29+
value:
30+
stringValue: abcd
31+
- key: os.type
32+
value:
33+
stringValue: abcd
34+
- key: otelcol.service.mode
35+
value:
36+
stringValue: abcd
37+
- key: server.port
38+
value:
39+
stringValue: abcd
40+
- key: service.instance.id
41+
value:
42+
stringValue: abcd
43+
- key: service.name
44+
value:
45+
stringValue: abcd
46+
- key: service.version
47+
value:
48+
stringValue: abcd
49+
- key: url.scheme
50+
value:
51+
stringValue: abcd
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
resourceMetrics:
2+
- resource:
3+
attributes:
4+
- key: cluster_name
5+
value:
6+
stringValue: abcd
7+
- key: customfield1
8+
value:
9+
stringValue: abcd
10+
- key: customfield2
11+
value:
12+
stringValue: abcd
13+
- key: host.name
14+
value:
15+
stringValue: abcd
16+
- key: k8s.cluster.name
17+
value:
18+
stringValue: ci-k8s-cluster
19+
- key: k8s.namespace.name
20+
value:
21+
stringValue: abcd
22+
- key: k8s.node.name
23+
value:
24+
stringValue: abcd
25+
- key: k8s.pod.name
26+
value:
27+
stringValue: abcd
28+
- key: k8s.pod.uid
29+
value:
30+
stringValue: abcd
31+
- key: metric_source
32+
value:
33+
stringValue: abcd
34+
- key: os.type
35+
value:
36+
stringValue: abcd
37+
- key: otelcol.service.mode
38+
value:
39+
stringValue: abcd
40+
- key: server.port
41+
value:
42+
stringValue: abcd
43+
- key: service.instance.id
44+
value:
45+
stringValue: abcd
46+
- key: service.name
47+
value:
48+
stringValue: abcd
49+
- key: service.version
50+
value:
51+
stringValue: abcd
52+
- key: url.scheme
53+
value:
54+
stringValue: abcd
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
splunkObservability:
3+
realm: CHANGEME
4+
accessToken: CHANGEME
5+
ingestUrl: {{ .AgentEndpoint }}
6+
apiUrl: {{ .ApiURLEndpoint }}
7+
8+
splunkPlatform:
9+
token: foobar
10+
endpoint: {{ .LogHecEndpoint }}
11+
metricsEnabled: true
12+
metricsIndex: myMetricsIndex
13+
14+
autodetect:
15+
prometheus: true
16+
17+
logsCollection:
18+
journald:
19+
enabled: true
20+
directory: /run/log/journal
21+
22+
agent:
23+
config:
24+
exporters:
25+
file:
26+
path: /tmp/metrics.json
27+
otlp:
28+
endpoint: {{ .OtlpEndpoint }}
29+
tls:
30+
insecure: true
31+
splunk_hec/platform_metrics:
32+
endpoint: {{ .MetricHecEndpoint }}
33+
service:
34+
pipelines:
35+
metrics/agent:
36+
exporters:
37+
- file
38+
traces:
39+
exporters:
40+
- otlp
41+
clusterReceiver:
42+
eventsEnabled: true
43+
config:
44+
exporters:
45+
file:
46+
path: /tmp/metrics.json
47+
signalfx:
48+
ingest_url: {{ .K8sClusterEndpoint }}
49+
tls:
50+
insecure: true
51+
splunk_hec/platform_logs:
52+
endpoint: {{ .LogObjectsHecEndpoint }}
53+
service:
54+
pipelines:
55+
metrics/collector:
56+
exporters:
57+
- file
58+
59+
extraAttributes:
60+
fromAnnotations:
61+
- key: splunk.com/customField
62+
tag_name: customField
63+
fromLabels:
64+
- key: app
65+
from: pod
66+
- key: app
67+
from: namespace
68+
69+
custom:
70+
- name: "cluster_name"
71+
value: "ci-k8s-cluster"
72+
- name: "customfield1"
73+
value: "customvalue1"
74+
- name: "customfield2"
75+
value: "customvalue2"
76+
77+
clusterName: ci-k8s-cluster
78+
environment: dev
79+
operatorcrds:
80+
install: false
81+
operator:
82+
enabled: false

0 commit comments

Comments
 (0)