-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e:config: adapt suite for hypershift
Adding the relevant code for configuring performanceProfile over hypershift Signed-off-by: Talor Itzhak <[email protected]>
- Loading branch information
Showing
4 changed files
with
149 additions
and
37 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
42 changes: 42 additions & 0 deletions
42
test/e2e/performanceprofile/functests/utils/nodepools/nodepools.go
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,42 @@ | ||
package nodepools | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/util/wait" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
|
||
hypershiftv1beta1 "github.com/openshift/hypershift/api/hypershift/v1beta1" | ||
) | ||
|
||
func WaitForUpdatingConfig(ctx context.Context, c client.Client, NpName, namespace string) error { | ||
return waitForCondition(ctx, c, NpName, namespace, func(cond hypershiftv1beta1.NodePoolCondition) (done bool, err error) { | ||
if cond.Type == "UpdatingConfig" { | ||
return cond.Status == corev1.ConditionTrue, nil | ||
} | ||
return false, nil | ||
}) | ||
} | ||
|
||
func WaitForConfigToBeReady(ctx context.Context, c client.Client, NpName, namespace string) error { | ||
return waitForCondition(ctx, c, NpName, namespace, func(cond hypershiftv1beta1.NodePoolCondition) (done bool, err error) { | ||
if cond.Type == "UpdatingConfig" { | ||
return cond.Status == corev1.ConditionFalse, nil | ||
} | ||
return false, nil | ||
}) | ||
} | ||
|
||
func waitForCondition(ctx context.Context, c client.Client, NpName, namespace string, conditionFunc func(hypershiftv1beta1.NodePoolCondition) (done bool, err error)) error { | ||
return wait.PollUntilContextTimeout(ctx, time.Second*10, time.Minute*20, false, func(ctx context.Context) (done bool, err error) { | ||
np := &hypershiftv1beta1.NodePool{} | ||
key := client.ObjectKey{Name: NpName, Namespace: namespace} | ||
err = c.Get(ctx, key, np) | ||
for _, cond := range np.Status.Conditions { | ||
return conditionFunc(cond) | ||
} | ||
return false, nil | ||
}) | ||
} |