Hi All,

I am trying to build a go client that attempts to enumerate all projects
that match a specific label but I I keep getting the following error:

v1.ListOptions is not suitable for converting to \"meta.k8s.io/v1\"

I am following the docs on
https://docs.openshift.org/latest/go_client/getting_started.html , the code
that I am using is the following:

package cmd

import (
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
projectv1 "
github.com/openshift/client-go/project/clientset/versioned/typed/project/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
)

func printProjects() (error) {
kubeconfigPath:= "/root/.myconfig"
kubeConfig, err := clientcmd.BuildConfigFromFlags("", kubeconfigPath)
if err != nil {
panic(err.Error())
}

kubeClient, err = kubernetes.NewForConfig(kubeConfig)
if err != nil {
panic(err.Error())
}

projectClient = projectv1.New(kubeClient.RESTClient())


projects, err :=
projectClient.Projects().List(meta_v1.ListOptions{LabelSelector:
"someLabel=true"})

if err != nil {
return nil, err
}

for _, p := range projects.Items {
    log.Info(p)
}

}

func main() {
      log.Info(printProjects())
}


Any pointers would be much appreciated.

Thanks.
Luciano
_______________________________________________
users mailing list
users@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to