This repository was archived by the owner on Feb 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
internal/pkg/skuba/kubernetes
pkg/skuba/actions/addon/upgrade Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -285,3 +285,14 @@ func AllNodesMatchClusterVersionWithVersioningInfo(allNodesVersioningInfo NodeVe
285285 }
286286 return true
287287}
288+
289+ // AllNodesTolerateVersionWithVersioningInfo returns if all nodes tolerate a specific kubernetes version
290+ // This can be used to determine e.g. if an upgrade is ongoing
291+ func AllNodesTolerateClusterVersionWithVersioningInfo (allNodesVersioningInfo NodeVersionInfoMap , clusterVersion * version.Version ) bool {
292+ for _ , version := range allNodesVersioningInfo {
293+ if ! version .ToleratesClusterVersion (clusterVersion ) {
294+ return false
295+ }
296+ }
297+ return true
298+ }
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ func Apply(client clientset.Interface) error {
6565 if err != nil {
6666 return err
6767 }
68- allNodesMatchClusterVersion := kubernetes .AllNodesMatchClusterVersionWithVersioningInfo (allNodesVersioningInfo , currentClusterVersion )
68+ allNodesMatchClusterVersion := kubernetes .AllNodesTolerateClusterVersionWithVersioningInfo (allNodesVersioningInfo , currentClusterVersion )
6969 fmt .Printf ("Current Kubernetes cluster version: %s\n " , currentVersion )
7070 fmt .Printf ("Latest Kubernetes version: %s\n " , latestVersion )
7171 fmt .Println ()
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ func Plan(client clientset.Interface) error {
6262 if err != nil {
6363 return err
6464 }
65- allNodesMatchClusterVersion := kubernetes .AllNodesMatchClusterVersionWithVersioningInfo (allNodesVersioningInfo , currentClusterVersion )
65+ allNodesMatchClusterVersion := kubernetes .AllNodesTolerateClusterVersionWithVersioningInfo (allNodesVersioningInfo , currentClusterVersion )
6666 fmt .Printf ("Current Kubernetes cluster version: %s\n " , currentVersion )
6767 fmt .Printf ("Latest Kubernetes version: %s\n " , latestVersion )
6868 fmt .Println ()
You can’t perform that action at this time.
0 commit comments