credentialmanager

package
v1.18.0-beta.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCredentialsNotFound is returned when no credentials are configured.
	ErrCredentialsNotFound = errors.New("Credentials not found")

	// ErrCredentialMissing is returned when the credentials do not contain a username and/or password.
	ErrCredentialMissing = errors.New("Username/Password is missing")

	// ErrUnknownSecretKey is returned when the supplied key does not return a secret.
	ErrUnknownSecretKey = errors.New("Unknown secret key")
)

Errors

Functions

This section is empty.

Types

type Credential

type Credential struct {
	User     string `gcfg:"user"`
	Password string `gcfg:"password"`
}

Credential is a vCenter credential that is retrieved or stored in a Kubernetes secret.

type CredentialManager added in v1.1.0

type CredentialManager struct {
	SecretName       string
	SecretNamespace  string
	SecretLister     clientv1.SecretLister
	SecretsDirectory string

	Cache *SecretCache
	// contains filtered or unexported fields
}

CredentialManager is used to manage vCenter credentials stored as Kubernetes secrets.

func NewCredentialManager added in v1.1.0

func NewCredentialManager(secretName string, secretNamespace string, secretsDirectory string,
	secretLister v1.SecretLister) *CredentialManager

NewCredentialManager returns a new CredentialManager object.

func (*CredentialManager) GetCredential added in v1.1.0

func (credentialManager *CredentialManager) GetCredential(server string) (*Credential, error)

GetCredential returns credentials for the given vCenter Server. GetCredential returns error if Secret is not added or SecretDirectory is not set (ie No Creds).

type SecretCache

type SecretCache struct {
	VirtualCenter map[string]*Credential
	Secret        *v1.Secret
	SecretFile    map[string][]byte
	// contains filtered or unexported fields
}

SecretCache is used to cache information about Kubernetes secrets data.

func (*SecretCache) GetCredential

func (cache *SecretCache) GetCredential(server string) (Credential, bool)

GetCredential returns the vCenter credentials from a Kubernetes secret for the provided vCenter.

func (*SecretCache) GetSecret

func (cache *SecretCache) GetSecret() *corev1.Secret

GetSecret returns a Kubernetes secret.

func (*SecretCache) UpdateSecret

func (cache *SecretCache) UpdateSecret(secret *corev1.Secret)

UpdateSecret updates a Kubernetes secret with the provided data.

func (*SecretCache) UpdateSecretFile

func (cache *SecretCache) UpdateSecretFile(data map[string][]byte)

UpdateSecretFile updates a Kubernetes secret with the provided data.

Jump to

Keyboard shortcuts

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