@@ -3,6 +3,7 @@ package phase
33import (
44 "encoding/json"
55 "fmt"
6+ "path"
67 "strings"
78
89 "github.com/k0sproject/dig"
@@ -169,13 +170,28 @@ func (p *GatherK0sFacts) needsUpgrade(h *cluster.Host) bool {
169170 // If supplimental files or a k0s binary have been specified explicitly,
170171 // always upgrade. This covers the scenario where a user moves from a
171172 // default-install cluster to one fed by OCI image bundles (ie. airgap)
172- if len (h .Files ) > 0 {
173- log .Debugf ("%s: marked for upgrade because there are %d file uploads for the host" , h , len (h .Files ))
174- return true
173+ for _ , f := range h .Files {
174+ if f .IsURL () {
175+ log .Debugf ("%s: marked for upgrade because there are URL source file uploads for the host" , h )
176+ return true
177+ }
178+
179+ for _ , s := range f .Sources {
180+ dest := f .DestinationFile
181+ if dest == "" {
182+ dest = path .Join (f .DestinationDir , s .Path )
183+ }
184+ src := path .Join (f .Base , s .Path )
185+
186+ if h .FileChanged (src , dest ) {
187+ log .Debugf ("%s: marked for upgrade because file was changed for upload %s" , h , src )
188+ return true
189+ }
190+ }
175191 }
176192
177- if h .K0sBinaryPath != "" {
178- log .Debugf ("%s: marked for upgrade because a static k0s binary path %s" , h , h .K0sBinaryPath )
193+ if h .K0sBinaryPath != "" && h . FileChanged ( h . K0sBinaryPath , h . Configurer . K0sBinaryPath ()) {
194+ log .Debugf ("%s: marked for upgrade because of a static k0s binary path %s" , h , h .K0sBinaryPath )
179195 return true
180196 }
181197
0 commit comments