@@ -28,6 +28,7 @@ import (
2828 "k8s.io/apimachinery/pkg/fields"
2929 "k8s.io/apimachinery/pkg/runtime"
3030 "k8s.io/apimachinery/pkg/util/wait"
31+ "k8s.io/client-go/dynamic"
3132 "k8s.io/client-go/kubernetes"
3233 "k8s.io/client-go/tools/clientcmd"
3334 ctrl "sigs.k8s.io/controller-runtime"
@@ -74,18 +75,19 @@ func Command() *cobra.Command {
7475 var group wait.Group
7576 // wait all tasks in the group are over
7677 defer group .Wait ()
77-
7878 secrets := make ([]string , 0 )
7979 if len (imagePullSecrets ) > 0 {
8080 secrets = append (secrets , imagePullSecrets ... )
8181 }
82-
82+ dynclient , err := dynamic .NewForConfig (config )
83+ if err != nil {
84+ return err
85+ }
8386 // Create kubernetes client
8487 kubeclient , err := kubernetes .NewForConfig (config )
8588 if err != nil {
8689 return err
8790 }
88-
8991 namespace , _ , err := kubeConfig .Namespace ()
9092 if err != nil {
9193 return fmt .Errorf ("failed to get namespace from kubeconfig: %w" , err )
@@ -95,12 +97,10 @@ func Command() *cobra.Command {
9597 log .Printf ("Using namespace '%s' - consider setting explicit namespace" , namespace )
9698 }
9799 rOpts , nOpts , err := ocifs .RegistryOpts (kubeclient .CoreV1 ().Secrets (namespace ), allowInsecureRegistry , secrets ... )
98-
99100 if err != nil {
100101 log .Fatalf ("failed to initialize registry opts: %v" , err )
101102 os .Exit (1 )
102103 }
103-
104104 // create compilers
105105 apolCompiler := apolcompiler .NewCompiler ()
106106 vpolCompiler := vpolcompiler .NewCompiler ()
@@ -162,7 +162,7 @@ func Command() *cobra.Command {
162162 }
163163 // create http and grpc servers
164164 http := probes .NewServer (probesAddress )
165- grpc := authz .NewServer (grpcNetwork , grpcAddress , provider )
165+ grpc := authz .NewServer (grpcNetwork , grpcAddress , provider , dynclient )
166166 // run servers
167167 group .StartWithContext (ctx , func (ctx context.Context ) {
168168 // cancel context at the end
0 commit comments