-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (31 loc) · 771 Bytes
/
main.go
File metadata and controls
36 lines (31 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"context"
"fmt"
"github.com/ksraj123/lister-sa/pkg/constants"
"github.com/ksraj123/lister-sa/pkg/executor"
"github.com/ksraj123/lister-sa/pkg/utils"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
)
var (
clientset *kubernetes.Clientset
ctx context.Context
)
func init() {
config, err := rest.InClusterConfig()
if err != nil {
fmt.Printf("error %s, getting inclusterconfig", err.Error())
}
clientset, err = kubernetes.NewForConfig(config)
if err != nil {
fmt.Printf("error %s, creating clientset\n", err.Error())
}
ctx = context.Background()
}
func main() {
namespaces := utils.EnvVarSlice(constants.NAMESPACES_ENV_VAR)
for _, namespace := range namespaces {
executor.Execute(clientset, ctx, namespace)
}
}