1
0
mirror of https://github.com/rancher/types.git synced 2025-07-17 15:01:02 +00:00

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.
This commit is contained in:
dax 2019-04-23 12:53:55 -07:00 committed by Craig Jellick
parent 233ec77bbc
commit 5f3a823cfe
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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