This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 139
/
main.go
127 lines (123 loc) · 3.68 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//go:generate go run generator/cleanup/main.go
//go:generate go run main.go
package main
import (
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring"
monitoringv1 "github.com/coreos/prometheus-operator/pkg/apis/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"
projectSchema "github.com/rancher/types/apis/project.cattle.io/v3/schema"
"github.com/rancher/types/generator"
appsv1 "k8s.io/api/apps/v1"
scalingv2beta2 "k8s.io/api/autoscaling/v2beta2"
batchv1 "k8s.io/api/batch/v1"
batchv1beta1 "k8s.io/api/batch/v1beta1"
v1 "k8s.io/api/core/v1"
extv1beta1 "k8s.io/api/extensions/v1beta1"
knetworkingv1 "k8s.io/api/networking/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
rbacv1 "k8s.io/api/rbac/v1"
storagev1 "k8s.io/api/storage/v1"
k8sschema "k8s.io/apimachinery/pkg/runtime/schema"
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
)
func main() {
generator.GenerateComposeType(projectSchema.Schemas, managementSchema.Schemas, clusterSchema.Schemas)
generator.Generate(managementSchema.Schemas, map[string]bool{
"userAttribute": true,
})
generator.Generate(publicSchema.PublicSchemas, nil)
generator.Generate(clusterSchema.Schemas, map[string]bool{
"clusterUserAttribute": true,
"clusterAuthToken": true,
})
generator.Generate(projectSchema.Schemas, nil)
generator.GenerateNativeTypes(v1.SchemeGroupVersion, []interface{}{
v1.Endpoints{},
v1.PersistentVolumeClaim{},
v1.Pod{},
v1.Service{},
v1.Secret{},
v1.ConfigMap{},
v1.ServiceAccount{},
v1.ReplicationController{},
v1.ResourceQuota{},
v1.LimitRange{},
}, []interface{}{
v1.Node{},
v1.ComponentStatus{},
v1.Namespace{},
v1.Event{},
})
generator.GenerateNativeTypes(appsv1.SchemeGroupVersion, []interface{}{
appsv1.Deployment{},
appsv1.DaemonSet{},
appsv1.StatefulSet{},
appsv1.ReplicaSet{},
}, nil)
generator.GenerateNativeTypes(rbacv1.SchemeGroupVersion, []interface{}{
rbacv1.RoleBinding{},
rbacv1.Role{},
}, []interface{}{
rbacv1.ClusterRoleBinding{},
rbacv1.ClusterRole{},
})
generator.GenerateNativeTypes(knetworkingv1.SchemeGroupVersion, []interface{}{
knetworkingv1.NetworkPolicy{},
}, nil)
generator.GenerateNativeTypes(batchv1.SchemeGroupVersion, []interface{}{
batchv1.Job{},
}, nil)
generator.GenerateNativeTypes(batchv1beta1.SchemeGroupVersion, []interface{}{
batchv1beta1.CronJob{},
}, nil)
generator.GenerateNativeTypes(extv1beta1.SchemeGroupVersion,
[]interface{}{
extv1beta1.Ingress{},
},
nil,
)
generator.GenerateNativeTypes(policyv1beta1.SchemeGroupVersion,
nil,
[]interface{}{
policyv1beta1.PodSecurityPolicy{},
},
)
generator.GenerateNativeTypes(storagev1.SchemeGroupVersion,
nil,
[]interface{}{
storagev1.StorageClass{},
},
)
generator.GenerateNativeTypes(
k8sschema.GroupVersion{Group: monitoring.GroupName, Version: monitoringv1.Version},
[]interface{}{
monitoringv1.Prometheus{},
monitoringv1.Alertmanager{},
monitoringv1.PrometheusRule{},
monitoringv1.ServiceMonitor{},
},
nil,
)
generator.GenerateNativeTypes(scalingv2beta2.SchemeGroupVersion,
[]interface{}{
scalingv2beta2.HorizontalPodAutoscaler{},
},
nil,
)
generator.GenerateNativeTypes(istiov1alpha3.SchemeGroupVersion,
[]interface{}{
istiov1alpha3.VirtualService{},
istiov1alpha3.DestinationRule{},
},
nil,
)
generator.GenerateNativeTypes(apiregistrationv1.SchemeGroupVersion,
nil,
[]interface{}{
apiregistrationv1.APIService{},
},
)
}