mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-26 08:10:20 +00:00
e2e: use ResourceDeployer for CephFS
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
2b4bb63eb8
commit
60442fa916
113
e2e/cephfs.go
113
e2e/cephfs.go
@ -19,7 +19,6 @@ package e2e
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -69,85 +68,47 @@ func deleteCephfsPlugin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createORDeleteCephfsResources(action kubectlAction) {
|
func createORDeleteCephfsResources(action kubectlAction) {
|
||||||
csiDriver, err := os.ReadFile(cephFSDirPath + csiDriverObject)
|
resources := []ResourceDeployer{
|
||||||
if err != nil {
|
&yamlResource{
|
||||||
// createORDeleteRbdResources is used for upgrade testing as csidriverObject is
|
filename: cephFSDirPath + csiDriverObject,
|
||||||
// newly added, discarding file not found error.
|
allowMissing: true,
|
||||||
if !os.IsNotExist(err) {
|
},
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+csiDriverObject, err)
|
&yamlResource{
|
||||||
}
|
filename: examplePath + cephConfconfigMap,
|
||||||
} else {
|
allowMissing: true,
|
||||||
err = retryKubectlInput(cephCSINamespace, action, string(csiDriver), deployTimeout)
|
},
|
||||||
if err != nil {
|
&yamlResourceNamespaced{
|
||||||
e2elog.Failf("failed to %s CSIDriver object: %v", action, err)
|
filename: cephFSDirPath + cephFSProvisioner,
|
||||||
}
|
namespace: cephCSINamespace,
|
||||||
}
|
oneReplica: true,
|
||||||
cephConf, err := os.ReadFile(examplePath + cephConfconfigMap)
|
},
|
||||||
if err != nil {
|
&yamlResourceNamespaced{
|
||||||
// createORDeleteCephfsResources is used for upgrade testing as cephConfConfigmap is
|
filename: cephFSDirPath + cephFSProvisionerRBAC,
|
||||||
// newly added, discarding file not found error.
|
namespace: cephCSINamespace,
|
||||||
if !os.IsNotExist(err) {
|
},
|
||||||
e2elog.Failf("failed to read content from %s: %v", examplePath+cephConfconfigMap, err)
|
&yamlResourceNamespaced{
|
||||||
}
|
filename: cephFSDirPath + cephFSProvisionerPSP,
|
||||||
} else {
|
namespace: cephCSINamespace,
|
||||||
err = retryKubectlInput(cephCSINamespace, action, string(cephConf), deployTimeout)
|
},
|
||||||
if err != nil {
|
&yamlResourceNamespaced{
|
||||||
e2elog.Failf("failed to %s ceph-conf configmap object: %v", action, err)
|
filename: cephFSDirPath + cephFSNodePlugin,
|
||||||
}
|
namespace: cephCSINamespace,
|
||||||
}
|
},
|
||||||
data, err := replaceNamespaceInTemplate(cephFSDirPath + cephFSProvisioner)
|
&yamlResourceNamespaced{
|
||||||
if err != nil {
|
filename: cephFSDirPath + cephFSNodePluginRBAC,
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSProvisioner, err)
|
namespace: cephCSINamespace,
|
||||||
}
|
},
|
||||||
data = oneReplicaDeployYaml(data)
|
&yamlResourceNamespaced{
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
filename: cephFSDirPath + cephFSNodePluginPSP,
|
||||||
if err != nil {
|
namespace: cephCSINamespace,
|
||||||
e2elog.Failf("failed to %s CephFS provisioner: %v", action, err)
|
},
|
||||||
}
|
|
||||||
data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSProvisionerRBAC)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSProvisionerRBAC, err)
|
|
||||||
}
|
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to %s CephFS provisioner rbac: %v", action, err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSProvisionerPSP)
|
for _, r := range resources {
|
||||||
|
err := r.Do(action)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSProvisionerPSP, err)
|
e2elog.Failf("failed to %s resource: %v", action, err)
|
||||||
}
|
}
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to %s CephFS provisioner psp: %v", action, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSNodePlugin)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSNodePlugin, err)
|
|
||||||
}
|
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to %s CephFS nodeplugin: %v", action, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSNodePluginRBAC)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSNodePluginRBAC, err)
|
|
||||||
}
|
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to %s CephFS nodeplugin rbac: %v", action, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSNodePluginPSP)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSNodePluginPSP, err)
|
|
||||||
}
|
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to %s CephFS nodeplugin psp: %v", action, err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user