diff --git a/apis/project.cattle.io/v3/schema/schema.go b/apis/project.cattle.io/v3/schema/schema.go index 5b6190fb..f58fecad 100644 --- a/apis/project.cattle.io/v3/schema/schema.go +++ b/apis/project.cattle.io/v3/schema/schema.go @@ -4,6 +4,7 @@ import ( "net/http" monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" "github.com/rancher/norman/types" m "github.com/rancher/norman/types/mapper" v3 "github.com/rancher/types/apis/project.cattle.io/v3" @@ -46,7 +47,8 @@ var ( Init(appTypes). Init(pipelineTypes). Init(monitoringTypes). - Init(autoscalingTypes) + Init(autoscalingTypes). + Init(istioTypes) ) func configMapTypes(schemas *types.Schemas) *types.Schemas { @@ -1088,3 +1090,19 @@ func autoscalingTypes(schemas *types.Schemas) *types.Schemas { Description string `json:"description,omitempty"` }{}) } + +func istioTypes(schemas *types.Schemas) *types.Schemas { + return schemas. + MustImport(&Version, istiov1alpha3.HTTPMatchRequest{}, struct { + Port *uint32 `json:"port,omitempty"` + }{}). + MustImport(&Version, istiov1alpha3.HTTPRoute{}, struct { + WebsocketUpgrade *bool `json:"websocketUpgrade,omitempty"` + }{}). + MustImport(&Version, istiov1alpha3.VirtualService{}, projectOverride{}, struct { + Status interface{} + }{}). + MustImport(&Version, istiov1alpha3.DestinationRule{}, projectOverride{}, struct { + Status interface{} + }{}) +} diff --git a/config/context.go b/config/context.go index 5250521e..5b602534 100644 --- a/config/context.go +++ b/config/context.go @@ -20,6 +20,7 @@ import ( managementv3 "github.com/rancher/types/apis/management.cattle.io/v3" managementSchema "github.com/rancher/types/apis/management.cattle.io/v3/schema" monitoringv1 "github.com/rancher/types/apis/monitoring.coreos.com/v1" + istiov1alpha3 "github.com/rancher/types/apis/networking.istio.io/v1alpha3" knetworkingv1 "github.com/rancher/types/apis/networking.k8s.io/v1" projectv3 "github.com/rancher/types/apis/project.cattle.io/v3" projectSchema "github.com/rancher/types/apis/project.cattle.io/v3/schema" @@ -189,6 +190,7 @@ type UserContext struct { Networking knetworkingv1.Interface Monitoring monitoringv1.Interface Cluster clusterv3.Interface + Istio istiov1alpha3.Interface } func (w *UserContext) controllers() []controller.Starter { @@ -224,6 +226,7 @@ func (w *UserContext) UserOnlyContext() *UserOnlyContext { BatchV1Beta1: w.BatchV1Beta1, Monitoring: w.Monitoring, Cluster: w.Cluster, + Istio: w.Istio, } } @@ -244,6 +247,7 @@ type UserOnlyContext struct { BatchV1Beta1 batchv1beta1.Interface Monitoring monitoringv1.Interface Cluster clusterv3.Interface + Istio istiov1alpha3.Interface } func (w *UserOnlyContext) controllers() []controller.Starter { @@ -408,6 +412,11 @@ func NewUserContext(scaledContext *ScaledContext, config rest.Config, clusterNam return nil, err } + context.Istio, err = istiov1alpha3.NewForConfig(config) + if err != nil { + return nil, err + } + dynamicConfig := config if dynamicConfig.NegotiatedSerializer == nil { dynamicConfig.NegotiatedSerializer = dynamic.NegotiatedSerializer @@ -497,6 +506,11 @@ func NewUserOnlyContext(config rest.Config) (*UserOnlyContext, error) { return nil, err } + context.Istio, err = istiov1alpha3.NewForConfig(config) + if err != nil { + return nil, err + } + dynamicConfig := config if dynamicConfig.NegotiatedSerializer == nil { dynamicConfig.NegotiatedSerializer = dynamic.NegotiatedSerializer diff --git a/main.go b/main.go index 6b978f3c..ef84f8c1 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ package main import ( monitoringv1 "github.com/coreos/prometheus-operator/pkg/client/monitoring/v1" + istiov1alpha3 "github.com/knative/pkg/apis/istio/v1alpha3" clusterSchema "github.com/rancher/types/apis/cluster.cattle.io/v3/schema" managementSchema "github.com/rancher/types/apis/management.cattle.io/v3/schema" publicSchema "github.com/rancher/types/apis/management.cattle.io/v3public/schema" @@ -96,4 +97,11 @@ func main() { }, []interface{}{}, ) + generator.GenerateNativeTypes(istiov1alpha3.SchemeGroupVersion, + []interface{}{ + istiov1alpha3.VirtualService{}, + istiov1alpha3.DestinationRule{}, + }, + []interface{}{}, + ) }