Documentation ¶
Index ¶
- Constants
- Variables
- type VersionedSecretStore
- type VersionedSecretStoreImpl
- func (p VersionedSecretStoreImpl) Create(ctx context.Context, namespace string, secretName string, ...) error
- func (p VersionedSecretStoreImpl) Decorate(ctx context.Context, namespace string, secretName string, key string, ...) error
- func (p VersionedSecretStoreImpl) Delete(ctx context.Context, namespace string, secretName string) error
- func (p VersionedSecretStoreImpl) Get(ctx context.Context, namespace string, deploymentName string, version int) (*corev1.Secret, error)
- func (p VersionedSecretStoreImpl) Latest(ctx context.Context, namespace string, secretName string) (*corev1.Secret, error)
- func (p VersionedSecretStoreImpl) List(ctx context.Context, namespace string, secretName string) ([]corev1.Secret, error)
- func (p VersionedSecretStoreImpl) UpdateSecretReferences(ctx context.Context, namespace string, podSpec *corev1.PodSpec) error
- func (p VersionedSecretStoreImpl) VersionCount(ctx context.Context, namespace string, secretName string) (int, error)
Constants ¶
const (
// VersionSecretKind is the kind of versioned secret
VersionSecretKind = "versionedSecret"
)
Variables ¶
var ( // LabelSecretKind is the label key for secret kind LabelSecretKind = fmt.Sprintf("%s/secret-kind", apis.GroupName) // LabelVersion is the label key for secret version LabelVersion = fmt.Sprintf("%s/secret-version", apis.GroupName) // AnnotationSourceDescription is the label key for source description AnnotationSourceDescription = fmt.Sprintf("%s/source-description", apis.GroupName) )
Functions ¶
This section is empty.
Types ¶
type VersionedSecretStore ¶
type VersionedSecretStore interface { UpdateSecretReferences(ctx context.Context, namespace string, podSpec *corev1.PodSpec) error Create(ctx context.Context, namespace string, secretName string, secretData map[string]string, labels map[string]string, sourceDescription string) error Get(ctx context.Context, namespace string, secretName string, version int) (*corev1.Secret, error) Latest(ctx context.Context, namespace string, secretName string) (*corev1.Secret, error) List(ctx context.Context, namespace string, secretName string) ([]corev1.Secret, error) VersionCount(ctx context.Context, namespace string, secretName string) (int, error) Delete(ctx context.Context, namespace string, secretName string) error Decorate(ctx context.Context, namespace string, secretName string, key string, value string) error }
VersionedSecretStore is the interface to version secrets in Kubernetes
Each update to the secret results in a new persisted version. An existing persisted version of a secret cannot be altered or deleted. The deletion of a secret will result in the removal of all persisted version of that secret.
The version number is an integer that is incremented with each version of the secret, which the greatest number being the current/latest version.
When saving a new secret, a source description is required, which should explain the sources of the rendered secret, e.g. the location of the Custom Resource Definition that generated it.
type VersionedSecretStoreImpl ¶
type VersionedSecretStoreImpl struct {
// contains filtered or unexported fields
}
VersionedSecretStoreImpl contains the required fields to persist a secret
func NewVersionedSecretStore ¶
func NewVersionedSecretStore(client client.Client) VersionedSecretStoreImpl
NewVersionedSecretStore returns a VersionedSecretStore implementation to be used when working with desired secret secrets
func (VersionedSecretStoreImpl) Create ¶
func (p VersionedSecretStoreImpl) Create(ctx context.Context, namespace string, secretName string, secretData map[string]string, labels map[string]string, sourceDescription string) error
Create creates a new version of the secret from secret data
func (VersionedSecretStoreImpl) Decorate ¶
func (p VersionedSecretStoreImpl) Decorate(ctx context.Context, namespace string, secretName string, key string, value string) error
Decorate adds a label to the latest version of the secret
func (VersionedSecretStoreImpl) Delete ¶
func (p VersionedSecretStoreImpl) Delete(ctx context.Context, namespace string, secretName string) error
Delete removes all versions of the secret and therefore the secret itself.
func (VersionedSecretStoreImpl) Get ¶
func (p VersionedSecretStoreImpl) Get(ctx context.Context, namespace string, deploymentName string, version int) (*corev1.Secret, error)
Get returns a specific version of the secret
func (VersionedSecretStoreImpl) Latest ¶
func (p VersionedSecretStoreImpl) Latest(ctx context.Context, namespace string, secretName string) (*corev1.Secret, error)
Latest returns the latest version of the secret
func (VersionedSecretStoreImpl) List ¶
func (p VersionedSecretStoreImpl) List(ctx context.Context, namespace string, secretName string) ([]corev1.Secret, error)
List returns all versions of the secret