mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +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 (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@ -69,85 +68,47 @@ func deleteCephfsPlugin() {
|
||||
}
|
||||
|
||||
func createORDeleteCephfsResources(action kubectlAction) {
|
||||
csiDriver, err := os.ReadFile(cephFSDirPath + csiDriverObject)
|
||||
if err != nil {
|
||||
// createORDeleteRbdResources is used for upgrade testing as csidriverObject is
|
||||
// newly added, discarding file not found error.
|
||||
if !os.IsNotExist(err) {
|
||||
e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+csiDriverObject, err)
|
||||
}
|
||||
} else {
|
||||
err = retryKubectlInput(cephCSINamespace, action, string(csiDriver), deployTimeout)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to %s CSIDriver object: %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)
|
||||
resources := []ResourceDeployer{
|
||||
&yamlResource{
|
||||
filename: cephFSDirPath + csiDriverObject,
|
||||
allowMissing: true,
|
||||
},
|
||||
&yamlResource{
|
||||
filename: examplePath + cephConfconfigMap,
|
||||
allowMissing: true,
|
||||
},
|
||||
&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,
|
||||
},
|
||||
}
|
||||
|
||||
data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSProvisionerPSP)
|
||||
for _, r := range resources {
|
||||
err := r.Do(action)
|
||||
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