Merge pull request #9985 from olemarkus/kdi-no-node-nil

Fix nil pointer when instance has not joined the cluster
This commit is contained in:
Kubernetes Prow Robot 2020-09-24 22:43:11 -07:00 committed by GitHub
commit dff69018c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -227,7 +227,13 @@ func RunDeleteInstance(ctx context.Context, f *util.Factory, out io.Writer, opti
if options.CloudOnly {
fmt.Fprintf(out, "Instance %v found for deletion\n", cloudMember.ID)
} else {
fmt.Fprintf(out, "Instance %v (%v) found for deletion\n", cloudMember.ID, cloudMember.Node.Name)
if cloudMember.Node != nil {
fmt.Fprintf(out, "Instance %v (%v) found for deletion\n", cloudMember.ID, cloudMember.Node.Name)
} else {
fmt.Fprintf(os.Stderr, "Instance is not a member of the cluster\n")
fmt.Fprintf(os.Stderr, "Use --cloudonly to do a deletion without confirming progress with the k8s API\n\n")
return fmt.Errorf("error finding node name for instance: %v", cloudMember.ID)
}
}
if !options.Yes {