security

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolKey = "protocol"

	CaCertificateKey = "ca.crt"

	UserCertificate = "user.crt"
	UserKey         = "user.key"
	UserSkip        = "user.skip" // default: false

	SaslMechanismKey = "sasl.mechanism"
	SaslUserKey      = "user"
	SaslPasswordKey  = "password"

	ProtocolPlaintext     = "PLAINTEXT"
	ProtocolSASLPlaintext = "SASL_PLAINTEXT"
	ProtocolSSL           = "SSL"
	ProtocolSASLSSL       = "SASL_SSL"

	SaslPlain       = "PLAIN"
	SaslScramSha256 = "SCRAM-SHA-256"
	SaslScramSha512 = "SCRAM-SHA-512"
)
View Source
const (
	AuthSecretNameKey = "auth.secret.ref.name" /* #nosec G101 */ /* Potential hardcoded credentials (gosec) */
)

Variables

This section is empty.

Functions

func NoOp

func NoOp(*sarama.Config) error

NoOp is a no-op ConfigOption.

Types

type ConfigOption

type ConfigOption func(config *sarama.Config) error

func NewOptionFromSecret

func NewOptionFromSecret(ctx context.Context, config SecretLocator, secretProviderFunc SecretProviderFunc) (ConfigOption, *corev1.Secret, error)

type MTConfigMapSecretLocator

type MTConfigMapSecretLocator struct {
	*corev1.ConfigMap
}

MTConfigMapSecretLocator is a SecretLocator that locates a secret using a reference in a ConfigMap.

The name is take from the data field using the key: AuthSecretNameKey. The namespace is the same namespace of the ConfigMap.

func (*MTConfigMapSecretLocator) SecretName

func (cmp *MTConfigMapSecretLocator) SecretName() (string, bool, error)

func (*MTConfigMapSecretLocator) SecretNamespace

func (cmp *MTConfigMapSecretLocator) SecretNamespace() (string, bool, error)

type SecretLocator

type SecretLocator interface {
	// SecretName returns the secret name.
	// It returns true if the name should be used and false if should be ignored.
	SecretName() (string, bool, error)

	// SecretNamespace returns the secret name.
	// It returns true if the namespace should be used and false if should be ignored.
	SecretNamespace() (string, bool, error)
}

SecretLocator locates a secret in a cluster.

type SecretProviderFunc

type SecretProviderFunc func(ctx context.Context, namespace, name string) (*corev1.Secret, error)

SecretProviderFunc provides a secret given a namespace/name pair.

func DefaultSecretProviderFunc

func DefaultSecretProviderFunc(lister corelisters.SecretLister, kc kubernetes.Interface) SecretProviderFunc

DefaultSecretProviderFunc is a secret provider that uses the local cache for getting the secret and when the secret is not found it uses the kube client check if the secret doesn't actually exist.

Jump to

Keyboard shortcuts

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