secrets

package
v0.0.0-...-9963b81 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 5 Imported by: 29

Documentation

Index

Constants

View Source
const (
	SecretNamingV1 = SecretNamingVersion("secretnamingv1")
	SecretNamingV2 = SecretNamingVersion("secretnamingv2")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Owner           SecretOwner
	Scheme          *runtime.Scheme
	Activates       *time.Time
	Expires         *time.Time
	Flatten         bool
	FlattenSuffixes []string
}

Options contains the inputs available for passing to some methods of the secret clients

type SecretClient

type SecretClient interface {
	Upsert(ctx context.Context, key SecretKey, data map[string][]byte, opts ...SecretOption) error
	Delete(ctx context.Context, key SecretKey, opts ...SecretOption) error
	Get(ctx context.Context, key SecretKey, opts ...SecretOption) (map[string][]byte, error)
	GetSecretNamingVersion() SecretNamingVersion

	// We really shouldn't want/need such a method but unfortunately some resources have specific KeyVault handling for how
	// they name things so our abstraction breaks down
	IsKeyVault() bool
}

type SecretKey

type SecretKey struct {
	// Name is the name of the resource the secret is for.
	// We don't need the full "path" to the Azure resource because those relationships are all flattened in Kubernetes
	// and since Kubernetes forbids conflicting resources of the same kind in the same namespace + name we only need the
	// 3-tuple of kind, namespace, name.
	Name string
	// Namespace is the namespace of the resource the secret is for
	Namespace string
	// Kind is the kind of resource - this can be gathered from metav1.TypeMeta.Kind usually
	Kind string
}

SecretKey contains the details required to generate a unique key used for identifying a secret

func (SecretKey) String

func (s SecretKey) String() string

type SecretNamingVersion

type SecretNamingVersion string

type SecretOption

type SecretOption func(*Options)

SecretOption wraps a function that sets a value in the options struct

func Flatten

func Flatten(flatten bool, suffixes ...string) SecretOption

Flatten can be used to create individual string secrets

func WithActivation

func WithActivation(activateAfter *time.Time) SecretOption

WithActivation can be used to pass an activation duration

func WithExpiration

func WithExpiration(expireAfter *time.Time) SecretOption

WithExpiration can be used to pass an expiration duration

func WithOwner

func WithOwner(owner SecretOwner) SecretOption

WithOwner allows setting an owning instance in the options struct

func WithScheme

func WithScheme(scheme *runtime.Scheme) SecretOption

WithScheme allows setting a runtime.Scheme in the options

type SecretOwner

type SecretOwner interface {
	runtime.Object
	metav1.Object
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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