vendor: revendor
This commit is contained in:
		
							
								
								
									
										20
									
								
								vendor/k8s.io/apimachinery/pkg/runtime/codec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/k8s.io/apimachinery/pkg/runtime/codec.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -283,6 +283,7 @@ var _ GroupVersioner = multiGroupVersioner{} | ||||
| type multiGroupVersioner struct { | ||||
| 	target             schema.GroupVersion | ||||
| 	acceptedGroupKinds []schema.GroupKind | ||||
| 	coerce             bool | ||||
| } | ||||
|  | ||||
| // NewMultiGroupVersioner returns the provided group version for any kind that matches one of the provided group kinds. | ||||
| @@ -294,6 +295,22 @@ func NewMultiGroupVersioner(gv schema.GroupVersion, groupKinds ...schema.GroupKi | ||||
| 	return multiGroupVersioner{target: gv, acceptedGroupKinds: groupKinds} | ||||
| } | ||||
|  | ||||
| // NewCoercingMultiGroupVersioner returns the provided group version for any incoming kind. | ||||
| // Incoming kinds that match the provided groupKinds are preferred. | ||||
| // Kind may be empty in the provided group kind, in which case any kind will match. | ||||
| // Examples: | ||||
| //   gv=mygroup/__internal, groupKinds=mygroup/Foo, anothergroup/Bar | ||||
| //   KindForGroupVersionKinds(yetanother/v1/Baz, anothergroup/v1/Bar) -> mygroup/__internal/Bar (matched preferred group/kind) | ||||
| // | ||||
| //   gv=mygroup/__internal, groupKinds=mygroup, anothergroup | ||||
| //   KindForGroupVersionKinds(yetanother/v1/Baz, anothergroup/v1/Bar) -> mygroup/__internal/Bar (matched preferred group) | ||||
| // | ||||
| //   gv=mygroup/__internal, groupKinds=mygroup, anothergroup | ||||
| //   KindForGroupVersionKinds(yetanother/v1/Baz, yetanother/v1/Bar) -> mygroup/__internal/Baz (no preferred group/kind match, uses first kind in list) | ||||
| func NewCoercingMultiGroupVersioner(gv schema.GroupVersion, groupKinds ...schema.GroupKind) GroupVersioner { | ||||
| 	return multiGroupVersioner{target: gv, acceptedGroupKinds: groupKinds, coerce: true} | ||||
| } | ||||
|  | ||||
| // KindForGroupVersionKinds returns the target group version if any kind matches any of the original group kinds. It will | ||||
| // use the originating kind where possible. | ||||
| func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersionKind) (schema.GroupVersionKind, bool) { | ||||
| @@ -308,5 +325,8 @@ func (v multiGroupVersioner) KindForGroupVersionKinds(kinds []schema.GroupVersio | ||||
| 			return v.target.WithKind(src.Kind), true | ||||
| 		} | ||||
| 	} | ||||
| 	if v.coerce && len(kinds) > 0 { | ||||
| 		return v.target.WithKind(kinds[0].Kind), true | ||||
| 	} | ||||
| 	return schema.GroupVersionKind{}, false | ||||
| } | ||||
|   | ||||
							
								
								
									
										2
									
								
								vendor/k8s.io/apimachinery/pkg/runtime/converter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/k8s.io/apimachinery/pkg/runtime/converter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -746,7 +746,7 @@ func isZero(v reflect.Value) bool { | ||||
| func structToUnstructured(sv, dv reflect.Value) error { | ||||
| 	st, dt := sv.Type(), dv.Type() | ||||
| 	if dt.Kind() == reflect.Interface && dv.NumMethod() == 0 { | ||||
| 		dv.Set(reflect.MakeMap(mapStringInterfaceType)) | ||||
| 		dv.Set(reflect.MakeMapWithSize(mapStringInterfaceType, st.NumField())) | ||||
| 		dv = dv.Elem() | ||||
| 		dt = dv.Type() | ||||
| 	} | ||||
|   | ||||
							
								
								
									
										1
									
								
								vendor/k8s.io/apimachinery/pkg/runtime/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/k8s.io/apimachinery/pkg/runtime/types.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -42,6 +42,7 @@ type TypeMeta struct { | ||||
|  | ||||
| const ( | ||||
| 	ContentTypeJSON string = "application/json" | ||||
| 	ContentTypeYAML string = "application/yaml" | ||||
| ) | ||||
|  | ||||
| // RawExtension is used to hold extensions in external versions. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user