Initialize module
This commit is contained in:
parent
50b33cbc0c
commit
1d703905f9
3 changed files with 41 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -13,3 +13,5 @@
|
|||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
|
||||
.idea/
|
18
go.mod
Normal file
18
go.mod
Normal 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
21
main.go
Normal 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)
|
||||
}
|
Reference in a new issue