Include SSHCredentials in create cluster dryrun output

This commit is contained in:
John Gardiner Myers 2022-12-27 22:49:15 -08:00
parent 4b66b5b72c
commit 309c893ca1
1 changed files with 15 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import (
"github.com/spf13/pflag"
"go.uber.org/multierr"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/klog/v2"
@ -700,6 +701,20 @@ func RunCreateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Cr
obj = append(obj, group)
}
for name, key := range c.SSHPublicKeys {
obj = append(obj, &api.SSHCredential{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Labels: map[string]string{
api.LabelClusterName: cluster.Name,
},
},
Spec: api.SSHCredentialSpec{
PublicKey: strings.TrimSpace(string(key)),
},
})
}
for _, o := range addons {
obj = append(obj, o.ToUnstructured())
}