Skip to content

Commit

Permalink
virt-controller, template: move the updateProbes funcs
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Duarte Barroso <[email protected]>
  • Loading branch information
maiqueb committed May 25, 2022
1 parent e5681ed commit 7b8f795
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 20 additions & 0 deletions pkg/virt-controller/services/rendercontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,23 @@ func containerPortsFromVMI(vmi *v1.VirtualMachineInstance) []k8sv1.ContainerPort

return ports
}

func updateReadinessProbe(vmi *v1.VirtualMachineInstance, computeProbe *k8sv1.Probe) {
if vmi.Spec.ReadinessProbe.GuestAgentPing != nil {
wrapGuestAgentPingWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
return
}
wrapExecProbeWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
}

func updateLivenessProbe(vmi *v1.VirtualMachineInstance, computeProbe *k8sv1.Probe) {
if vmi.Spec.LivenessProbe.GuestAgentPing != nil {
wrapGuestAgentPingWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
return
}
wrapExecProbeWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
}
20 changes: 0 additions & 20 deletions pkg/virt-controller/services/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -1938,26 +1938,6 @@ func addProbeOverhead(probe *v1.Probe, to *resource.Quantity) bool {
return false
}

func updateReadinessProbe(vmi *v1.VirtualMachineInstance, computeProbe *k8sv1.Probe) {
if vmi.Spec.ReadinessProbe.GuestAgentPing != nil {
wrapGuestAgentPingWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
return
}
wrapExecProbeWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
}

func updateLivenessProbe(vmi *v1.VirtualMachineInstance, computeProbe *k8sv1.Probe) {
if vmi.Spec.LivenessProbe.GuestAgentPing != nil {
wrapGuestAgentPingWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
return
}
wrapExecProbeWithVirtProbe(vmi, computeProbe)
computeProbe.InitialDelaySeconds = computeProbe.InitialDelaySeconds + LibvirtStartupDelay
}

func HaveMasqueradeInterface(interfaces []v1.Interface) bool {
for _, iface := range interfaces {
if iface.Masquerade != nil {
Expand Down

0 comments on commit 7b8f795

Please sign in to comment.