@@ -373,12 +373,36 @@ func (cmd *InitCmd) configureKubernetes() {
373373 DefaultValue : * clusterConfig .APIServer ,
374374 ValidationRegexPattern : "^https?://[a-z0-9-.]{0,99}:[0-9]{1,5}$" ,
375375 })
376+
377+ if clusterConfig .CaCert == nil {
378+ clusterConfig .CaCert = configutil .String ("" )
379+ }
376380 clusterConfig .CaCert = stdinutil .AskChangeQuestion (& stdinutil.GetFromStdinParams {
377381 Question : "What is the CA Certificate of your API Server? (PEM)" ,
378382 DefaultValue : * clusterConfig .CaCert ,
379383 InputTerminationString : "-----END CERTIFICATE-----" ,
380384 })
381- clusterConfig .User .Username = stdinutil .AskChangeQuestion (& stdinutil.GetFromStdinParams {
385+
386+ if clusterConfig .User == nil {
387+ clusterConfig .User = & v1.ClusterUser {
388+ Username : configutil .String ("" ),
389+ ClientCert : configutil .String ("" ),
390+ ClientKey : configutil .String ("" ),
391+ }
392+ } else {
393+ if clusterConfig .User .Username == nil {
394+ clusterConfig .User .Username = configutil .String ("" )
395+ }
396+
397+ if clusterConfig .User .ClientCert == nil {
398+ clusterConfig .User .ClientCert = configutil .String ("" )
399+ }
400+
401+ if clusterConfig .User .ClientKey == nil {
402+ clusterConfig .User .ClientKey = configutil .String ("" )
403+ }
404+ }
405+ clusterConfig .User .Username = stdinutil .GetFromStdin (& stdinutil.GetFromStdinParams {
382406 Question : "What is your Kubernetes username?" ,
383407 DefaultValue : * clusterConfig .User .Username ,
384408 ValidationRegexPattern : v1 .Kubernetes .RegexPatterns .Name ,
0 commit comments