Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/secrets/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package secrets
import (
"context"
"errors"
"k8s.io/client-go/rest"
"os"
"sync"

"k8s.io/client-go/rest"
)

type SecretContext struct {
mutex *sync.RWMutex
Cache map[string]string
FileCache map[string]string
RestConfig *rest.Config
Expand All @@ -19,6 +22,7 @@ var secretContextKey = "secretContext"

func NewContext(ctx context.Context, c *rest.Config, namespace string) context.Context {
return context.WithValue(ctx, secretContextKey, &SecretContext{
mutex: &sync.RWMutex{},
Cache: make(map[string]string),
FileCache: make(map[string]string),
RestConfig: c,
Expand Down
6 changes: 5 additions & 1 deletion pkg/secrets/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package secrets
import (
"context"
"fmt"
"github.com/armory/go-yaml-tools/pkg/secrets"
"os"

"github.com/armory/go-yaml-tools/pkg/secrets"
)

func init() {
Expand Down Expand Up @@ -45,11 +46,14 @@ func Decode(ctx context.Context, val string) (string, bool, error) {
}

// If we could get the cache, update it
c.mutex.Lock()
if dec.IsFile() {
c.FileCache[val] = v
} else {
c.Cache[val] = v
}
c.mutex.Unlock()

return v, dec.IsFile(), nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/validate/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package validate
import (
"context"
"fmt"

"github.com/armory/spinnaker-operator/pkg/apis/spinnaker/interfaces"
"k8s.io/apimachinery/pkg/util/wait"
)
Expand Down