Skip to content

Commit

Permalink
fix: coordinate secret decryption (#259)
Browse files Browse the repository at this point in the history
Fixes #258
  • Loading branch information
mumoshu authored Aug 30, 2018
1 parent b3ebd4c commit 0c8a89c
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions helmexec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ import (

"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"sync"
)

const (
command = "helm"
)

type execer struct {
helmBinary string
runner Runner
logger *zap.SugaredLogger
kubeContext string
extra []string
helmBinary string
runner Runner
logger *zap.SugaredLogger
kubeContext string
extra []string
decryptionMutex sync.Mutex
}

func NewLogger(writer io.Writer, logLevel string) *zap.SugaredLogger {
Expand Down Expand Up @@ -101,6 +103,10 @@ func (helm *execer) ReleaseStatus(name string) error {
}

func (helm *execer) DecryptSecret(name string) (string, error) {
// Prevents https://github.com/roboll/helmfile/issues/258
helm.decryptionMutex.Lock()
defer helm.decryptionMutex.Unlock()

helm.logger.Infof("Decrypting secret %v", name)
out, err := helm.exec(append([]string{"secrets", "dec", name})...)
helm.write(out)
Expand Down

0 comments on commit 0c8a89c

Please sign in to comment.