Extract setting context namespace to standalone function SetContextNamespace

This commit is contained in:
Volodymyr Zotov
2025-08-20 14:57:47 -05:00
parent 882d8e951d
commit 299689fe13
3 changed files with 15 additions and 200 deletions

View File

@@ -48,6 +48,12 @@ func DeleteSecret(name string) {
Expect(err).NotTo(HaveOccurred())
}
func SetContextNamespace(namespace string) {
By("Set namespace to " + namespace)
_, err := system.Run("kubectl", "config", "set-context", "--current", "--namespace="+namespace)
Expect(err).NotTo(HaveOccurred())
}
// PatchOperatorToUseServiceAccount sets `OP_SERVICE_ACCOUNT_TOKEN` env variable
var PatchOperatorToUseServiceAccount = WithOperatorRestart(func() {
By("patching the operator deployment with service account token")