diff --git a/.gitignore b/.gitignore index 66fd13c..b986336 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +.idea/ \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..dd0bec7 --- /dev/null +++ b/go.mod @@ -0,0 +1,18 @@ +module github.com/baez90/kreaper + +go 1.18 + +require ( +k8s.io/client-go v0.23.5 + k8s.io/api v0.23.5 // indirect + k8s.io/apimachinery v0.23.5 // indirect + sigs.k8s.io/controller-runtime v0.11.2 +) + +replace ( + k8s.io/api => k8s.io/api v0.23.1 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.23.1 + k8s.io/apimachinery => k8s.io/apimachinery v0.23.1 + k8s.io/client-go => k8s.io/client-go v0.23.1 + k8s.io/component-base => k8s.io/component-base v0.23.1 +) \ No newline at end of file diff --git a/main.go b/main.go new file mode 100644 index 0000000..b13dfa2 --- /dev/null +++ b/main.go @@ -0,0 +1,21 @@ +package main + +import ( + "context" + + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +func main() { + restCfg, err := rest.InClusterConfig() + if err != nil { + panic(err) + } + k8sClient, err := client.NewWithWatch(restCfg, client.Options{}) + + labels := client.MatchingLabels{ + "from": "value", + } + k8sClient.Watch(context.Background(), nil, labels) +}