1
0
mirror of https://github.com/rancher/types.git synced 2025-09-16 14:59:16 +00:00

Add native types for their listers

This commit is contained in:
Craig Jellick
2017-12-09 09:19:33 -07:00
committed by Darren Shepherd
parent a33c987eac
commit e77815f156
18 changed files with 1532 additions and 4 deletions

View File

@@ -7,8 +7,10 @@ import (
"github.com/rancher/norman/signal"
appsv1beta2 "github.com/rancher/types/apis/apps/v1beta2"
corev1 "github.com/rancher/types/apis/core/v1"
extv1beta1 "github.com/rancher/types/apis/extensions/v1beta1"
managementv3 "github.com/rancher/types/apis/management.cattle.io/v3"
projectv3 "github.com/rancher/types/apis/project.cattle.io/v3"
rbacv1 "github.com/rancher/types/apis/rbac/v1"
"github.com/sirupsen/logrus"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
@@ -35,9 +37,11 @@ type ClusterContext struct {
UnversionedClient rest.Interface
K8sClient kubernetes.Interface
Apps appsv1beta2.Interface
Project projectv3.Interface
Core corev1.Interface
Apps appsv1beta2.Interface
Project projectv3.Interface
Core corev1.Interface
RBAC rbacv1.Interface
Extensions extv1beta1.Interface
}
func (w *ClusterContext) controllers() []controller.Starter {
@@ -45,6 +49,8 @@ func (w *ClusterContext) controllers() []controller.Starter {
w.Apps,
w.Project,
w.Core,
w.RBAC,
w.Extensions,
}
}
@@ -118,6 +124,16 @@ func NewClusterContext(clusterConfig, config rest.Config, clusterName string) (*
return nil, err
}
context.RBAC, err = rbacv1.NewForConfig(config)
if err != nil {
return nil, err
}
context.Extensions, err = extv1beta1.NewForConfig(config)
if err != nil {
return nil, err
}
dynamicConfig := config
if dynamicConfig.NegotiatedSerializer == nil {
configConfig := dynamic.ContentConfig()