Skip to content

Commit

Permalink
chore: add config for platform csi provisioner
Browse files Browse the repository at this point in the history
Signed-off-by: rohan2794 <[email protected]>
  • Loading branch information
rohan2794 committed Dec 18, 2024
1 parent 4b5ece3 commit a831ffc
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
2 changes: 2 additions & 0 deletions common/e2e_config/e2e_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ type E2EConfig struct {
FilteredMayastorPodCheck int `yaml:"filteredMayastorPodCheck" env-default:"0"`
// data plane interface
IOEngineTargetNvmfIface string `yaml:"ioengineTargetNvmfIface" env-default:"" env:"e2e_ioengine_target_nvmf_iface"`
// CSI provisioner , HZ: csi.hetzner.cloud
CsiProvisioner string `yaml:"csiProvisioner" env-default:"csi.hetzner.cloud"`
} `yaml:"platform"`
Product ProductSpec `yaml:"product"`

Expand Down
18 changes: 0 additions & 18 deletions common/k8stest/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,24 +380,6 @@ func DeploymentReady(deploymentName, namespace string) bool {
return false
}

func DaemonSetReady(daemonName string, namespace string) bool {
daemon, err := gTestEnv.KubeInt.AppsV1().DaemonSets(namespace).Get(
context.TODO(),
daemonName,
metaV1.GetOptions{},
)
if err != nil {
logf.Log.Info("Failed to get daemonset", "error", err)
return false
}

status := daemon.Status
logf.Log.Info("DaemonSet "+daemonName, "status", status)
return status.DesiredNumberScheduled == status.CurrentNumberScheduled &&
status.DesiredNumberScheduled == status.NumberReady &&
status.DesiredNumberScheduled == status.NumberAvailable
}

func ControlPlaneReady(sleepTime int, duration int) bool {
ready := false
count := (duration + sleepTime - 1) / sleepTime
Expand Down
46 changes: 46 additions & 0 deletions common/k8stest/util_daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package k8stest
import (
"context"
"fmt"
"time"

appsV1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/apps/v1"
coreV1 "k8s.io/api/core/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
logf "sigs.k8s.io/controller-runtime/pkg/log"
)

func ListDaemonSet(namespace string) (v1.DaemonSetList, error) {
Expand Down Expand Up @@ -109,3 +111,47 @@ func UpdateDemonsetContainerAllEnv(daemonsetName string, containerName string, n
}
return nil
}

func WaitForDaemonsetReady(dsName string, namespace string, sleepTime int, duration int) bool {
ready := false
count := (duration + sleepTime - 1) / sleepTime

logf.Log.Info("DaemonsetReadyCheck", "Daemonet", dsName, "namespace", namespace)
for ix := 0; ix < count && !ready; ix++ {
time.Sleep(time.Duration(sleepTime) * time.Second)

ready = DaemonSetReady(dsName, namespace)
logf.Log.Info("DaemonSetReady: ", "daemonset", dsName, "ready", ready)
}

if !ready {
logf.Log.Info("Daemonset not ready", "Daemonset", dsName, "namespace", namespace)
return false
}

// verify pod running
err := WaitForPodRunning(dsName, namespace, duration)
if err != nil {
logf.Log.Info("Pod not ready", "Pod prefix", dsName, "namespace", namespace)
return false
}
return ready
}

func DaemonSetReady(daemonName string, namespace string) bool {
daemon, err := gTestEnv.KubeInt.AppsV1().DaemonSets(namespace).Get(
context.TODO(),
daemonName,
metaV1.GetOptions{},
)
if err != nil {
logf.Log.Info("Failed to get daemonset", "error", err)
return false
}

status := daemon.Status
logf.Log.Info("DaemonSet "+daemonName, "status", status)
return status.DesiredNumberScheduled == status.CurrentNumberScheduled &&
status.DesiredNumberScheduled == status.NumberReady &&
status.DesiredNumberScheduled == status.NumberAvailable
}
1 change: 1 addition & 0 deletions configurations/hcloudci_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ deferredAssert: true
beforeEachCheckAndRestart: true
ioEngineNvmeTimeout: 110
networkInterface: eth0
csiProvisioner: csi.hetzner.cloud

0 comments on commit a831ffc

Please sign in to comment.