-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from SchSeba/support_pause_on_SNO
Better support for openshift single node
- Loading branch information
Showing
4 changed files
with
146 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package utils | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/golang/glog" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
func IsSingleNodeCluster(c client.Client) (bool, error) { | ||
nodeList := &corev1.NodeList{} | ||
err := c.List(context.TODO(), nodeList) | ||
if err != nil { | ||
glog.Errorf("IsSingleNodeCluster(): Failed to list nodes: %v", err) | ||
return false, err | ||
} | ||
|
||
if len(nodeList.Items) == 1 { | ||
glog.Infof("IsSingleNodeCluster(): one node found in the cluster") | ||
return true, nil | ||
} | ||
|
||
return false, nil | ||
} |