secrets

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerOnly

func DockerOnly(secret *v1.Secret) bool

DockerOnly selects only secrets of type `kubernetes.io/dockerconfigjson` and `kubernetes.io/dockercfg`.

func NewNotFoundError

func NewNotFoundError(name string) error

NewNotFoundError returns a not found error

Types

type SecretFilter

type SecretFilter = func(*v1.Secret) bool

SecretFilter is a type for filter function true -> keep item false -> skip item filter function nil keeps all items

type SecretHelper

type SecretHelper interface {
	CopySecrets(ctx context.Context, secretNames []string, filter SecretFilter, transformers ...SecretTransformer) ([]string, error)
	CreateSecret(ctx context.Context, secret *v1.Secret) (*v1.Secret, error)
	IsNotFound(err error) bool
}

SecretHelper copies secrets

func NewSecretHelper

func NewSecretHelper(provider SecretProvider, namespace string, client corev1.SecretInterface) SecretHelper

NewSecretHelper creates a secret helper

type SecretProvider

type SecretProvider interface {
	// GetSecret returns a secret by its name
	// returns nil,nil if secret is not found
	GetSecret(ctx context.Context, name string) (*v1.Secret, error)
}

SecretProvider provides secrets

type SecretTransformer

type SecretTransformer = func(*v1.Secret)

SecretTransformer is a function that modifies the given secret.

func RenameByAnnotationTransformer added in v0.6.3

func RenameByAnnotationTransformer(key string) SecretTransformer

RenameByAnnotationTransformer returns a secret transformer function that sets `metadata.name` to the value of an annotation with the given key. If the annotation does not exist or has no non-empty value, `metadata.name` is kept unchanged.

func SetAnnotationTransformer

func SetAnnotationTransformer(key string, value string) SecretTransformer

SetAnnotationTransformer returns a secret transformer function that sets the annotation with the given key to the given value.

func SetLabelTransformer

func SetLabelTransformer(key string, value string) SecretTransformer

SetLabelTransformer returns a secret transformer function that sets the label with the given key to the given value.

func StripAnnotationsTransformer

func StripAnnotationsTransformer(keyPrefix string) SecretTransformer

StripAnnotationsTransformer returns a secret transformer function that removes all annotations where the key starts with the given 'keyPrefix'.

func StripLabelsTransformer

func StripLabelsTransformer(keyPrefix string) SecretTransformer

StripLabelsTransformer returns a secret transformer function that removes all labels where the key starts with the given 'keyPrefix'.

func UniqueNameTransformer

func UniqueNameTransformer() SecretTransformer

UniqueNameTransformer returns a secret transformer function that sets `metadata.generateName` to the original `metadata.name` with '-' appended as separator and removes `metadata.name`.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
k8s

Jump to

Keyboard shortcuts

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