mirror of
https://github.com/rancher/types.git
synced 2025-08-01 21:07:41 +00:00
put schemas in cluster/workload context
This commit is contained in:
parent
7e89ddc4ae
commit
4087cd55d5
@ -8,6 +8,7 @@ import (
|
||||
"github.com/rancher/norman/signal"
|
||||
"github.com/rancher/norman/types"
|
||||
appsv1beta2 "github.com/rancher/types/apis/apps/v1beta2"
|
||||
clusterSchema "github.com/rancher/types/apis/cluster.cattle.io/v3/schema"
|
||||
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"
|
||||
@ -64,6 +65,7 @@ func (c *ManagementContext) controllers() []controller.Starter {
|
||||
}
|
||||
|
||||
type ClusterContext struct {
|
||||
Schemas *types.Schemas
|
||||
Management *ManagementContext
|
||||
ClusterName string
|
||||
RESTConfig rest.Config
|
||||
@ -89,6 +91,7 @@ func (w *ClusterContext) controllers() []controller.Starter {
|
||||
|
||||
func (w *ClusterContext) WorkloadContext() *WorkloadContext {
|
||||
return &WorkloadContext{
|
||||
Schemas: w.Schemas,
|
||||
ClusterName: w.ClusterName,
|
||||
RESTConfig: w.RESTConfig,
|
||||
UnversionedClient: w.UnversionedClient,
|
||||
@ -103,6 +106,7 @@ func (w *ClusterContext) WorkloadContext() *WorkloadContext {
|
||||
}
|
||||
|
||||
type WorkloadContext struct {
|
||||
Schemas *types.Schemas
|
||||
ClusterName string
|
||||
RESTConfig rest.Config
|
||||
UnversionedClient rest.Interface
|
||||
@ -210,6 +214,10 @@ func NewClusterContext(managementConfig, config rest.Config, clusterName string)
|
||||
context := &ClusterContext{
|
||||
RESTConfig: config,
|
||||
ClusterName: clusterName,
|
||||
Schemas: types.NewSchemas().
|
||||
AddSchemas(managementSchema.Schemas).
|
||||
AddSchemas(clusterSchema.Schemas).
|
||||
AddSchemas(projectSchema.Schemas),
|
||||
}
|
||||
|
||||
context.Management, err = NewManagementContext(managementConfig)
|
||||
|
Loading…
Reference in New Issue
Block a user