diff --git a/pkg/yurtmanager/controller/daemonpodupdater/daemon_pod_updater_controller.go b/pkg/yurtmanager/controller/daemonpodupdater/daemon_pod_updater_controller.go index bc6691813a4..da69f146ca0 100644 --- a/pkg/yurtmanager/controller/daemonpodupdater/daemon_pod_updater_controller.go +++ b/pkg/yurtmanager/controller/daemonpodupdater/daemon_pod_updater_controller.go @@ -65,15 +65,15 @@ var ( ) const ( - // UpdateAnnotation is the annotation key used in daemonset spec to indicate + // UpdateAnnotation is the annotation key used in DaemonSet spec to indicate // which update strategy is selected. Currently, "OTA" and "AdvancedRollingUpdate" are supported. UpdateAnnotation = "apps.openyurt.io/update-strategy" - // OTAUpdate set daemonset to over-the-air update mode. + // OTAUpdate set DaemonSet to over-the-air update mode. // In daemonPodUpdater controller, we add PodNeedUpgrade condition to pods. OTAUpdate = "OTA" - // AutoUpdate set daemonset to Auto update mode. - // In this mode, daemonset will keep updating even if there are not-ready nodes. + // AutoUpdate set DaemonSet to Auto update mode. + // In this mode, DaemonSet will keep updating even if there are not-ready nodes. // For more details, see https://github.com/openyurtio/openyurt/pull/921. AutoUpdate = "Auto" AdvancedRollingUpdate = "AdvancedRollingUpdate" @@ -81,7 +81,7 @@ const ( // PodNeedUpgrade indicates whether the pod is able to upgrade. PodNeedUpgrade corev1.PodConditionType = "PodNeedUpgrade" - // MaxUnavailableAnnotation is the annotation key added to daemonset to indicate + // MaxUnavailableAnnotation is the annotation key added to DaemonSet to indicate // the max unavailable pods number. It's used with "apps.openyurt.io/update-strategy=AdvancedRollingUpdate". // If this annotation is not explicitly stated, it will be set to the default value 1. MaxUnavailableAnnotation = "apps.openyurt.io/max-unavailable" @@ -176,7 +176,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { return nil } -// daemonsetUpdate filter events: daemonset update with customized annotation +// daemonsetUpdate filter events: DaemonSet update with customized annotation func daemonsetUpdate(evt event.UpdateEvent) bool { if _, ok := evt.ObjectOld.(*appsv1.DaemonSet); !ok { return false @@ -185,7 +185,7 @@ func daemonsetUpdate(evt event.UpdateEvent) bool { oldDS := evt.ObjectOld.(*appsv1.DaemonSet) newDS := evt.ObjectNew.(*appsv1.DaemonSet) - // Only handle daemonset meets prerequisites + // Only handle DaemonSet meets prerequisites if !checkPrerequisites(newDS) { return false } @@ -194,7 +194,7 @@ func daemonsetUpdate(evt event.UpdateEvent) bool { return false } - klog.V(5).Infof("Got daemonset udpate event: %v", newDS.Name) + klog.V(5).Infof("Got DaemonSet update event: %v", newDS.Name) return true } @@ -225,8 +225,8 @@ func (r *ReconcileDaemonpodupdater) Reconcile(_ context.Context, request reconci return reconcile.Result{}, nil } - // Only process daemonset that meets expectations - // Otherwise, wait native daemonset controller reconciling + // Only process DaemonSet that meets expectations + // Otherwise, wait native DaemonSet controller reconciling if !r.expectations.SatisfiedExpectations(request.NamespacedName.String()) { return reconcile.Result{}, nil } @@ -234,7 +234,7 @@ func (r *ReconcileDaemonpodupdater) Reconcile(_ context.Context, request reconci // Recheck required annotation v, ok := instance.Annotations[UpdateAnnotation] if !ok { - klog.V(4).Infof("won't sync daemonset %q without annotation 'apps.openyurt.io/update-strategy'", + klog.V(4).Infof("won't sync DaemonSet %q without annotation 'apps.openyurt.io/update-strategy'", request.NamespacedName) return reconcile.Result{}, nil } @@ -266,7 +266,7 @@ func (r *ReconcileDaemonpodupdater) deletePod(evt event.DeleteEvent, _ workqueue return } - klog.V(5).Infof("Daemonset pod %s deleted.", pod.Name) + klog.V(5).Infof("DaemonSet pod %s deleted.", pod.Name) controllerRef := metav1.GetControllerOf(pod) if controllerRef == nil { @@ -278,7 +278,7 @@ func (r *ReconcileDaemonpodupdater) deletePod(evt event.DeleteEvent, _ workqueue return } - // Only care daemonset meets prerequisites + // Only care DaemonSet meets prerequisites if !checkPrerequisites(ds) { return } @@ -291,8 +291,8 @@ func (r *ReconcileDaemonpodupdater) deletePod(evt event.DeleteEvent, _ workqueue r.expectations.DeletionObserved(dsKey) } -// otaUpdate compare every pod to its owner daemonset to check if pod is updatable -// If pod is in line with the latest daemonset spec, set pod condition "PodNeedUpgrade" to "false" +// otaUpdate compare every pod to its owner DaemonSet to check if pod is updatable +// If pod is in line with the latest DaemonSet spec, set pod condition "PodNeedUpgrade" to "false" // while not, set pod condition "PodNeedUpgrade" to "true" func (r *ReconcileDaemonpodupdater) otaUpdate(ds *appsv1.DaemonSet) error { pods, err := GetDaemonsetPods(r.Client, ds) @@ -328,7 +328,7 @@ func (r *ReconcileDaemonpodupdater) advancedRollingUpdate(ds *appsv1.DaemonSet) for nodeName, pods := range nodeToDaemonPods { // Check if node is ready, ignore not-ready node - // this is a significant difference from the native daemonset controller + // this is a significant difference from the native DaemonSet controller ready, err := NodeReadyByName(r.Client, nodeName) if err != nil { return fmt.Errorf("couldn't check node %q ready status, %v", nodeName, err)