1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-28 14:41:10 +01:00

Bump to k8s 1.25-rc.0

This commit is contained in:
JaneLiuL
2022-08-18 09:11:02 +08:00
committed by Amir Alavi
parent 1eade5bf91
commit c9b0fbe467
967 changed files with 35722 additions and 35029 deletions

View File

@@ -29,11 +29,10 @@ import (
"time"
"github.com/NYTimes/gziphandler"
"github.com/emicklei/go-restful"
"github.com/emicklei/go-restful/v3"
"github.com/golang/protobuf/proto"
openapi_v2 "github.com/google/gnostic/openapiv2"
"github.com/munnerz/goautoneg"
"gopkg.in/yaml.v2"
klog "k8s.io/klog/v2"
"k8s.io/kube-openapi/pkg/builder"
"k8s.io/kube-openapi/pkg/common"
@@ -139,48 +138,6 @@ func (o *OpenAPIService) UpdateSpec(openapiSpec *spec.Swagger) (err error) {
return nil
}
func jsonToYAML(j map[string]interface{}) yaml.MapSlice {
if j == nil {
return nil
}
ret := make(yaml.MapSlice, 0, len(j))
for k, v := range j {
ret = append(ret, yaml.MapItem{k, jsonToYAMLValue(v)})
}
return ret
}
func jsonToYAMLValue(j interface{}) interface{} {
switch j := j.(type) {
case map[string]interface{}:
return jsonToYAML(j)
case []interface{}:
ret := make([]interface{}, len(j))
for i := range j {
ret[i] = jsonToYAMLValue(j[i])
}
return ret
case float64:
// replicate the logic in https://github.com/go-yaml/yaml/blob/51d6538a90f86fe93ac480b35f37b2be17fef232/resolve.go#L151
if i64 := int64(j); j == float64(i64) {
if i := int(i64); i64 == int64(i) {
return i
}
return i64
}
if ui64 := uint64(j); j == float64(ui64) {
return ui64
}
return j
case int64:
if i := int(j); j == int64(i) {
return i
}
return j
}
return j
}
func ToProtoBinary(json []byte) ([]byte, error) {
document, err := openapi_v2.ParseDocument(json)
if err != nil {