// GetKubernetesNamespaceFromMachines reads the namespace of the Kubernetes control
// plane from the applied machines. If no namespace is found, the
// default Kubernetes namespace will be returned.
GetKubernetesNamespaceFromMachines reads the namespace of the Kubernetes control
plane from the applied machines. If no namespace is found, the
default Kubernetes namespace will be returned.
// GetKubernetesNamespaceFromMachines reads the namespace of the Kubernetes control // plane from the applied machines . If no namespace is found the // default Kubernetes namespace will be returned .
func GetKubernetesNamespaceFromMachines() (string, error) {
	cs, err := clientcmd.NewClusterApiClientForDefaultSearchPath("", clientcmd.NewConfigOverrides())
	if err != nil {
		return "", err
	}
	client := cs.ClusterV1alpha1()
	mi := client.Machines("")
	if mi == nil {
		return "", errors.New("No MachineInterface found")
	}
	mlist, err := mi.List(v1.ListOptions{})
	if err != nil {
		return "", err
	}
	for _, m := range mlist.Items {
		mNS := m.ObjectMeta.Namespace
		if mNS == "" {
			continue
		}
		return mNS, nil
	}
	return manifest.DefaultNamespace, nil
}
func GetKubernetesNamespaceFromMachines ( ) ( string , error ) { cs , err := clientcmd . NewClusterApiClientForDefaultSearchPath ( " " , clientcmd . NewConfigOverrides ( ) ) if err != nil { return " " , err } client := cs . ClusterV1alpha1 ( ) mi := client . Machines ( " " ) if mi == nil { return " " , errors . New ( " " ) } mlist , err := mi . List ( v1 . ListOptions { } ) if err != nil { return " " , err } for _ , m := range mlist . Items { mNS := m . ObjectMeta . Namespace if mNS == " " { continue } return mNS , nil } return manifest . DefaultNamespace , nil }
GetKubernetesNamespaceFromMachines reads the namespace of the Kubernetes control
plane from the applied machines.
GetKubernetesNamespaceFromMachines reads the namespace of the Kubernetes control plane from the applied machines .