fix comment & add servicemesh gen
Signed-off-by: runzexia <runzexia@yunify.com>
This commit is contained in:
@@ -44,3 +44,24 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw
|
||||
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,IntVal
|
||||
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,StrVal
|
||||
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,Type
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,DestinationRuleSpecTemplate,ObjectMeta
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyCondition,LastProbeTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyCondition,LastTransitionTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyCondition,Message
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyCondition,Reason
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyCondition,Status
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyCondition,Type
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyStatus,CompletionTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyStatus,Conditions
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,ServicePolicyStatus,StartTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyCondition,LastProbeTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyCondition,LastTransitionTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyCondition,Message
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyCondition,Reason
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyCondition,Status
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyCondition,Type
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategySpec,GovernorVersion
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategySpec,PrincipalVersion
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyStatus,CompletionTime
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyStatus,Conditions
|
||||
API rule violation: names_match,kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2,StrategyStatus,StartTime
|
||||
|
||||
@@ -4551,6 +4551,11 @@
|
||||
"version": "v1alpha1",
|
||||
"kind": "DeleteOptions"
|
||||
},
|
||||
{
|
||||
"group": "servicemesh.kubesphere.io",
|
||||
"version": "v1alpha2",
|
||||
"kind": "DeleteOptions"
|
||||
},
|
||||
{
|
||||
"group": "tenant.kubesphere.io",
|
||||
"version": "v1alpha1",
|
||||
@@ -4914,6 +4919,11 @@
|
||||
"version": "v1alpha1",
|
||||
"kind": "WatchEvent"
|
||||
},
|
||||
{
|
||||
"group": "servicemesh.kubesphere.io",
|
||||
"version": "v1alpha2",
|
||||
"kind": "WatchEvent"
|
||||
},
|
||||
{
|
||||
"group": "tenant.kubesphere.io",
|
||||
"version": "v1alpha1",
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
// Generate openapi for apis
|
||||
//go:generate go run ../../vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go -O openapi_generated -i ../../vendor/k8s.io/api/core/v1,../../vendor/k8s.io/apimachinery/pkg/apis/meta/v1,../../vendor/k8s.io/apimachinery/pkg/api/resource,../../vendor/k8s.io/apimachinery/pkg/runtime,../../vendor/k8s.io/apimachinery/pkg/util/intstr,k8s.io/apimachinery/pkg/version,./tenant/v1alpha1 -p kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1 -h ../../hack/boilerplate.go.txt --report-filename ../../api/api-rules/violation_exceptions.list
|
||||
//go:generate go run ../../vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go -O openapi_generated -i ../../vendor/k8s.io/api/core/v1,../../vendor/k8s.io/apimachinery/pkg/apis/meta/v1,../../vendor/k8s.io/apimachinery/pkg/api/resource,../../vendor/k8s.io/apimachinery/pkg/runtime,../../vendor/k8s.io/apimachinery/pkg/util/intstr,../../vendor/github.com/knative/pkg/apis/istio/v1alpha3,k8s.io/apimachinery/pkg/version,./servicemesh/v1alpha2 -p kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2 -h ../../hack/boilerplate.go.txt --report-filename ../../api/api-rules/violation_exceptions.list
|
||||
|
||||
// AddToSchemes may be used to add all resources defined in the project to a Scheme
|
||||
var AddToSchemes runtime.SchemeBuilder
|
||||
|
||||
12
pkg/apis/servicemesh/crdinstall/install.go
Normal file
12
pkg/apis/servicemesh/crdinstall/install.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package crdinstall
|
||||
|
||||
import (
|
||||
k8sruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
urlruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||
)
|
||||
|
||||
func Install(scheme *k8sruntime.Scheme) {
|
||||
urlruntime.Must(servicemeshv1alpha2.AddToScheme(scheme))
|
||||
urlruntime.Must(scheme.SetVersionPriority(servicemeshv1alpha2.SchemeGroupVersion))
|
||||
}
|
||||
12417
pkg/apis/servicemesh/v1alpha2/openapi_generated.go
Normal file
12417
pkg/apis/servicemesh/v1alpha2/openapi_generated.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,12 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
ResourceKindServicePolicy = "ServicePolicy"
|
||||
ResourceSingularServicePolicy = "servicepolicy"
|
||||
ResourcePluralServicePolicy = "servicepolicies"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@ import (
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
const (
|
||||
ResourceKindStrategy = "Strategy"
|
||||
ResourceSingularStrategy = "strategy"
|
||||
ResourcePluralStrategy = "strategies"
|
||||
)
|
||||
|
||||
type StrategyType string
|
||||
|
||||
const (
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"go/build"
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
servicemeshv1alpha2 "kubesphere.io/kubesphere/pkg/apis/servicemesh/v1alpha2"
|
||||
"kubesphere.io/kubesphere/tools/lib"
|
||||
"log"
|
||||
"os"
|
||||
@@ -16,10 +17,17 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
urlruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/kube-openapi/pkg/common"
|
||||
servicemeshinstall "kubesphere.io/kubesphere/pkg/apis/servicemesh/crdinstall"
|
||||
tenantinstall "kubesphere.io/kubesphere/pkg/apis/tenant/crdinstall"
|
||||
tenantv1alpha1 "kubesphere.io/kubesphere/pkg/apis/tenant/v1alpha1"
|
||||
)
|
||||
|
||||
var output string
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&output, "output", "./api/openapi-spec/swagger.json", "--output=./api/openapi-spec/swagger.json")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
var (
|
||||
@@ -27,14 +35,24 @@ func main() {
|
||||
Codecs = serializer.NewCodecFactory(Scheme)
|
||||
)
|
||||
// tmp install s2i api group because
|
||||
// cannot use Scheme (type *"kubesphere.io/kubesphere/vendor/k8s.io/apimachinery/pkg/runtime".Scheme) as type *"github.com/kubesphere/s2ioperator/vendor/k8s.io/apimachinery/pkg/runtime".Scheme in argument to "github.com/kubesphere/s2ioperator/pkg/apis/devops/install".Install
|
||||
// cannot use Scheme (type *"kubesphere.io/kubesphere/vendor/k8s.io/apimachinery/pkg/runtime".Scheme) as
|
||||
// type *"github.com/kubesphere/s2ioperator/vendor/k8s.io/apimachinery/pkg/runtime".Scheme in argument to "github.com/kubesphere/s2ioperator/pkg/apis/devops/install".Install
|
||||
urlruntime.Must(s2iv1alpha1.AddToScheme(Scheme))
|
||||
urlruntime.Must(Scheme.SetVersionPriority(s2iv1alpha1.SchemeGroupVersion))
|
||||
|
||||
servicemeshinstall.Install(Scheme)
|
||||
tenantinstall.Install(Scheme)
|
||||
|
||||
mapper := meta.NewDefaultRESTMapper(nil)
|
||||
|
||||
mapper.AddSpecific(servicemeshv1alpha2.SchemeGroupVersion.WithKind(servicemeshv1alpha2.ResourceKindServicePolicy),
|
||||
servicemeshv1alpha2.SchemeGroupVersion.WithResource(servicemeshv1alpha2.ResourcePluralServicePolicy),
|
||||
servicemeshv1alpha2.SchemeGroupVersion.WithResource(servicemeshv1alpha2.ResourceSingularServicePolicy), meta.RESTScopeRoot)
|
||||
|
||||
mapper.AddSpecific(servicemeshv1alpha2.SchemeGroupVersion.WithKind(servicemeshv1alpha2.ResourceKindStrategy),
|
||||
servicemeshv1alpha2.SchemeGroupVersion.WithResource(servicemeshv1alpha2.ResourcePluralStrategy),
|
||||
servicemeshv1alpha2.SchemeGroupVersion.WithResource(servicemeshv1alpha2.ResourceSingularStrategy), meta.RESTScopeRoot)
|
||||
|
||||
mapper.AddSpecific(tenantv1alpha1.SchemeGroupVersion.WithKind(tenantv1alpha1.ResourceKindWorkspace),
|
||||
tenantv1alpha1.SchemeGroupVersion.WithResource(tenantv1alpha1.ResourcePluralWorkspace),
|
||||
tenantv1alpha1.SchemeGroupVersion.WithResource(tenantv1alpha1.ResourceSingularWorkspace), meta.RESTScopeRoot)
|
||||
@@ -68,10 +86,16 @@ func main() {
|
||||
},
|
||||
},
|
||||
OpenAPIDefinitions: []common.GetOpenAPIDefinitions{
|
||||
servicemeshv1alpha2.GetOpenAPIDefinitions,
|
||||
tenantv1alpha1.GetOpenAPIDefinitions,
|
||||
s2iv1alpha1.GetOpenAPIDefinitions,
|
||||
},
|
||||
Resources: []schema.GroupVersionResource{
|
||||
//TODO(runzexia) At present, the document generation requires the openapi structure of the go language,
|
||||
// but there is no +k8s:openapi-gen=true in the repository of https://github.com/knative/pkg,
|
||||
// and the api document cannot be generated temporarily.
|
||||
//servicemeshv1alpha2.SchemeGroupVersion.WithResource(servicemeshv1alpha2.ResourcePluralStrategy),
|
||||
//servicemeshv1alpha2.SchemeGroupVersion.WithResource(servicemeshv1alpha2.ResourcePluralServicePolicy),
|
||||
tenantv1alpha1.SchemeGroupVersion.WithResource(tenantv1alpha1.ResourcePluralWorkspace),
|
||||
s2iv1alpha1.SchemeGroupVersion.WithResource(s2iv1alpha1.ResourcePluralS2iRun),
|
||||
s2iv1alpha1.SchemeGroupVersion.WithResource(s2iv1alpha1.ResourcePluralS2iBuilderTemplate),
|
||||
@@ -83,12 +107,11 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
filename := build.Default.GOPATH + "/src/kubesphere.io/kubesphere/api/openapi-spec/swagger.json"
|
||||
err = os.MkdirAll(filepath.Dir(filename), 0755)
|
||||
err = os.MkdirAll(filepath.Dir(output), 0755)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
err = ioutil.WriteFile(filename, []byte(spec), 0644)
|
||||
err = ioutil.WriteFile(output, []byte(spec), 0644)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user