The AtList sample does not compile. Can you explain how this should work? I fixed up the imports and package names as below but I am getting the following error
dlan@dlan-XPS-13:~/repos/kube/genesys/cnat-client$ go build
# dlan/cnat-client
./main.go:18:14: undefined: client.NewScheme
./main.go:25:55: cannot use client.InNamespace("default") (type client.InNamespace) as type runtime.Object in argument to cl.List:
client.InNamespace does not implement runtime.Object (missing DeepCopyObject method)
./main.go:25:55: cannot use list (type *v1alpha1.AtList) as type client.ListOption in argument to cl.List:
*v1alpha1.AtList does not implement client.ListOption (missing ApplyToList method)
package main
import (
"context"
"flag"
"k8s.io/client-go/tools/clientcmd"
cnatv1alpha1 "github.com/programming-kubernetes/cnat/cnat-kubebuilder/pkg/apis/cnat/v1alpha1"
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"
)
func main() {
kubeconfig := flag.String("kubeconfig", "~/.kube/config", "kubeconfig file")
flag.Parse()
config, _ := clientcmd.BuildConfigFromFlags("", *kubeconfig)
crScheme := runtimeclient.NewScheme()
cnatv1alpha1.AddToScheme(crScheme)
cl, _ := runtimeclient.New(config, runtimeclient.Options{
Scheme: crScheme,
})
list := &cnatv1alpha1.AtList{}
_ = cl.List(context.TODO(), runtimeclient.InNamespace("default"), list)
}
The AtList sample does not compile. Can you explain how this should work? I fixed up the imports and package names as below but I am getting the following error
Here's the code