mirror of
https://github.com/rancher/types.git
synced 2025-09-16 23:08:25 +00:00
Add k8sclient to workload context
This commit is contained in:
@@ -28,7 +28,6 @@ var (
|
||||
schema.SubContext = "projects"
|
||||
}).
|
||||
MustImport(&Version, v1.ProjectRoleTemplate{}).
|
||||
MustImport(&Version, v1.ProjectRoleTemplateBinding{}).
|
||||
MustImport(&Version, v1.PodSecurityPolicyTemplate{}).
|
||||
MustImport(&Version, v1.ClusterRoleTemplate{}).
|
||||
MustImport(&Version, v1.ClusterRoleTemplateBinding{}).
|
||||
|
@@ -12,6 +12,7 @@ import (
|
||||
workloadv1 "github.com/rancher/types/apis/workload.cattle.io/v1"
|
||||
"github.com/sirupsen/logrus"
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
@@ -35,6 +36,7 @@ type WorkloadContext struct {
|
||||
ClusterName string
|
||||
RESTConfig rest.Config
|
||||
UnversionedClient rest.Interface
|
||||
K8sClient kubernetes.Interface
|
||||
|
||||
Apps appsv1beta2.Interface
|
||||
Workload workloadv1.Interface
|
||||
@@ -104,6 +106,11 @@ func NewWorkloadContext(clusterConfig, config rest.Config, clusterName string) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
context.K8sClient, err = kubernetes.NewForConfig(&config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
context.Apps, err = appsv1beta2.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user