mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-18 03:29:45 +02:00
feat(template): added secret template function (#1221)
* feat(tmpl): added fetchSecretValue template function
This adds a tmpl `fetchSecretValue` and `expandSecretRefs` function by:
- Adding:
- `expandSecretRefs` function in tmpl package that uses vals
package to fetch secrets
- `fetchSecretValue` function in tmpl package like below but for
single string value
- gomock for tests purpose
- Changing:
- move init of vals package to function (so the same instance can be used for template values and rendering the whole template)
* doc(secret): added doc how to use new tmpl methods
Added example usage of `fetchSecretValue` and `expandSecretRefs`
This commit is contained in:
+2
-6
@@ -16,17 +16,13 @@ import (
|
||||
|
||||
"github.com/roboll/helmfile/pkg/argparser"
|
||||
"github.com/roboll/helmfile/pkg/helmexec"
|
||||
"github.com/roboll/helmfile/pkg/plugins"
|
||||
"github.com/roboll/helmfile/pkg/remote"
|
||||
"github.com/roboll/helmfile/pkg/state"
|
||||
"github.com/variantdev/vals"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const (
|
||||
// cache size for improving performance of ref+.* secrets rendering
|
||||
valsCacheSize = 512
|
||||
)
|
||||
|
||||
type App struct {
|
||||
OverrideKubeContext string
|
||||
OverrideHelmBinary string
|
||||
@@ -95,7 +91,7 @@ func Init(app *App) *App {
|
||||
app.directoryExistsAt = directoryExistsAt
|
||||
|
||||
var err error
|
||||
app.valsRuntime, err = vals.New(vals.Options{CacheSize: valsCacheSize})
|
||||
app.valsRuntime, err = plugins.ValsInstance()
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Failed to initialize vals runtime: %v", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user