mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
fixes
This commit is contained in:
@@ -89,10 +89,10 @@ func (f *SecretFactory) MakeSecret(args *types.SecretArgs) (*corev1.Secret, erro
|
|||||||
func addKvToSecret(secret *corev1.Secret, keyName, data string) error {
|
func addKvToSecret(secret *corev1.Secret, keyName, data string) error {
|
||||||
// Note, the rules for SecretKeys keys are the exact same as the ones for ConfigMap.
|
// Note, the rules for SecretKeys keys are the exact same as the ones for ConfigMap.
|
||||||
if errs := validation.IsConfigMapKey(keyName); len(errs) != 0 {
|
if errs := validation.IsConfigMapKey(keyName); len(errs) != 0 {
|
||||||
return fmt.Errorf("%q is not a valid key name for a ConfigMap: %s", keyName, strings.Join(errs, ";"))
|
return fmt.Errorf("%q is not a valid key name for a Secret: %s", keyName, strings.Join(errs, ";"))
|
||||||
}
|
}
|
||||||
if _, entryExists := secret.Data[keyName]; entryExists {
|
if _, entryExists := secret.Data[keyName]; entryExists {
|
||||||
return fmt.Errorf("cannot add key %s, another key by that name already exists: %v", keyName, secret.Data)
|
return fmt.Errorf("cannot add key %s, another key by that name already exists", keyName)
|
||||||
}
|
}
|
||||||
secret.Data[keyName] = []byte(data)
|
secret.Data[keyName] = []byte(data)
|
||||||
return nil
|
return nil
|
||||||
@@ -110,7 +110,6 @@ func (f *SecretFactory) keyValuesFromCommands(sources map[string]string) ([]kvPa
|
|||||||
var kvs []kvPair
|
var kvs []kvPair
|
||||||
for k, cmd := range sources {
|
for k, cmd := range sources {
|
||||||
content, err := f.createSecretKey(cmd)
|
content, err := f.createSecretKey(cmd)
|
||||||
fmt.Println("createSecretKey:", content)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,17 +120,15 @@ type SecretArgs struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CommandSources contains some generic sources for secrets.
|
// CommandSources contains some generic sources for secrets.
|
||||||
// Only one field can be set.
|
|
||||||
type CommandSources struct {
|
type CommandSources struct {
|
||||||
// Map of keys to commands to generate the values
|
// Map of keys to commands to generate the values
|
||||||
Commands map[string]string `json:"commands,omitempty" yaml:"literals,omitempty"`
|
Commands map[string]string `json:"commands,omitempty" yaml:"commands,omitempty"`
|
||||||
// EnvCommand to output lines of key=val pairs to create a secret.
|
// EnvCommand to output lines of key=val pairs to create a secret.
|
||||||
// i.e. a Docker .env file or a .ini file.
|
// i.e. a Docker .env file or a .ini file.
|
||||||
EnvCommand string `json:"envCommand,omitempty" yaml:"env,omitempty"`
|
EnvCommand string `json:"envCommand,omitempty" yaml:"envCommand,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataSources contains some generic sources for configmaps.
|
// DataSources contains some generic sources for configmaps.
|
||||||
// Only one field can be set.
|
|
||||||
type DataSources struct {
|
type DataSources struct {
|
||||||
// LiteralSources is a list of literal sources.
|
// LiteralSources is a list of literal sources.
|
||||||
// Each literal source should be a key and literal value,
|
// Each literal source should be a key and literal value,
|
||||||
|
|||||||
Reference in New Issue
Block a user