mirror of https://github.com/k3s-io/k3s
Merge pull request #64250 from hzxuzhonghu/clean-code
Automatic merge from submit-queue (batch tested with PRs 63319, 64248, 64250, 63890, 64233). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. replace `__internal` with runtime.APIVersionInternal **What this PR does / why we need it**: Replace `__internal` with runtime.APIVersionInternal **Release note**: ```release-note NONE ```pull/8/head
commit
52e0d5a910
|
@ -122,7 +122,7 @@ func (s *Scheme) nameFunc(t reflect.Type) string {
|
|||
|
||||
for _, gvk := range gvks {
|
||||
internalGV := gvk.GroupVersion()
|
||||
internalGV.Version = "__internal" // this is hacky and maybe should be passed in
|
||||
internalGV.Version = APIVersionInternal // this is hacky and maybe should be passed in
|
||||
internalGVK := internalGV.WithKind(gvk.Kind)
|
||||
|
||||
if internalType, exists := s.gvkToType[internalGVK]; exists {
|
||||
|
|
|
@ -129,25 +129,25 @@ func TestDecode(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
serializer: &mockSerializer{actual: gvk1},
|
||||
convertor: &checkConvertor{groupVersion: schema.GroupVersion{Group: "other", Version: "__internal"}},
|
||||
convertor: &checkConvertor{groupVersion: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal}},
|
||||
expectedGVK: gvk1,
|
||||
decodes: schema.GroupVersion{Group: "other", Version: "__internal"},
|
||||
decodes: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal},
|
||||
},
|
||||
{
|
||||
serializer: &mockSerializer{actual: gvk1, obj: decodable1},
|
||||
convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "other", Version: "__internal"}},
|
||||
convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal}},
|
||||
expectedGVK: gvk1,
|
||||
sameObject: decodable2,
|
||||
decodes: schema.GroupVersion{Group: "other", Version: "__internal"},
|
||||
decodes: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal},
|
||||
},
|
||||
// defaultGVK.Group is allowed to force a conversion to the destination group
|
||||
{
|
||||
serializer: &mockSerializer{actual: gvk1, obj: decodable1},
|
||||
defaultGVK: &schema.GroupVersionKind{Group: "force"},
|
||||
convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "force", Version: "__internal"}},
|
||||
convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "force", Version: runtime.APIVersionInternal}},
|
||||
expectedGVK: gvk1,
|
||||
sameObject: decodable2,
|
||||
decodes: schema.GroupVersion{Group: "force", Version: "__internal"},
|
||||
decodes: schema.GroupVersion{Group: "force", Version: runtime.APIVersionInternal},
|
||||
},
|
||||
// uses direct conversion for into when objects differ
|
||||
{
|
||||
|
@ -184,10 +184,10 @@ func TestDecode(t *testing.T) {
|
|||
into: &runtime.VersionedObjects{Objects: []runtime.Object{}},
|
||||
|
||||
serializer: &mockSerializer{actual: gvk1, obj: decodable1},
|
||||
convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "other", Version: "__internal"}},
|
||||
convertor: &checkConvertor{in: decodable1, obj: decodable2, groupVersion: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal}},
|
||||
expectedGVK: gvk1,
|
||||
expectedObject: &runtime.VersionedObjects{Objects: []runtime.Object{decodable1, decodable2}},
|
||||
decodes: schema.GroupVersion{Group: "other", Version: "__internal"},
|
||||
decodes: schema.GroupVersion{Group: "other", Version: runtime.APIVersionInternal},
|
||||
},
|
||||
|
||||
// decode into the same version as the serialized object
|
||||
|
|
Loading…
Reference in New Issue