File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
internal/manifests/targetallocator Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ func Service(params manifests.Params) *corev1.Service {
2323 labels ["app.kubernetes.io/version" ] = "latest"
2424 }
2525
26- selector := Labels (params .OtelCol , naming .TAService ( ))
26+ selector := Labels (params .OtelCol , naming .TargetAllocator ( params . OtelCol . Name ))
2727
2828 return & corev1.Service {
2929 ObjectMeta : metav1.ObjectMeta {
Original file line number Diff line number Diff line change @@ -26,9 +26,18 @@ func TestServicePorts(t *testing.T) {
2626
2727 ports := []v1.ServicePort {{Name : "targetallocation" , Port : 80 , TargetPort : intstr .FromInt32 (8080 )}}
2828
29+ expectedLabels := map [string ]string {
30+ "app.kubernetes.io/managed-by" : "amazon-cloudwatch-agent-operator" ,
31+ "app.kubernetes.io/instance" : "default.my-instance" ,
32+ "app.kubernetes.io/part-of" : "amazon-cloudwatch-agent" ,
33+ "app.kubernetes.io/component" : "amazon-cloudwatch-agent-target-allocator" ,
34+ "app.kubernetes.io/name" : "my-instance-target-allocator" ,
35+ }
36+
2937 s := Service (params )
3038
3139 assert .Equal (t , ports [0 ].Name , s .Spec .Ports [0 ].Name )
3240 assert .Equal (t , ports [0 ].Port , s .Spec .Ports [0 ].Port )
3341 assert .Equal (t , ports [0 ].TargetPort , s .Spec .Ports [0 ].TargetPort )
42+ assert .Equal (t , expectedLabels , s .Spec .Selector )
3443}
You can’t perform that action at this time.
0 commit comments