Merge pull request #541 from Madhu-1/fix-ci

Fix CI failure in ceph-csi
This commit is contained in:
Humble Devassy Chirammal 2019-08-12 15:17:34 +05:30 committed by GitHub
commit 46d3afbe12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import (
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework"
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
) )
var ( var (
@ -31,10 +32,56 @@ func init() {
fmt.Println("timeout for deploytimeout ", deployTimeout) fmt.Println("timeout for deploytimeout ", deployTimeout)
} }
// removeCephCSIResource is a temporary fix for CI to remove the ceph-csi resources deployed by rook
func removeCephCSIResource() {
// cleanup rbd and cephfs deamonset deployed by rook
_, err := framework.RunKubectl("delete", "-nrook-ceph", "daemonset", "csi-cephfsplugin")
if err != nil {
e2elog.Logf("failed to delete rbd daemonset %v", err)
}
_, err = framework.RunKubectl("delete", "-nrook-ceph", "daemonset", "csi-rbdplugin")
if err != nil {
e2elog.Logf("failed to delete cephfs daemonset %v", err)
}
// cleanup rbd and cephfs statefulset deployed by rook
_, err = framework.RunKubectl("delete", "-nrook-ceph", "statefulset", "csi-rbdplugin-provisioner")
if err != nil {
e2elog.Logf("failed to delete rbd statefulset %v", err)
}
_, err = framework.RunKubectl("delete", "-nrook-ceph", "statefulset", "csi-cephfsplugin-provisioner")
if err != nil {
e2elog.Logf("failed to delete cephfs statefulset %v", err)
}
// cleanup rbd cluster roles deployed by rook
rbdPath := fmt.Sprintf("%s/%s/", rbdDirPath, "v1.13")
_, err = framework.RunKubectl("delete", "-f", rbdPath+rbdProvisionerRBAC)
if err != nil {
e2elog.Logf("failed to delete provisioner rbac %v", err)
}
_, err = framework.RunKubectl("delete", "-f", rbdPath+rbdNodePluginRBAC)
if err != nil {
e2elog.Logf("failed to delete nodeplugin rbac %v", err)
}
// cleanup cephfs cluster roles deployed by rook
cephfsPath := fmt.Sprintf("%s/%s/", cephfsDirPath, "v1.13")
_, err = framework.RunKubectl("delete", "-f", cephfsPath+cephfsProvisionerRBAC)
if err != nil {
e2elog.Logf("failed to delete provisioner rbac %v", err)
}
_, err = framework.RunKubectl("delete", "-f", cephfsPath+cephfsNodePluginRBAC)
if err != nil {
e2elog.Logf("failed to delete nodeplugin rbac %v", err)
}
}
// BeforeSuite deploys the rook-operator and ceph cluster // BeforeSuite deploys the rook-operator and ceph cluster
var _ = BeforeSuite(func() { var _ = BeforeSuite(func() {
if rookRequired { if rookRequired {
deployRook() deployRook()
removeCephCSIResource()
} }
}) })