Documentation ¶
Index ¶
- func NewK8sClientset(kubeconfig string) (*kubernetes.Interface, error)
- func NewSecretManagerClient(ctx context.Context) (*secretmanager.Client, error)
- type Client
- func (cl *Client) CreateKubernetesNamespace(namespace string) error
- func (cl *Client) GetKubernetesSecretValue(namespace, id, key string) ([]byte, error)
- func (cl *Client) GetSecretManagerSecretValue(project, id string) ([]byte, error)
- func (cl *Client) UpsertKubernetesSecret(namespace, id, key string, data []byte) error
- func (cl *Client) UpsertSecretManagerSecret(project, id string, data []byte) error
- func (cl *Client) ValidateKubernetesNamespace(namespace string) error
- func (cl *Client) ValidateKubernetesSecret(namespace, id string) error
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewK8sClientset ¶
func NewK8sClientset(kubeconfig string) (*kubernetes.Interface, error)
NewK8sClientset creates a new K8s clientset uses in-cluster configuration if possible, but falls back to out-of-cluster configuration otherwise. It loads from kubeconfig, and looks for a config file under $HOME if kubeconfig is not specified.
func NewSecretManagerClient ¶
func NewSecretManagerClient(ctx context.Context) (*secretmanager.Client, error)
Types ¶
type Client ¶
type Client struct { K8sClientset kubernetes.Interface SecretManagerClient secretmanager.Client }
func (*Client) CreateKubernetesNamespace ¶
CreateKubernetesNamespace creates a K8s namesapce. Returns nil if successful, error otherwise
func (*Client) GetKubernetesSecretValue ¶
GetKubernetesSecretValue gets the value of key from the kubernetes secret specified by namespace, id. Returns error if the namspace doesn't exist, otherwise nil if the secret or key don't exist.
func (*Client) GetSecretManagerSecretValue ¶
GetSecretManagerSecretValue gets the value from the Secret Manager secret specified by project, id. Returns nil and secret value if successful, error otherwise
func (*Client) UpsertKubernetesSecret ¶
UpsertKubernetesSecret updates the value of key of the kubernetes secret specified by namespace, id. It inserts a new secret if id doesn't already exist. It inserts a new key-value pair if key doesn't already exist. Returns nil if successful, error otherwise
func (*Client) UpsertSecretManagerSecret ¶
UpsertSecretManagerSecret adds a new version to the Secret Manager secret specified by project, id. It inserts a new secret if id doesn't already exist. If successful the latest version will have 'data' as its secret value, otherwise return error
func (*Client) ValidateKubernetesNamespace ¶
ValidateKubernetesNamespace returns nil if the namespace exists, otherwise error.
func (*Client) ValidateKubernetesSecret ¶
ValidateKubernetesSecret returns nil if the secret exists under namespace, otherwise error.
type Interface ¶
type Interface interface { ValidateKubernetesNamespace(namespace string) error ValidateKubernetesSecret(namespace, id string) error CreateKubernetesNamespace(namespace string) error GetKubernetesSecretValue(namespace, id, key string) ([]byte, error) UpsertKubernetesSecret(namespace, id, key string, data []byte) error GetSecretManagerSecretValue(project, id string) ([]byte, error) UpsertSecretManagerSecret(project, id string, data []byte) error }
structs for client interface