Initialize module

This commit is contained in:
Peter 2022-04-13 08:06:23 +02:00
parent 50b33cbc0c
commit 1d703905f9
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
3 changed files with 41 additions and 0 deletions

2
.gitignore vendored
View file

@ -13,3 +13,5 @@
# Dependency directories (remove the comment below to include it) # Dependency directories (remove the comment below to include it)
# vendor/ # vendor/
.idea/

18
go.mod Normal file
View file

@ -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
)

21
main.go Normal file
View file

@ -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)
}