secretfacade

package
v0.1.69 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const FileSystem string = "filesystem"
View Source
const Kubernetes string = "kubernetes"

Variables

This section is empty.

Functions

func SortSecretsInSchemaOrder

func SortSecretsInSchemaOrder(resources []*SecretPair)

SortSecretsInSchemaOrder sorts the secrets in schema order with the entry with a schema with the most properties being first

func SortSecretsInSchemaTemplateOrder

func SortSecretsInSchemaTemplateOrder(resources []*SecretPair)

SortSecretsInSchemaTemplateOrder sorts the secrets in schema order with the entry without template functions being first

Types

type EntryError

type EntryError struct {
	// Key the secret key
	Key string

	// Properties property names for the key
	Properties []string
}

EntryError represents the missing entries

type ExternalSecretLocation

type ExternalSecretLocation string

type Options

type Options struct {
	options.BaseOptions
	Dir                       string
	Namespace                 string
	SecretNamespace           string
	Filter                    string
	SecretClient              extsecrets.Interface
	KubeClient                kubernetes.Interface
	Source                    string
	SecretStoreManagerFactory secretstore.FactoryInterface

	// ExternalSecrets the loaded secrets
	ExternalSecrets []*v1.ExternalSecret
}

Options options for verifying secrets

func (*Options) AddFlags

func (o *Options) AddFlags(cmd *cobra.Command)

func (*Options) ExternalSecretByName

func (o *Options) ExternalSecretByName(secretName string) (*v1.ExternalSecret, error)

func (*Options) Load

func (o *Options) Load() ([]*SecretPair, error)

Load loads the secret pairs

func (*Options) Validate

func (o *Options) Validate() error

func (*Options) Verify

func (o *Options) Verify() ([]*SecretPair, error)

Verify loads the secrets and verifies which are valid to aid the edit/populate operations

func (*Options) VerifyAndFilter

func (o *Options) VerifyAndFilter() ([]*SecretPair, error)

VerifyAndFilter loads the secrets and verifies which are valid to aid the edit/populate operations then filters out any duplicate entries which are using the same underlying secret mappings.

e.g. if 2 secrets are populated to the same actual location then we can omit one of them since there's no need to write to the same location twice.

We prefer the secrets which have schemas associated and that have the most entries.

type SchemaOrder

type SchemaOrder []*SecretPair

func (SchemaOrder) Len

func (a SchemaOrder) Len() int

func (SchemaOrder) Less

func (a SchemaOrder) Less(i, j int) bool

func (SchemaOrder) Swap

func (a SchemaOrder) Swap(i, j int)

type SchemaTemplateOrder

type SchemaTemplateOrder []*SecretPair

func (SchemaTemplateOrder) Len

func (a SchemaTemplateOrder) Len() int

func (SchemaTemplateOrder) Less

func (a SchemaTemplateOrder) Less(i, j int) bool

func (SchemaTemplateOrder) Swap

func (a SchemaTemplateOrder) Swap(i, j int)

type SecretError

type SecretError struct {
	// ExternalSecret the external secret which is not valid
	ExternalSecret v1.ExternalSecret

	// EntryErrors the errors for each secret entry
	EntryErrors []*EntryError
}

SecretError returns an error for a secret

func VerifySecret

func VerifySecret(es *v1.ExternalSecret, secret *corev1.Secret) (*SecretError, error)

VerifySecret verifies the secret

type SecretPair

type SecretPair struct {
	// ExternalSecret the external secret which is not valid
	ExternalSecret v1.ExternalSecret

	// Secret the secret if there is one
	Secret *corev1.Secret

	// Error last validation error at last check
	Error *SecretError
	// contains filtered or unexported fields
}

SecretPair the external secret and the associated Secret an error for a secret

func (*SecretPair) IsInvalid

func (p *SecretPair) IsInvalid() bool

IsInvalid returns true if the validation failed

func (*SecretPair) IsMandatory

func (p *SecretPair) IsMandatory() bool

IsMandatory returns true if the secret is a mandatory secret

func (*SecretPair) Key

func (p *SecretPair) Key() string

Key returns the unique key of the secret

func (*SecretPair) Name

func (p *SecretPair) Name() string

Name returns the name of the secret

func (*SecretPair) Namespace

func (p *SecretPair) Namespace() string

Namespace returns the namespace of the secret

func (*SecretPair) SchemaObject

func (p *SecretPair) SchemaObject() (*schema.Object, error)

SchemaObject returns the optional schema object from the annotation

func (*SecretPair) SetSchemaObject

func (p *SecretPair) SetSchemaObject(schemaObject *schema.Object)

SetSchemaObject sets the cached schema object: typically used for testing

Jump to

Keyboard shortcuts

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