mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +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
117
e2e/cephfs.go
117
e2e/cephfs.go
@ -19,7 +19,6 @@ package e2e
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -69,86 +68,48 @@ 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)
|
},
|
||||||
|
&yamlResourceNamespaced{
|
||||||
|
filename: cephFSDirPath + cephFSProvisioner,
|
||||||
|
namespace: cephCSINamespace,
|
||||||
|
oneReplica: true,
|
||||||
|
},
|
||||||
|
&yamlResourceNamespaced{
|
||||||
|
filename: cephFSDirPath + cephFSProvisionerRBAC,
|
||||||
|
namespace: cephCSINamespace,
|
||||||
|
},
|
||||||
|
&yamlResourceNamespaced{
|
||||||
|
filename: cephFSDirPath + cephFSProvisionerPSP,
|
||||||
|
namespace: cephCSINamespace,
|
||||||
|
},
|
||||||
|
&yamlResourceNamespaced{
|
||||||
|
filename: cephFSDirPath + cephFSNodePlugin,
|
||||||
|
namespace: cephCSINamespace,
|
||||||
|
},
|
||||||
|
&yamlResourceNamespaced{
|
||||||
|
filename: cephFSDirPath + cephFSNodePluginRBAC,
|
||||||
|
namespace: cephCSINamespace,
|
||||||
|
},
|
||||||
|
&yamlResourceNamespaced{
|
||||||
|
filename: cephFSDirPath + cephFSNodePluginPSP,
|
||||||
|
namespace: cephCSINamespace,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, r := range resources {
|
||||||
|
err := r.Do(action)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e2elog.Failf("failed to %s CSIDriver object: %v", action, err)
|
e2elog.Failf("failed to %s resource: %v", action, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cephConf, err := os.ReadFile(examplePath + cephConfconfigMap)
|
|
||||||
if err != nil {
|
|
||||||
// createORDeleteCephfsResources is used for upgrade testing as cephConfConfigmap is
|
|
||||||
// newly added, discarding file not found error.
|
|
||||||
if !os.IsNotExist(err) {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", examplePath+cephConfconfigMap, err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = retryKubectlInput(cephCSINamespace, action, string(cephConf), deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to %s ceph-conf configmap object: %v", action, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
data, err := replaceNamespaceInTemplate(cephFSDirPath + cephFSProvisioner)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSProvisioner, err)
|
|
||||||
}
|
|
||||||
data = oneReplicaDeployYaml(data)
|
|
||||||
err = retryKubectlInput(cephCSINamespace, action, data, deployTimeout)
|
|
||||||
if err != nil {
|
|
||||||
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)
|
|
||||||
if err != nil {
|
|
||||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSProvisionerPSP, 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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateSubvolumeCount(f *framework.Framework, count int, fileSystemName, subvolumegroup string) {
|
func validateSubvolumeCount(f *framework.Framework, count int, fileSystemName, subvolumegroup string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user