Add cephcsi namespace and rook namespace flag

Added namespace flag to cephcsi to deploy cephcsi
resouces in different namespace.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2020-02-25 17:15:54 +05:30
committed by mergify[bot]
parent 59fe8c1f2f
commit c45c426215
7 changed files with 144 additions and 81 deletions

View File

@ -1,6 +1,8 @@
package e2e
import (
"fmt"
. "github.com/onsi/gomega" // nolint
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
@ -17,37 +19,37 @@ var (
)
func deployVault(c kubernetes.Interface, deployTimeout int) {
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultServicePath)
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultPSPPath)
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultRBACPath)
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultConfigPath)
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultServicePath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultPSPPath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultRBACPath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
framework.RunKubectlOrDie("create", "-f", vaultExamplePath+vaultConfigPath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
opt := metav1.ListOptions{
LabelSelector: "app=vault",
}
pods, err := c.CoreV1().Pods("default").List(opt)
pods, err := c.CoreV1().Pods(cephCSINamespace).List(opt)
Expect(err).Should(BeNil())
Expect(len(pods.Items)).Should(Equal(1))
name := pods.Items[0].Name
err = waitForPodInRunningState(name, "default", c, deployTimeout)
err = waitForPodInRunningState(name, cephCSINamespace, c, deployTimeout)
Expect(err).Should(BeNil())
}
func deleteVault() {
_, err := framework.RunKubectl("delete", "-f", vaultExamplePath+vaultServicePath)
_, err := framework.RunKubectl("delete", "-f", vaultExamplePath+vaultServicePath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
if err != nil {
e2elog.Logf("failed to delete vault statefull set %v", err)
}
_, err = framework.RunKubectl("delete", "-f", vaultExamplePath+vaultRBACPath)
_, err = framework.RunKubectl("delete", "-f", vaultExamplePath+vaultRBACPath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
if err != nil {
e2elog.Logf("failed to delete vault statefull set %v", err)
}
_, err = framework.RunKubectl("delete", "-f", vaultExamplePath+vaultConfigPath)
_, err = framework.RunKubectl("delete", "-f", vaultExamplePath+vaultConfigPath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
if err != nil {
e2elog.Logf("failed to delete vault config map %v", err)
}
_, err = framework.RunKubectl("delete", "-f", vaultExamplePath+vaultPSPPath)
_, err = framework.RunKubectl("delete", "-f", vaultExamplePath+vaultPSPPath, fmt.Sprintf("--namespace=%s", cephCSINamespace))
if err != nil {
e2elog.Logf("failed to delete vault psp %v", err)
}