secrets

package
v0.0.0-...-8a63693 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Secrets provides utility functions for handling secrets.

Index

Constants

View Source
const (
	// VolumeMountRootDir is the directory on the container filesystem in
	// which SecretSource volumes are mounted. Each volume is mounted in a
	// subdirectory with the specified DirName.
	VolumeMountRootDir = "/vt/secrets"
)

Variables

This section is empty.

Functions

func ContentHash

func ContentHash(secrets ...*corev1.Secret) string

ContentHash stably hashes secrets by their contents.

func GetByNames

func GetByNames(ctx context.Context, cl client.Client, namespace string, secretNames sets.String) ([]*corev1.Secret, error)

GetByNames gets all secretNames in namespace.

Types

type VolumeMount

type VolumeMount struct {
	// Secret is the SecretSource from which to load data.
	Secret *planetscalev2.SecretSource
	// DirName is the name of the directory under VolumeMountDir in which to
	// mount this SecretSource.
	DirName string
	// AbsolutePath stores the absolute path to use instead of the generated path
	// with /vt/secret as the prefix
	AbsolutePath string
}

VolumeMount represents a mounted SecretSource.

func Mount

func Mount(secretSource *planetscalev2.SecretSource, dirName string) *VolumeMount

Mount creates a VolumeMount for a given SecretSource.

func (*VolumeMount) ContainerVolumeMount

func (v *VolumeMount) ContainerVolumeMount() corev1.VolumeMount

ContainerVolumeMount returns the VolumeMount that should be added to Containers that need this secret.

func (*VolumeMount) DirPath

func (v *VolumeMount) DirPath() string

DirPath returns the absolute path to the mounted SecretSource volume.

func (*VolumeMount) FilePath

func (v *VolumeMount) FilePath() string

FilePath returns the absolute path to the mounted file.

func (*VolumeMount) PodVolumes

func (v *VolumeMount) PodVolumes() []corev1.Volume

PodVolumes returns the Volumes, if any, that should be added to Pods that need this secret.

func (*VolumeMount) VolumeName

func (v *VolumeMount) VolumeName() string

VolumeName returns the name of the Pod Volume to be mounted.

Jump to

Keyboard shortcuts

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