secretutils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LabelEnvironmentName  = "environment.metal3.io"
	LabelEnvironmentValue = "baremetal"
)
View Source
const (
	SecretsFinalizer = metal3api.BareMetalHostFinalizer + "/secret"
)

Variables

This section is empty.

Functions

func AddSecretSelector

func AddSecretSelector(selectors map[client.Object]cache.ByObject) map[client.Object]cache.ByObject

AddSecretSelector adds a selector to a cache.SelectorsByObject that filters Secrets so that only those labelled as part of the baremetal environment get cached. The input may be nil.

Types

type SecretManager

type SecretManager struct {
	// contains filtered or unexported fields
}

SecretManager is a type for fetching Secrets whether or not they are in the client cache, labelling so that they will be included in the client cache, and optionally setting an owner reference.

func NewSecretManager

func NewSecretManager(ctx context.Context, log logr.Logger, cacheClient client.Client, apiReader client.Reader) SecretManager

NewSecretManager returns a new SecretManager.

func (*SecretManager) AcquireSecret

func (sm *SecretManager) AcquireSecret(key types.NamespacedName, owner client.Object, addFinalizer bool) (*corev1.Secret, error)

AcquireSecret retrieves a Secret and ensures that it has a label that will ensure it is present in the cache (and that we can watch for changes), and that it has a particular owner reference. The owner reference may optionally be a controller reference.

func (*SecretManager) ObtainSecret

func (sm *SecretManager) ObtainSecret(key types.NamespacedName) (*corev1.Secret, error)

ObtainSecret retrieves a Secret and ensures that it has a label that will ensure it is present in the cache (and that we can watch for changes).

func (*SecretManager) ReleaseSecret

func (sm *SecretManager) ReleaseSecret(secret *corev1.Secret) error

ReleaseSecret removes secrets manager finalizer from specified secret when needed.

Jump to

Keyboard shortcuts

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