mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-22 07:28:06 +00:00
22 lines
587 B
Go
22 lines
587 B
Go
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())
|
|
}
|