Skip to content

Commit 6537618

Browse files
authored
Expose metrics port on client service (#299)
2 parents 1bbe904 + 86322fd commit 6537618

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

internal/controller/factory/svc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ func CreateOrUpdateClientService(
109109
Spec: corev1.ServiceSpec{
110110
Ports: []corev1.ServicePort{
111111
{Name: "client", TargetPort: intstr.FromInt32(2379), Port: 2379, Protocol: corev1.ProtocolTCP},
112+
{Name: "metrics", TargetPort: intstr.FromInt32(2381), Port: 2381, Protocol: corev1.ProtocolTCP},
112113
},
113114
Type: corev1.ServiceTypeClusterIP,
114115
Selector: NewLabelsBuilder().WithName().WithInstance(cluster.Name).WithManagedBy(),

internal/controller/factory/svc_test.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ var _ = Describe("CreateOrUpdateService handlers", func() {
167167
Type: corev1.ServiceTypeLoadBalancer,
168168
Ports: []corev1.ServicePort{
169169
{
170-
Name: "client",
171-
Port: 2379,
170+
Name: "customport",
171+
Port: 1234,
172172
Protocol: corev1.ProtocolUDP,
173173
},
174174
},
@@ -181,10 +181,19 @@ var _ = Describe("CreateOrUpdateService handlers", func() {
181181
HaveField("Spec.Type", Equal(corev1.ServiceTypeLoadBalancer)),
182182
HaveField("Spec.LoadBalancerClass", Equal(ptr.To("someClass"))),
183183
HaveField("Spec.Ports", SatisfyAll(
184-
HaveLen(1),
185-
HaveEach(SatisfyAll(
184+
ContainElements(SatisfyAll(
186185
HaveField("Name", Equal("client")),
187186
HaveField("Port", Equal(int32(2379))),
187+
HaveField("Protocol", Equal(corev1.ProtocolTCP)),
188+
)),
189+
ContainElements(SatisfyAll(
190+
HaveField("Name", Equal("metrics")),
191+
HaveField("Port", Equal(int32(2381))),
192+
HaveField("Protocol", Equal(corev1.ProtocolTCP)),
193+
)),
194+
ContainElements(SatisfyAll(
195+
HaveField("Name", Equal("customport")),
196+
HaveField("Port", Equal(int32(1234))),
188197
HaveField("Protocol", Equal(corev1.ProtocolUDP)),
189198
)),
190199
)),

0 commit comments

Comments
 (0)