1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Factor out more common secrets command code

Making the secret without data is always the same, so factor that out.

Signed-off-by: Michael Bridgen <michael@weave.works>
This commit is contained in:
Michael Bridgen
2021-01-26 17:05:55 +00:00
parent b12c4c22fb
commit 263c664acd
4 changed files with 21 additions and 39 deletions

View File

@@ -24,7 +24,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/fluxcd/flux2/internal/utils"
)
@@ -99,20 +98,11 @@ func createSecretTLSCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("secret name is required")
}
name := args[0]
secretLabels, err := parseLabels()
secret, err := makeSecret(name)
if err != nil {
return err
}
secret := corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: rootArgs.namespace,
Labels: secretLabels,
},
StringData: map[string]string{},
}
if err = populateSecretTLS(&secret, secretTLSArgs); err != nil {
return err
}