From a1f5425b8865fbc552eca6ecba70ff2fd0f8df5a Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Thu, 9 Apr 2020 11:18:09 +0530 Subject: [PATCH] Update cephcsi secret created by rook as we need to include the encryption secret key inside the secret created by the rook, This PR will add the key and value required for the encryption inside the secrets. Signed-off-by: Madhu Rajanna --- e2e/utils.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/e2e/utils.go b/e2e/utils.go index 99ad3536a..2439f2c02 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -425,6 +425,39 @@ func createRBDSecret(c kubernetes.Interface, f *framework.Framework) { sc.Namespace = cephCSINamespace _, err := c.CoreV1().Secrets(cephCSINamespace).Create(&sc) Expect(err).Should(BeNil()) + + err = updateSecretForEncryption(c) + Expect(err).Should(BeNil()) +} + +// updateSecretForEncryption is an hack to update the secrets created by rook to +// include the encyption key +// TODO in cephcsi we need to create own users in ceph cluster and use it for E2E +func updateSecretForEncryption(c kubernetes.Interface) error { + secrets, err := c.CoreV1().Secrets(rookNamespace).Get(rbdProvisionerSecretName, metav1.GetOptions{}) + if err != nil { + return err + } + + secrets.Data["encryptionPassphrase"] = []byte("test_passphrase") + + _, err = c.CoreV1().Secrets(rookNamespace).Update(secrets) + if err != nil { + return err + } + + secrets, err = c.CoreV1().Secrets(rookNamespace).Get(rbdNodePluginSecretName, metav1.GetOptions{}) + if err != nil { + return err + } + + secrets.Data["encryptionPassphrase"] = []byte("test_passphrase") + + _, err = c.CoreV1().Secrets(rookNamespace).Update(secrets) + if err != nil { + return err + } + return nil } func deleteResource(scPath string) {