Skip to content

Commit

Permalink
fix(kubetest2): handle the nil pointer exception in writeKubeconfig w…
Browse files Browse the repository at this point in the history
…hen no cluster resrouces (#530)
  • Loading branch information
wwvela authored Dec 23, 2024
1 parent 0d3ba7b commit cb370ed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kubetest2/internal/deployers/eksapi/kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"os"
"text/template"
"fmt"

"k8s.io/klog"
)
Expand Down Expand Up @@ -46,6 +47,9 @@ type kubeconfigTemplateParameters struct {
}

func writeKubeconfig(cluster *Cluster, kubeconfigPath string) error {
if cluster == nil {
return fmt.Errorf("Cluster is nil, you might need set --static-cluster-name or set --up to initial cluster resrouces")
}
klog.Infof("writing kubeconfig to %s for cluster: %s", kubeconfigPath, cluster.arn)
templateParams := kubeconfigTemplateParameters{
ClusterCertificateAuthority: cluster.certificateAuthorityData,
Expand Down

0 comments on commit cb370ed

Please sign in to comment.