Skip to content

Commit

Permalink
Use the same mechanism to load kubeconfig
Browse files Browse the repository at this point in the history
Interceptors and EL are both running in the cluster. They should share
the same way of loading the kubeconfig.

Using injection package, it allows the user to override the kubeconfig
with an env. variable.
  • Loading branch information
guillaumerose authored and tekton-robot committed Dec 20, 2021
1 parent 13cff21 commit 0d5e4cf
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/interceptors/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (

"github.com/tektoncd/triggers/pkg/interceptors/server"
"go.uber.org/zap"
"k8s.io/client-go/rest"
secretInformer "knative.dev/pkg/client/injection/kube/informers/core/v1/secret"
"knative.dev/pkg/injection"
"knative.dev/pkg/logging"
Expand All @@ -45,12 +44,9 @@ func main() {
// set up signals so we handle the first shutdown signal gracefully
ctx := signals.NewContext()

clusterConfig, err := rest.InClusterConfig()
if err != nil {
log.Fatalf("Failed to build config: %v", err)
}
cfg := injection.ParseAndGetRESTConfigOrDie()

ctx, startInformer := injection.EnableInjectionOrDie(ctx, clusterConfig)
ctx, startInformer := injection.EnableInjectionOrDie(ctx, cfg)

zap, err := zap.NewProduction()
if err != nil {
Expand Down

0 comments on commit 0d5e4cf

Please sign in to comment.