Azure / acr-builder

Azure Container Registry Build Runner
MIT License
38 stars 35 forks source link

Mount Secrets As File #560

Closed akashsinghal closed 4 years ago

akashsinghal commented 4 years ago

Purpose of the PR

Fixes #550 https://github.com/Azure/acr/issues/348

shahzzzam commented 4 years ago

Another suggestion for volume.go design.

I would suggesting defining a struct like:

pkg/volume/source.go
----
package volume

// Represents the source of a volume to mount.
// Only one of its members may be specified.
type Source struct {
    // Secret represents a secret that should populate this volume.
    Secret []map[string]string `yaml:"secret"`

        // add more sources here ...
}

This way, later on: we can add more sources as we want. And it is easy to extend.

K8s supports a lot of different types of sources: Check out their source code (one of them is SecretVolumeSource).

And then you can refer to the source like this:

type Volume struct {
    Name   string               `yaml:"name"`
    // Source represents the location and type of the mounted volume.
    Source Source `yaml:",inline"`
}

What do you think?