mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-24 16:30:47 +00:00
Create kube package that abstracts interactions with kubernetes cluster
This commit is contained in:
21
test/kube/kube.go
Normal file
21
test/kube/kube.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package kube
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"github.com/1Password/onepassword-operator/test/cmd"
|
||||
)
|
||||
|
||||
func CreateSecretFromEnvVar(envVar, secretName string) {
|
||||
serviceAccountTokenToken, _ := os.LookupEnv(envVar)
|
||||
Expect(serviceAccountTokenToken).NotTo(BeEmpty())
|
||||
_, err := cmd.Run("kubectl", "create", "secret", "generic", secretName, "--from-literal=token="+serviceAccountTokenToken)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
|
||||
func Delete(kind, name string) {
|
||||
_, err := cmd.Run("kubectl", "delete", kind, name, "--ignore-not-found=true")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
Reference in New Issue
Block a user