credentials

package
v0.5.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldRepoURL        = "repoURL"
	FieldRepoURLIsRegex = "repoURLIsRegex"
	FieldUsername       = "username"
	FieldPassword       = "password"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	// Username identifies a principal, which combined with the value of the
	// Password field, can be used for access to some repository.
	Username string
	// Password, when combined with the principal identified by the Username
	// field, can be used for access to some repository.
	Password string
	// SSHPrivateKey is a private key that can be used for access to some remote
	// repository. This is primarily applicable for Git repositories.
	SSHPrivateKey string
}

Credentials generically represents any type of repository credential.

type Database

type Database interface {
	Get(
		ctx context.Context,
		namespace string,
		credType Type,
		repo string,
	) (Credentials, bool, error)
}

Database is an interface for a Credentials store.

func NewKubernetesDatabase

func NewKubernetesDatabase(
	kargoClient client.Client,
	cfg KubernetesDatabaseConfig,
) Database

NewKubernetesDatabase initializes and returns an implementation of the Database interface that utilizes a Kubernetes controller runtime client to retrieve Credentials stored in Kubernetes Secrets.

type FakeDB

type FakeDB struct {
	GetFn func(
		ctx context.Context,
		namespace string,
		credType Type,
		repo string,
	) (Credentials, bool, error)
}

FakeDB is a mock implementation of the Database interface that is used to facilitate unit testing.

func (*FakeDB) Get

func (f *FakeDB) Get(
	ctx context.Context,
	namespace string,
	credType Type,
	repo string,
) (Credentials, bool, error)

type KubernetesDatabaseConfig added in v0.4.0

type KubernetesDatabaseConfig struct {
	GlobalCredentialsNamespaces []string `envconfig:"GLOBAL_CREDENTIALS_NAMESPACES" default:""`
}

KubernetesDatabaseConfig represents configuration for a Kubernetes based implementation of the Database interface.

func KubernetesDatabaseConfigFromEnv added in v0.4.0

func KubernetesDatabaseConfigFromEnv() KubernetesDatabaseConfig

type Type

type Type string

Type is a string type used to represent a type of Credentials.

const (
	// TypeGit represents credentials for a Git repository.
	TypeGit Type = "git"
	// TypeHelm represents credentials for a Helm chart repository.
	TypeHelm Type = "helm"
	// TypeImage represents credentials for an image repository.
	TypeImage Type = "image"
)

func (Type) String added in v0.5.0

func (t Type) String() string

String returns the string representation of a Type.

Jump to

Keyboard shortcuts

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