Help us shape the future of Go! Take the 2026 Go Developer Survey

secret

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 17 Imported by: 20

Documentation

Index

Constants

View Source
const (

	// ReasonSecretMissing - secret does not exist
	ReasonSecretMissing condition.Reason = "SecretMissing"
	// ReasonSecretError - secret error
	ReasonSecretError condition.Reason = "SecretError"
	// ReasonSecretDeleteError - secret deletion error
	ReasonSecretDeleteError condition.Reason = "SecretDeleteError"
)

Conditions for status in web console

Variables

This section is empty.

Functions

func CreateOrPatchSecret

func CreateOrPatchSecret(
	ctx context.Context,
	h *helper.Helper,
	obj client.Object,
	secret *corev1.Secret,
) (string, controllerutil.OperationResult, error)

CreateOrPatchSecret - create custom secret or patch it, if one already exists finally return configuration hash

func DeleteSecretsWithLabel

func DeleteSecretsWithLabel(
	ctx context.Context,
	h *helper.Helper,
	obj client.Object,
	labelSelectorMap map[string]string,
) error

DeleteSecretsWithLabel - Delete all secrets in namespace of the obj matching label selector

func DeleteSecretsWithName

func DeleteSecretsWithName(
	ctx context.Context,
	h *helper.Helper,
	name string,
	namespace string,
) error

DeleteSecretsWithName - Delete names secret object in namespace

func EnsureSecrets

func EnsureSecrets(
	ctx context.Context,
	h *helper.Helper,
	obj client.Object,
	sts []util.Template,
	envVars *map[string]env.Setter,
) error

EnsureSecrets - get all secrets required, verify they exist and add the hash to env and status

func GetDataFromSecret

func GetDataFromSecret(
	ctx context.Context,
	h *helper.Helper,
	secretName string,
	requeueTimeout time.Duration,
	key string,
) (string, ctrl.Result, error)

GetDataFromSecret - Get data from Secret

if the secret or data is not found, requeue after requeueTimeout

func GetSecret

func GetSecret(
	ctx context.Context,
	h *helper.Helper,
	secretName string,
	secretNamespace string,
) (*corev1.Secret, string, error)

GetSecret - get secret by name and namespace

func GetSecrets

func GetSecrets(
	ctx context.Context,
	h *helper.Helper,
	secretNamespace string,
	labelSelectorMap map[string]string,
) (*corev1.SecretList, error)

GetSecrets - get secrets by namespace and label selectors

func Hash

func Hash(secret *corev1.Secret) (string, error)

Hash function creates a hash of a Secret's Data and StringData fields and returns it as a safe encoded string.

func VerifySecret

func VerifySecret(
	ctx context.Context,
	secretName types.NamespacedName,
	expectedFields []string,
	reader client.Reader,
	requeueTimeout time.Duration,
) (string, ctrl.Result, error)

VerifySecret - verifies if the Secret object exists and the expected fields are in the Secret. It returns a hash of the values of the expected fields.

Types

This section is empty.

Jump to

Keyboard shortcuts

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