mirror of
https://github.com/rancher/types.git
synced 2025-08-31 21:00:16 +00:00
Introduce APIService resource to Rancher
This commit is contained in:
committed by
Alena Prokharchyk
parent
62d70fb549
commit
35112c6ee7
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/rancher/types/factory"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
storagev1 "k8s.io/api/storage/v1"
|
||||
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -25,7 +26,8 @@ var (
|
||||
Init(namespaceTypes).
|
||||
Init(persistentVolumeTypes).
|
||||
Init(storageClassTypes).
|
||||
Init(tokens)
|
||||
Init(tokens).
|
||||
Init(apiServiceTypes)
|
||||
)
|
||||
|
||||
func namespaceTypes(schemas *types.Schemas) *types.Schemas {
|
||||
@@ -130,3 +132,11 @@ func tokens(schemas *types.Schemas) *types.Schemas {
|
||||
schema.ResourceMethods = []string{}
|
||||
})
|
||||
}
|
||||
|
||||
func apiServiceTypes(Schemas *types.Schemas) *types.Schemas {
|
||||
return Schemas.
|
||||
AddMapperForType(&Version, apiregistrationv1.APIService{},
|
||||
&m.Embed{Field: "status"},
|
||||
).
|
||||
MustImport(&Version, apiregistrationv1.APIService{})
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/rancher/norman/signal"
|
||||
"github.com/rancher/norman/store/proxy"
|
||||
"github.com/rancher/norman/types"
|
||||
apiregistrationv1 "github.com/rancher/types/apis/apiregistration.k8s.io/v1"
|
||||
appsv1beta2 "github.com/rancher/types/apis/apps/v1beta2"
|
||||
autoscaling "github.com/rancher/types/apis/autoscaling/v2beta2"
|
||||
batchv1 "github.com/rancher/types/apis/batch/v1"
|
||||
@@ -179,22 +180,24 @@ type UserContext struct {
|
||||
APIExtClient clientset.Interface
|
||||
K8sClient kubernetes.Interface
|
||||
|
||||
Apps appsv1beta2.Interface
|
||||
Autoscaling autoscaling.Interface
|
||||
Project projectv3.Interface
|
||||
Core corev1.Interface
|
||||
RBAC rbacv1.Interface
|
||||
Extensions extv1beta1.Interface
|
||||
BatchV1 batchv1.Interface
|
||||
BatchV1Beta1 batchv1beta1.Interface
|
||||
Networking knetworkingv1.Interface
|
||||
Monitoring monitoringv1.Interface
|
||||
Cluster clusterv3.Interface
|
||||
Istio istiov1alpha3.Interface
|
||||
APIAggregation apiregistrationv1.Interface
|
||||
Apps appsv1beta2.Interface
|
||||
Autoscaling autoscaling.Interface
|
||||
Project projectv3.Interface
|
||||
Core corev1.Interface
|
||||
RBAC rbacv1.Interface
|
||||
Extensions extv1beta1.Interface
|
||||
BatchV1 batchv1.Interface
|
||||
BatchV1Beta1 batchv1beta1.Interface
|
||||
Networking knetworkingv1.Interface
|
||||
Monitoring monitoringv1.Interface
|
||||
Cluster clusterv3.Interface
|
||||
Istio istiov1alpha3.Interface
|
||||
}
|
||||
|
||||
func (w *UserContext) controllers() []controller.Starter {
|
||||
return []controller.Starter{
|
||||
w.APIAggregation,
|
||||
w.Apps,
|
||||
w.Project,
|
||||
w.Core,
|
||||
@@ -237,21 +240,23 @@ type UserOnlyContext struct {
|
||||
UnversionedClient rest.Interface
|
||||
K8sClient kubernetes.Interface
|
||||
|
||||
Apps appsv1beta2.Interface
|
||||
Autoscaling autoscaling.Interface
|
||||
Project projectv3.Interface
|
||||
Core corev1.Interface
|
||||
RBAC rbacv1.Interface
|
||||
Extensions extv1beta1.Interface
|
||||
BatchV1 batchv1.Interface
|
||||
BatchV1Beta1 batchv1beta1.Interface
|
||||
Monitoring monitoringv1.Interface
|
||||
Cluster clusterv3.Interface
|
||||
Istio istiov1alpha3.Interface
|
||||
APIRegistration apiregistrationv1.Interface
|
||||
Apps appsv1beta2.Interface
|
||||
Autoscaling autoscaling.Interface
|
||||
Project projectv3.Interface
|
||||
Core corev1.Interface
|
||||
RBAC rbacv1.Interface
|
||||
Extensions extv1beta1.Interface
|
||||
BatchV1 batchv1.Interface
|
||||
BatchV1Beta1 batchv1beta1.Interface
|
||||
Monitoring monitoringv1.Interface
|
||||
Cluster clusterv3.Interface
|
||||
Istio istiov1alpha3.Interface
|
||||
}
|
||||
|
||||
func (w *UserOnlyContext) controllers() []controller.Starter {
|
||||
return []controller.Starter{
|
||||
w.APIRegistration,
|
||||
w.Apps,
|
||||
w.Project,
|
||||
w.Core,
|
||||
@@ -407,6 +412,10 @@ func NewUserContext(scaledContext *ScaledContext, config rest.Config, clusterNam
|
||||
}
|
||||
|
||||
context.Monitoring, err = monitoringv1.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
context.Cluster, err = clusterv3.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -417,6 +426,11 @@ func NewUserContext(scaledContext *ScaledContext, config rest.Config, clusterNam
|
||||
return nil, err
|
||||
}
|
||||
|
||||
context.APIAggregation, err = apiregistrationv1.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dynamicConfig := config
|
||||
if dynamicConfig.NegotiatedSerializer == nil {
|
||||
dynamicConfig.NegotiatedSerializer = dynamic.NegotiatedSerializer
|
||||
@@ -501,6 +515,10 @@ func NewUserOnlyContext(config rest.Config) (*UserOnlyContext, error) {
|
||||
}
|
||||
|
||||
context.Monitoring, err = monitoringv1.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
context.Cluster, err = clusterv3.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -511,6 +529,11 @@ func NewUserOnlyContext(config rest.Config) (*UserOnlyContext, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
context.APIRegistration, err = apiregistrationv1.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dynamicConfig := config
|
||||
if dynamicConfig.NegotiatedSerializer == nil {
|
||||
dynamicConfig.NegotiatedSerializer = dynamic.NegotiatedSerializer
|
||||
|
6
main.go
6
main.go
@@ -21,6 +21,7 @@ import (
|
||||
knetworkingv1 "k8s.io/api/networking/v1"
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
k8sschema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -104,4 +105,9 @@ func main() {
|
||||
},
|
||||
[]interface{}{},
|
||||
)
|
||||
generator.GenerateNativeTypes(apiregistrationv1.SchemeGroupVersion,
|
||||
[]interface{}{}, []interface{}{
|
||||
apiregistrationv1.APIService{},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user