pkg/daemon: clarify function naming and description
The `validate()` function was documented as retriggering the update when
really it just determined whether an update was needed. Fix the
documentation there. Also rename it to something more explicit to make
things easier to grok.
@@ -86,11 +86,11 @@ func (dn *Daemon) Run(stop <-chan struct{}) error {
// syncOnce only completes once.
func (dn *Daemon) syncOnce() error {
// validate that the machine correctly made it to the target state
- status, err := dn.validate()
+ isDesired, err := dn.isDesiredMachineState()
if err != nil {
return err
}
- if !status {
+ if !isDesired {
return dn.triggerUpdate()
}
@@ -143,11 +143,11 @@ func (dn *Daemon) triggerUpdate() error {
return dn.update(currentConfig, desiredConfig)
}
-// validate confirms that the node is actually in the state that it wants to be
-// in. it does this by looking at the elements in the target config and checks
-// if all are present on the node. if any file/unit is missing or there is a
-// mismatch, it re-triggers the update.
-func (dn *Daemon) validate() (bool, error) {
+// isDesiredMachineState confirms that the node is actually in the state that it
+// wants to be in. It does this by looking at the elements in the target config
+// and checks if all are present on the node. Returns true iff there are no
+// mismatches (e.g. files, units... XXX: but not yet OS version).
+func (dn *Daemon) isDesiredMachineState() (bool, error) {
ccAnnotation, err := getNodeAnnotation(dn.kubeClient.CoreV1().Nodes(), dn.name, CurrentMachineConfigAnnotationKey)
if err != nil {
return false, err
