Merge pull request #14897 from johngmyers/cluster-ssh

Include SSHCredentials in create cluster dryrun output
This commit is contained in:
Kubernetes Prow Robot 2022-12-28 00:09:28 -08:00 committed by GitHub
commit b47289178d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -33,6 +33,7 @@ import (
"github.com/spf13/pflag" "github.com/spf13/pflag"
"go.uber.org/multierr" "go.uber.org/multierr"
apierrors "k8s.io/apimachinery/pkg/api/errors" apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/klog/v2" "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) 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 { for _, o := range addons {
obj = append(obj, o.ToUnstructured()) obj = append(obj, o.ToUnstructured())
} }