Skip to content

Commit

Permalink
PTX-22165 Validate PX pods correctly when if portworx.io/run-on-maste…
Browse files Browse the repository at this point in the history
…r is passed and is set to True in annotations in the PX StorageCluster

Signed-off-by: nikolaypopov <nikolay.popov86@gmail.com>
  • Loading branch information
nikolaypopov committed Feb 5, 2024
1 parent cc7542d commit f6ec5c8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/util/test/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ func GetExpectedPxNodeList(cluster *corev1.StorageCluster) ([]v1.Node, error) {
}

for _, node := range nodeList.Items {
if coreops.Instance().IsNodeMaster(node) && !IsK3sCluster() {
if coreops.Instance().IsNodeMaster(node) && !IsK3sCluster() && !IsPxDeployedOnMaster(cluster) {
continue
}

Expand All @@ -1535,6 +1535,12 @@ func GetExpectedPxNodeList(cluster *corev1.StorageCluster) ([]v1.Node, error) {
return nodeListWithPxPods, nil
}

// IsPxDeployedOnMaster look for PX StorageCluster annotation that tells PX Operator wether to deploy PX on master or not and return true or false
func IsPxDeployedOnMaster(cluster *corev1.StorageCluster) bool {
deployOnMaster, err := strconv.ParseBool(cluster.Annotations["portworx.io/run-on-master"])
return err == nil && deployOnMaster
}

// ConvertNodeListToNodeNameList takes list of nodes and return list of node names
func ConvertNodeListToNodeNameList(nodeList []v1.Node) []string {
var nodeNameList []string
Expand Down

0 comments on commit f6ec5c8

Please sign in to comment.