in projects/aws/bottlerocket-bootstrap/pkg/utils/parsers.go [31:48]
func GetApiServerFromKubeConfig(path string) (string, error) {
rawConfig, err := getKubeConfigRaw(path)
if err != nil {
return "", errors.Wrap(err, "Error getting kubeconfig parsed into raw config")
}
// Get the server from auth information
var server string
if len(rawConfig.Clusters) != 1 {
return "", errors.Wrap(err, "More than one cluster found in control-plane init admin.conf")
}
fmt.Printf("\n%+v\n", rawConfig.Clusters)
for _, clusterInfo := range rawConfig.Clusters {
server = clusterInfo.Server
break
}
return server, nil
}