Skip to content

Commit

Permalink
[RHTAPBUGS-824] Don't overwrite probe ports if they are already set
Browse files Browse the repository at this point in the history
Signed-off-by: John Collier <jcollier@redhat.com>
  • Loading branch information
johnmcollier committed Nov 7, 2023
1 parent ae2136c commit 140f3d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
7 changes: 0 additions & 7 deletions pkg/devfile/devfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,6 @@ func GetResourceFromDevfile(log logr.Logger, devfileData data.DevfileData, deplo
resources.Deployments[0].Spec.Template.Spec.Containers[0].Ports = append(resources.Deployments[0].Spec.Template.Spec.Containers[0].Ports, containerPort)
}

if resources.Deployments[0].Spec.Template.Spec.Containers[0].ReadinessProbe != nil && resources.Deployments[0].Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.TCPSocket != nil {
resources.Deployments[0].Spec.Template.Spec.Containers[0].ReadinessProbe.ProbeHandler.TCPSocket.Port.IntVal = int32(currentPort)
}

if resources.Deployments[0].Spec.Template.Spec.Containers[0].LivenessProbe != nil && resources.Deployments[0].Spec.Template.Spec.Containers[0].LivenessProbe.ProbeHandler.HTTPGet != nil {
resources.Deployments[0].Spec.Template.Spec.Containers[0].LivenessProbe.ProbeHandler.HTTPGet.Port.IntVal = int32(currentPort)
}
}

for _, devfileEnv := range currentENV {
Expand Down
8 changes: 4 additions & 4 deletions pkg/devfile/devfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ schemaVersion: 2.2.0`
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/",
Port: intstr.FromInt(5566),
Port: intstr.FromInt(1111),
},
},
InitialDelaySeconds: int32(10),
Expand All @@ -2160,7 +2160,7 @@ schemaVersion: 2.2.0`
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(5566),
Port: intstr.FromInt(1111),
},
},
InitialDelaySeconds: int32(10),
Expand Down Expand Up @@ -2347,7 +2347,7 @@ schemaVersion: 2.2.0`
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/",
Port: intstr.FromInt(5566),
Port: intstr.FromInt(1111),
},
},
InitialDelaySeconds: int32(10),
Expand All @@ -2364,7 +2364,7 @@ schemaVersion: 2.2.0`
ReadinessProbe: &corev1.Probe{
ProbeHandler: corev1.ProbeHandler{
TCPSocket: &corev1.TCPSocketAction{
Port: intstr.FromInt(5566),
Port: intstr.FromInt(1111),
},
},
InitialDelaySeconds: int32(10),
Expand Down

0 comments on commit 140f3d7

Please sign in to comment.