prow/cmd/mkbuild-cluster/main.go
func describeCluster(o options) (*describe, error) {
	if o.account != "" {
		act, err := getAccount()
		if err != nil {
			return nil, fmt.Errorf("get current account: %v", err)
		}
		defer setAccount(act)
		if err = setAccount(o.account); err != nil {
			return nil, fmt.Errorf("set account %s: %v", o.account, err)
		}
	}
	args, cmd := command(
		"gcloud", "container", "clusters", "describe", o.cluster,
		"--project", o.project,
		"--zone", o.zone,
		"--format=yaml",
	)
	data, err := cmd.Output()
	if err != nil {
		return nil, fmt.Errorf("%s: %v", strings.Join(args, " "), err)
	}
	var d describe
	if yaml.Unmarshal(data, &d); err != nil {
		return nil, fmt.Errorf("unmarshal gcloud: %v", err)
	}

	if d.Endpoint == "" {
		return nil, errors.New("empty endpoint")
	}
	if len(d.Auth.ClusterCACertificate) == 0 {
		return nil, errors.New("empty clusterCaCertificate")
	}

	if len(d.Auth.ClientKey) == 0 {
		return nil, errors.New("empty clientKey, consider running with --get-client-cert")
	}
	if len(d.Auth.ClientCertificate) == 0 {
		return nil, errors.New("empty clientCertificate, consider running with --get-client-cert")
	}

	return &d, nil
}
func describeCluster(o options) (*describe, error) {
	if o.account != "" {
		act, err := getAccount()
		if err != nil {
			return nil, fmt.Errorf("get current account: %v", err)
		}
		defer setAccount(act)
		if err = setAccount(o.account); err != nil {
			return nil, fmt.Errorf("set account %s: %v", o.account, err)
		}
	}
	args, cmd := command(
		"gcloud", "container", "clusters", "describe", o.cluster,
		"--project", o.project,
		"--zone", o.zone,
		"--format=yaml",
	)
	data, err := cmd.Output()
	if err != nil {
		return nil, fmt.Errorf("%s: %v", strings.Join(args, " "), err)
	}
	var d describe
	if yaml.Unmarshal(data, &d); err != nil {
		return nil, fmt.Errorf("unmarshal gcloud: %v", err)
	}

	if d.Endpoint == "" {
		return nil, errors.New("empty endpoint")
	}
	if len(d.Auth.ClusterCACertificate) == 0 {
		return nil, errors.New("empty clusterCaCertificate")
	}

	if len(d.Auth.ClientKey) == 0 {
		return nil, errors.New("empty clientKey, consider running with --get-client-cert")
	}
	if len(d.Auth.ClientCertificate) == 0 {
		return nil, errors.New("empty clientCertificate, consider running with --get-client-cert")
	}

	return &d, nil
}
// describeCluster returns details from gcloud container clusters describe.