mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Move defaulting funcs from internal to v1
This commit is contained in:
parent
fc5066aabf
commit
8cf6d785b7
@ -35,15 +35,6 @@ func init() {
|
|||||||
obj.LabelSelector = labels.Everything()
|
obj.LabelSelector = labels.Everything()
|
||||||
obj.FieldSelector = fields.Everything()
|
obj.FieldSelector = fields.Everything()
|
||||||
},
|
},
|
||||||
// TODO: see about moving this into v1/defaults.go
|
|
||||||
func(obj *PodExecOptions) {
|
|
||||||
obj.Stderr = true
|
|
||||||
obj.Stdout = true
|
|
||||||
},
|
|
||||||
func(obj *PodAttachOptions) {
|
|
||||||
obj.Stderr = true
|
|
||||||
obj.Stdout = true
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
Scheme.AddConversionFuncs(
|
Scheme.AddConversionFuncs(
|
||||||
func(in *unversioned.Time, out *unversioned.Time, s conversion.Scope) error {
|
func(in *unversioned.Time, out *unversioned.Time, s conversion.Scope) error {
|
||||||
|
@ -70,7 +70,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !api.Semantic.DeepEqual(item, obj2) {
|
if !api.Semantic.DeepEqual(item, obj2) {
|
||||||
t.Errorf("1: %v: diff: %v\nCodec: %v\nSource:\n\n%#v\n\nEncoded:\n\n%s\n\nFinal:\n\n%#v", name, util.ObjectGoPrintDiff(item, obj2), codec, printer.Sprintf("%#v", item), string(data), printer.Sprintf("%#v", obj2))
|
t.Errorf("\n1: %v: diff: %v\nCodec: %v\nSource:\n\n%#v\n\nEncoded:\n\n%s\n\nFinal:\n\n%#v", name, util.ObjectGoPrintDiff(item, obj2), codec, printer.Sprintf("%#v", item), string(data), printer.Sprintf("%#v", obj2))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +128,8 @@ func TestList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nonRoundTrippableTypes = sets.NewString()
|
var nonRoundTrippableTypes = sets.NewString()
|
||||||
var nonInternalRoundTrippableTypes = sets.NewString("List", "ListOptions", "PodExecOptions", "PodAttachOptions")
|
|
||||||
|
var nonInternalRoundTrippableTypes = sets.NewString("List", "ListOptions")
|
||||||
var nonRoundTrippableTypesByVersion = map[string][]string{}
|
var nonRoundTrippableTypesByVersion = map[string][]string{}
|
||||||
|
|
||||||
func TestRoundTripTypes(t *testing.T) {
|
func TestRoundTripTypes(t *testing.T) {
|
||||||
|
@ -91,6 +91,14 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
j.LabelSelector, _ = labels.Parse("a=b")
|
j.LabelSelector, _ = labels.Parse("a=b")
|
||||||
j.FieldSelector, _ = fields.ParseSelector("a=b")
|
j.FieldSelector, _ = fields.ParseSelector("a=b")
|
||||||
},
|
},
|
||||||
|
func(j *api.PodExecOptions, c fuzz.Continue) {
|
||||||
|
j.Stdout = true
|
||||||
|
j.Stderr = true
|
||||||
|
},
|
||||||
|
func(j *api.PodAttachOptions, c fuzz.Continue) {
|
||||||
|
j.Stdout = true
|
||||||
|
j.Stderr = true
|
||||||
|
},
|
||||||
func(s *api.PodSpec, c fuzz.Continue) {
|
func(s *api.PodSpec, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(s)
|
c.FuzzNoCustom(s)
|
||||||
// has a default value
|
// has a default value
|
||||||
|
@ -25,6 +25,14 @@ import (
|
|||||||
|
|
||||||
func addDefaultingFuncs() {
|
func addDefaultingFuncs() {
|
||||||
api.Scheme.AddDefaultingFuncs(
|
api.Scheme.AddDefaultingFuncs(
|
||||||
|
func(obj *PodExecOptions) {
|
||||||
|
obj.Stdout = true
|
||||||
|
obj.Stderr = true
|
||||||
|
},
|
||||||
|
func(obj *PodAttachOptions) {
|
||||||
|
obj.Stdout = true
|
||||||
|
obj.Stderr = true
|
||||||
|
},
|
||||||
func(obj *ReplicationController) {
|
func(obj *ReplicationController) {
|
||||||
var labels map[string]string
|
var labels map[string]string
|
||||||
if obj.Spec.Template != nil {
|
if obj.Spec.Template != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user