client

package
v0.0.0-...-c16e2ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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

func (cl *Client) CreateKubernetesNamespace(namespace string) error

CreateKubernetesNamespace creates a K8s namesapce. Returns nil if successful, error otherwise

func (*Client) GetKubernetesSecretValue

func (cl *Client) GetKubernetesSecretValue(namespace, id, key string) ([]byte, error)

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

func (cl *Client) GetSecretManagerSecretValue(project, id string) ([]byte, error)

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

func (cl *Client) UpsertKubernetesSecret(namespace, id, key string, data []byte) error

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

func (cl *Client) UpsertSecretManagerSecret(project, id string, data []byte) error

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

func (cl *Client) ValidateKubernetesNamespace(namespace string) error

ValidateKubernetesNamespace returns nil if the namespace exists, otherwise error.

func (*Client) ValidateKubernetesSecret

func (cl *Client) ValidateKubernetesSecret(namespace, id string) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL