Skip to content

Commit c8a6278

Browse files
committed
fix: Prevent random restarts by declaring the metrics port in the pod manifest
1 parent 779e361 commit c8a6278

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

internal/renderer/dataplane_util.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,11 @@ func generateDataplanePodSpec(c *RenderContext, dataplane *stnrgwv1.Dataplane) (
228228
c.SecurityContext = dataplane.Spec.ContainerSecurityContext.DeepCopy()
229229
}
230230

231-
if dataplane.Spec.EnableMetricsEnpoint {
232-
c.Ports = []corev1.ContainerPort{{
233-
Name: opdefault.DefaultMetricsPortName,
234-
ContainerPort: int32(stnrconfv1.DefaultMetricsPort),
235-
Protocol: corev1.ProtocolTCP,
236-
}}
237-
}
231+
c.Ports = []corev1.ContainerPort{{
232+
Name: opdefault.DefaultMetricsPortName,
233+
ContainerPort: int32(stnrconfv1.DefaultMetricsPort),
234+
Protocol: corev1.ProtocolTCP,
235+
}}
238236

239237
found = true
240238
}

test/managed_mode_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,8 @@ func testManagedMode() {
11721172
// Expect(container.VolumeMounts).To(HaveLen(1))
11731173

11741174
Expect(container.ImagePullPolicy).Should(Equal(corev1.PullAlways))
1175-
Expect(container.Ports).To(HaveLen(0))
1175+
// we always declare the metrics port, even if the metrics server is diabled
1176+
Expect(container.Ports).To(HaveLen(1))
11761177

11771178
// remainder
11781179
Expect(podSpec.TerminationGracePeriodSeconds).NotTo(BeNil())

0 commit comments

Comments
 (0)