kube secret handling for podman play kube

add support for both creating a secret using yaml and mounting a secret as a volume given a yaml file.
Kubernetes secrets have a different structure than podman and therefore have to be handeled differently.
In this PR, I have introduced the basic usecases of kube secrets with more implementations like env secrets
to come!

resolves #12396

Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
cdoern
2022-06-07 16:37:59 -04:00
committed by Charlie Doern
parent 8c9eff5b12
commit 438fef1caa
60 changed files with 6812 additions and 2275 deletions

View File

@ -129,7 +129,7 @@ func NewManager(rootPath string) (*SecretsManager, error) {
// Store takes a name, creates a secret and stores the secret metadata and the secret payload.
// It returns a generated ID that is associated with the secret.
// The max size for secret data is 512kB.
func (s *SecretsManager) Store(name string, data []byte, driverType string, driverOpts map[string]string) (string, error) {
func (s *SecretsManager) Store(name string, data []byte, driverType string, driverOpts map[string]string, metadata map[string]string) (string, error) {
err := validateSecretName(name)
if err != nil {
return "", err
@ -168,8 +168,12 @@ func (s *SecretsManager) Store(name string, data []byte, driverType string, driv
}
}
if metadata == nil {
metadata = make(map[string]string)
}
secr.Driver = driverType
secr.Metadata = make(map[string]string)
secr.Metadata = metadata
secr.CreatedAt = time.Now()
secr.DriverOptions = driverOpts