diff --git a/kubetest2/internal/deployers/eksapi/kubeconfig.go b/kubetest2/internal/deployers/eksapi/kubeconfig.go index beb5a98d5..ce9e6f8a4 100644 --- a/kubetest2/internal/deployers/eksapi/kubeconfig.go +++ b/kubetest2/internal/deployers/eksapi/kubeconfig.go @@ -4,6 +4,7 @@ import ( "bytes" "os" "text/template" + "fmt" "k8s.io/klog" ) @@ -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,