From 5f3a823cfec7cad701daadd1d428f4309d0e1c57 Mon Sep 17 00:00:00 2001 From: dax Date: Tue, 23 Apr 2019 12:53:55 -0700 Subject: [PATCH] Add k8s dynamic client to management context The dynamic client is needed for generic functions where the type of the object is not known beforehand. --- config/context.go | 7 +++++++ vendor.conf | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/context.go b/config/context.go index 58a26039..de0df4c8 100644 --- a/config/context.go +++ b/config/context.go @@ -29,6 +29,7 @@ import ( "github.com/sirupsen/logrus" "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/runtime" + k8dynamic "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" ) @@ -145,6 +146,7 @@ type ManagementContext struct { LocalConfig *rest.Config RESTConfig rest.Config UnversionedClient rest.Interface + DynamicClient k8dynamic.Interface K8sClient kubernetes.Interface APIExtClient clientset.Interface Schemas *types.Schemas @@ -275,6 +277,11 @@ func NewManagementContext(config rest.Config) (*ManagementContext, error) { return nil, err } + context.DynamicClient, err = k8dynamic.NewForConfig(&config) + if err != nil { + return nil, err + } + context.RBAC, err = rbacv1.NewForConfig(config) if err != nil { return nil, err diff --git a/vendor.conf b/vendor.conf index 64eb10ac..dfbac8be 100644 --- a/vendor.conf +++ b/vendor.conf @@ -2,5 +2,5 @@ github.com/rancher/types github.com/pkg/errors v0.8.0 -github.com/rancher/norman ae750244ec5b8156788d6d1914e210f5956900b1 https://github.com/daxmc99/norman.git transitive=true +github.com/rancher/norman 7387aa53a5ba8545ac61fb612b7ed33286e995f6 transitive=true github.com/coreos/prometheus-operator v0.25.0