feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
@@ -1,18 +1,7 @@
|
||||
/*
|
||||
Copyright 2020 The KubeSphere Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
* Please refer to the LICENSE file in the root directory of the project.
|
||||
* https://github.com/kubesphere/kubesphere/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package lib
|
||||
|
||||
@@ -31,6 +20,7 @@ import (
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
genericapiserver "k8s.io/apiserver/pkg/server"
|
||||
genericoptions "k8s.io/apiserver/pkg/server/options"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
"k8s.io/kube-openapi/pkg/common/restfuladapter"
|
||||
|
||||
"k8s.io/kube-openapi/pkg/builder"
|
||||
@@ -78,7 +68,7 @@ func RenderOpenAPISpec(cfg Config) (string, error) {
|
||||
recommendedOptions.Etcd = nil
|
||||
recommendedOptions.Authentication = nil
|
||||
recommendedOptions.Authorization = nil
|
||||
recommendedOptions.CoreAPI = nil
|
||||
recommendedOptions.CoreAPI.CoreAPIKubeconfigPath = clientcmd.NewDefaultPathOptions().GetDefaultFilename()
|
||||
recommendedOptions.Admission = nil
|
||||
|
||||
// TODO have a "real" external address
|
||||
@@ -94,6 +84,8 @@ func RenderOpenAPISpec(cfg Config) (string, error) {
|
||||
}
|
||||
serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(cfg.GetOpenAPIDefinitions, apiopenapi.NewDefinitionNamer(cfg.Scheme))
|
||||
serverConfig.OpenAPIConfig.Info.InfoProps = cfg.Info
|
||||
serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(cfg.GetOpenAPIDefinitions, apiopenapi.NewDefinitionNamer(cfg.Scheme))
|
||||
serverConfig.OpenAPIV3Config.Info.InfoProps = cfg.Info
|
||||
|
||||
genericServer, err := serverConfig.Complete().New("stash-server", genericapiserver.NewEmptyDelegate()) // completion is done in Complete, no need for a second time
|
||||
if err != nil {
|
||||
@@ -130,9 +122,10 @@ func RenderOpenAPISpec(cfg Config) (string, error) {
|
||||
}
|
||||
|
||||
resmap[gvr.Resource] = ResourceInfo{
|
||||
gvk: gvk,
|
||||
obj: obj,
|
||||
list: list,
|
||||
gvk: gvk,
|
||||
obj: obj,
|
||||
list: list,
|
||||
singularName: gvr.Resource,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
/*
|
||||
Copyright 2020 The KubeSphere Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
* Please refer to the LICENSE file in the root directory of the project.
|
||||
* https://github.com/kubesphere/kubesphere/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package lib
|
||||
|
||||
@@ -28,9 +17,10 @@ import (
|
||||
)
|
||||
|
||||
type ResourceInfo struct {
|
||||
gvk schema.GroupVersionKind
|
||||
obj runtime.Object
|
||||
list runtime.Object
|
||||
gvk schema.GroupVersionKind
|
||||
obj runtime.Object
|
||||
list runtime.Object
|
||||
singularName string
|
||||
}
|
||||
|
||||
type StatusResourceInfo struct {
|
||||
@@ -120,6 +110,10 @@ func (r *StandardStorage) NamespaceScoped() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *StandardStorage) GetSingularName() string {
|
||||
return r.cfg.singularName
|
||||
}
|
||||
|
||||
func (r *StatusStandardStorage) GroupVersionKind(containingGV schema.GroupVersion) schema.GroupVersionKind {
|
||||
return r.cfg.gvk
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user