Refine controller template and probe listeners
This commit is contained in:
@@ -152,14 +152,11 @@ func watchOnce(
|
||||
if !targetsNode(item, nodeName) {
|
||||
continue
|
||||
}
|
||||
if !shouldHandle(item) {
|
||||
continue
|
||||
}
|
||||
|
||||
klog.InfoS("found existing osupgradeprogress",
|
||||
"name", item.Name,
|
||||
"node", nodeName,
|
||||
"phase", progressPhase(item.Status),
|
||||
"phase", item.StatusPhase(),
|
||||
"resourceVersion", item.ResourceVersion,
|
||||
)
|
||||
|
||||
@@ -227,20 +224,11 @@ func watchOnce(
|
||||
if !targetsNode(osup, nodeName) {
|
||||
continue
|
||||
}
|
||||
if !shouldHandle(osup) {
|
||||
klog.V(2).InfoS("skipping osupgradeprogress due to phase",
|
||||
"name", osup.Name,
|
||||
"node", nodeName,
|
||||
"phase", progressPhase(osup.Status),
|
||||
"eventType", evt.Type,
|
||||
)
|
||||
continue
|
||||
}
|
||||
|
||||
klog.InfoS("received osupgradeprogress event",
|
||||
klog.V(4).InfoS("received osupgradeprogress event",
|
||||
"name", osup.Name,
|
||||
"node", nodeName,
|
||||
"phase", progressPhase(osup.Status),
|
||||
"phase", osup.StatusPhase(),
|
||||
"eventType", evt.Type,
|
||||
"resourceVersion", osup.ResourceVersion,
|
||||
)
|
||||
@@ -262,28 +250,3 @@ func targetsNode(osup *monov1alpha1.OSUpgradeProgress, nodeName string) bool {
|
||||
}
|
||||
return osup.Spec.NodeName == nodeName
|
||||
}
|
||||
|
||||
func shouldHandle(osup *monov1alpha1.OSUpgradeProgress) bool {
|
||||
if osup == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if osup.Status == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
switch osup.Status.Phase {
|
||||
case "",
|
||||
monov1alpha1.OSUpgradeProgressPhasePending:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func progressPhase(st *monov1alpha1.OSUpgradeProgressStatus) string {
|
||||
if st == nil {
|
||||
return ""
|
||||
}
|
||||
return string(st.Phase)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user