Documentation ¶
Index ¶
- func DockerOnly(secret *v1.Secret) bool
- func NewNotFoundError(name string) error
- type SecretFilter
- type SecretHelper
- type SecretProvider
- type SecretTransformer
- func RenameByAnnotationTransformer(key string) SecretTransformer
- func RenameTransformer(newName string) SecretTransformer
- func SetAnnotationTransformer(key string, value string) SecretTransformer
- func SetLabelTransformer(key string, value string) SecretTransformer
- func StripAnnotationsTransformer(keyPrefix string) SecretTransformer
- func StripLabelsTransformer(keyPrefix string) SecretTransformer
- func UniqueNameTransformer() SecretTransformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DockerOnly ¶
DockerOnly selects only secrets of type `kubernetes.io/dockerconfigjson` and `kubernetes.io/dockercfg`.
func NewNotFoundError ¶
NewNotFoundError returns a not found error
Types ¶
type SecretFilter ¶
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 ¶
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 RenameTransformer ¶ added in v0.24.0
func RenameTransformer(newName string) SecretTransformer
RenameTransformer returns a secret transformer function that sets `metadata.name` to the provided value. If an empty string is provided `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`.