aboutsummaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-12 12:19:22 +0200
committerGitHub <noreply@github.com>2021-04-12 12:19:22 +0200
commit0ee1da50f5e221383c236ccee258cb7592ccabd6 (patch)
tree08b3798ab08a621920eff4d1f6a3a5f940d3a944 /vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
parent669311d8d8a8881571ccc81ce48b9202b15b9def (diff)
parent14375f35ee00c16327edcd0f5883cc66810fc7db (diff)
downloadpodman-0ee1da50f5e221383c236ccee258cb7592ccabd6.tar.gz
podman-0ee1da50f5e221383c236ccee258cb7592ccabd6.tar.bz2
podman-0ee1da50f5e221383c236ccee258cb7592ccabd6.zip
Merge pull request #9981 from containers/dependabot/go_modules/k8s.io/api-0.21.0
Bump k8s.io/api from 0.20.5 to 0.21.0
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/runtime/scheme.go')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/runtime/scheme.go32
1 files changed, 26 insertions, 6 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
index 697dd4ed7..ae47ab3ab 100644
--- a/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
+++ b/vendor/k8s.io/apimachinery/pkg/runtime/scheme.go
@@ -129,12 +129,6 @@ func (s *Scheme) nameFunc(t reflect.Type) string {
return gvks[0].Kind
}
-// fromScope gets the input version, desired output version, and desired Scheme
-// from a conversion.Scope.
-func (s *Scheme) fromScope(scope conversion.Scope) *Scheme {
- return s
-}
-
// Converter allows access to the converter for the scheme
func (s *Scheme) Converter() *conversion.Converter {
return s.converter
@@ -235,6 +229,32 @@ func (s *Scheme) KnownTypes(gv schema.GroupVersion) map[string]reflect.Type {
return types
}
+// VersionsForGroupKind returns the versions that a particular GroupKind can be converted to within the given group.
+// A GroupKind might be converted to a different group. That information is available in EquivalentResourceMapper.
+func (s *Scheme) VersionsForGroupKind(gk schema.GroupKind) []schema.GroupVersion {
+ availableVersions := []schema.GroupVersion{}
+ for gvk := range s.gvkToType {
+ if gk != gvk.GroupKind() {
+ continue
+ }
+
+ availableVersions = append(availableVersions, gvk.GroupVersion())
+ }
+
+ // order the return for stability
+ ret := []schema.GroupVersion{}
+ for _, version := range s.PrioritizedVersionsForGroup(gk.Group) {
+ for _, availableVersion := range availableVersions {
+ if version != availableVersion {
+ continue
+ }
+ ret = append(ret, availableVersion)
+ }
+ }
+
+ return ret
+}
+
// AllKnownTypes returns the all known types.
func (s *Scheme) AllKnownTypes() map[schema.GroupVersionKind]reflect.Type {
return s.gvkToType