@@ -52,7 +52,7 @@ func newExpectedValue(mode int, value string) *expectedValue {
52
52
53
53
// TestE2E_ClusterRBAC tests the k8s attributes processor in a k8s cluster with the collector's service account having
54
54
// cluster-wide permissions to list/watch namespaces, nodes, pods and replicasets. The config in the test does not
55
- // set filter::namespace.
55
+ // set filter::namespace, and the telemetrygen image has a latest tag but no digest .
56
56
// The test requires a prebuilt otelcontribcol image uploaded to a kind k8s cluster defined in
57
57
// `/tmp/kube-config-otelcol-e2e-testing`. Run the following command prior to running the test locally:
58
58
//
@@ -432,7 +432,8 @@ func TestE2E_ClusterRBAC(t *testing.T) {
432
432
}
433
433
}
434
434
435
- // Test with `filter::namespace` set and only role binding to collector's SA. We can't get node and namespace labels/annotations.
435
+ // Test with `filter::namespace` set and only role binding to collector's SA. We can't get node and namespace labels/annotations,
436
+ // and the telemetrygen image has a digest but no tag.
436
437
func TestE2E_NamespacedRBAC (t * testing.T ) {
437
438
438
439
testDir := filepath .Join ("testdata" , "e2e" , "namespacedrbac" )
@@ -504,7 +505,7 @@ func TestE2E_NamespacedRBAC(t *testing.T) {
504
505
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
505
506
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
506
507
"container.image.repo_digests" : newExpectedValue (regex , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}" ),
507
- "container.image.tag" : newExpectedValue (equal , "latest " ),
508
+ "container.image.tag" : newExpectedValue (exist , "" ),
508
509
"container.id" : newExpectedValue (exist , "" ),
509
510
},
510
511
},
@@ -528,7 +529,7 @@ func TestE2E_NamespacedRBAC(t *testing.T) {
528
529
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
529
530
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
530
531
"container.image.repo_digests" : newExpectedValue (regex , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}" ),
531
- "container.image.tag" : newExpectedValue (equal , "latest " ),
532
+ "container.image.tag" : newExpectedValue (exist , "" ),
532
533
"container.id" : newExpectedValue (exist , "" ),
533
534
},
534
535
},
@@ -552,7 +553,7 @@ func TestE2E_NamespacedRBAC(t *testing.T) {
552
553
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
553
554
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
554
555
"container.image.repo_digests" : newExpectedValue (regex , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}" ),
555
- "container.image.tag" : newExpectedValue (equal , "latest " ),
556
+ "container.image.tag" : newExpectedValue (exist , "" ),
556
557
"container.id" : newExpectedValue (exist , "" ),
557
558
},
558
559
},
@@ -575,7 +576,7 @@ func TestE2E_NamespacedRBAC(t *testing.T) {
575
576
}
576
577
577
578
// Test with `filter::namespace` set, role binding for namespace-scoped objects (pod, replicaset) and clusterrole
578
- // binding for node and namespace objects.
579
+ // binding for node and namespace objects, and the telemetrygen image has a tag and digest .
579
580
func TestE2E_MixRBAC (t * testing.T ) {
580
581
581
582
testDir := filepath .Join ("testdata" , "e2e" , "mixrbac" )
@@ -662,7 +663,7 @@ func TestE2E_MixRBAC(t *testing.T) {
662
663
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
663
664
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
664
665
"container.image.repo_digests" : newExpectedValue (regex , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}" ),
665
- "container.image.tag" : newExpectedValue (equal , "latest " ),
666
+ "container.image.tag" : newExpectedValue (equal , "0.112.0 " ),
666
667
"container.id" : newExpectedValue (exist , "" ),
667
668
"k8s.namespace.labels.foons" : newExpectedValue (equal , "barns" ),
668
669
"k8s.node.labels.foo" : newExpectedValue (equal , "too" ),
@@ -689,7 +690,7 @@ func TestE2E_MixRBAC(t *testing.T) {
689
690
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
690
691
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
691
692
"container.image.repo_digests" : newExpectedValue (regex , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}" ),
692
- "container.image.tag" : newExpectedValue (equal , "latest " ),
693
+ "container.image.tag" : newExpectedValue (equal , "0.112.0 " ),
693
694
"container.id" : newExpectedValue (exist , "" ),
694
695
"k8s.namespace.labels.foons" : newExpectedValue (equal , "barns" ),
695
696
"k8s.node.labels.foo" : newExpectedValue (equal , "too" ),
@@ -716,7 +717,7 @@ func TestE2E_MixRBAC(t *testing.T) {
716
717
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
717
718
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
718
719
"container.image.repo_digests" : newExpectedValue (regex , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen@sha256:[0-9a-fA-f]{64}" ),
719
- "container.image.tag" : newExpectedValue (equal , "latest " ),
720
+ "container.image.tag" : newExpectedValue (equal , "0.112.0 " ),
720
721
"container.id" : newExpectedValue (exist , "" ),
721
722
"k8s.namespace.labels.foons" : newExpectedValue (equal , "barns" ),
722
723
"k8s.node.labels.foo" : newExpectedValue (equal , "too" ),
@@ -745,7 +746,8 @@ func TestE2E_MixRBAC(t *testing.T) {
745
746
// While `k8s.pod.ip` is not set in `k8sattributes:extract:metadata` and the `pod_association` is not `connection`
746
747
// we expect that the `k8s.pod.ip` metadata is not added.
747
748
// While `container.image.repo_digests` is not set in `k8sattributes::extract::metadata`, we expect
748
- // that the `container.image.repo_digests` metadata is not added
749
+ // that the `container.image.repo_digests` metadata is not added.
750
+ // The telemetrygen image has neither a tag nor digest (implicitly latest version)
749
751
func TestE2E_NamespacedRBACNoPodIP (t * testing.T ) {
750
752
testDir := filepath .Join ("testdata" , "e2e" , "namespaced_rbac_no_pod_ip" )
751
753
@@ -816,7 +818,7 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) {
816
818
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
817
819
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
818
820
"container.image.repo_digests" : newExpectedValue (shouldnotexist , "" ),
819
- "container.image.tag" : newExpectedValue (equal , "latest " ),
821
+ "container.image.tag" : newExpectedValue (exist , "" ),
820
822
"container.id" : newExpectedValue (exist , "" ),
821
823
},
822
824
},
@@ -840,7 +842,7 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) {
840
842
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
841
843
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
842
844
"container.image.repo_digests" : newExpectedValue (shouldnotexist , "" ),
843
- "container.image.tag" : newExpectedValue (equal , "latest " ),
845
+ "container.image.tag" : newExpectedValue (exist , "" ),
844
846
"container.id" : newExpectedValue (exist , "" ),
845
847
},
846
848
},
@@ -864,7 +866,7 @@ func TestE2E_NamespacedRBACNoPodIP(t *testing.T) {
864
866
"k8s.container.name" : newExpectedValue (equal , "telemetrygen" ),
865
867
"container.image.name" : newExpectedValue (equal , "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen" ),
866
868
"container.image.repo_digests" : newExpectedValue (shouldnotexist , "" ),
867
- "container.image.tag" : newExpectedValue (equal , "latest " ),
869
+ "container.image.tag" : newExpectedValue (exist , "" ),
868
870
"container.id" : newExpectedValue (exist , "" ),
869
871
},
870
872
},
0 commit comments