utils

package
v0.0.0-...-840a96b Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecretVolumePath is the path of ALL the mounted secrets.
	SecretVolumePath = "/etc/secrets"
	// ConfigVolumePath is the path of the mounted NATS config file.
	ConfigVolumePath = "/etc/config"
)

Variables

This section is empty.

Functions

func GetTLSConfig

func GetTLSConfig(config *config.TLS, reader VolumeReader) (*tls.Config, error)

GetTLSConfig is a utility function to translate a NATS tls config to tls.Config

func NewLogger

func NewLogger() *zap.SugaredLogger

NewLogger returns a new zap.SugaredLogger

Types

type NatsVolumeReader

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

NatsVolumeReader is a utility struct for reading secret volumes.

func NewNatsVolumeReader

func NewNatsVolumeReader(secretPath string) *NatsVolumeReader

NewNatsVolumeReader creates a new NatsVolumeReader with the specified secret path.

func (*NatsVolumeReader) GetSecretFromVolume

func (nvr *NatsVolumeReader) GetSecretFromVolume(selector *corev1.SecretKeySelector) (string, error)

GetSecretFromVolume retrieves the value from a mounted secret volume. It trims any newline suffix from the value.

func (*NatsVolumeReader) GetSecretVolumePath

func (nvr *NatsVolumeReader) GetSecretVolumePath(selector *corev1.SecretKeySelector) (string, error)

GetSecretVolumePath constructs and returns the path of a mounted secret based on the secret key selector.

type VolumeReader

type VolumeReader interface {
	GetSecretFromVolume(selector *corev1.SecretKeySelector) (string, error)
	GetSecretVolumePath(selector *corev1.SecretKeySelector) (string, error)
}

VolumeReader is an interface that defines methods to interact with secret volumes in a Kubernetes environment.

Jump to

Keyboard shortcuts

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