mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 12:41:58 +00:00
Shorten 'CodecForVersionOrDie' name, add 'ResourceVersioner' to testapi
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
)
|
||||
|
||||
// Version returns the API version to test against as set by the KUBE_API_VERSION env var.
|
||||
// Version returns the API version to test against, as set by the KUBE_API_VERSION env var.
|
||||
func Version() string {
|
||||
version := os.Getenv("KUBE_API_VERSION")
|
||||
if version == "" {
|
||||
@@ -33,10 +33,22 @@ func Version() string {
|
||||
return version
|
||||
}
|
||||
|
||||
func CodecForVersionOrDie() runtime.Codec {
|
||||
// Codec returns the codec for the API version to test against, as set by the
|
||||
// KUBE_API_VERSION env var.
|
||||
func Codec() runtime.Codec {
|
||||
interfaces, err := latest.InterfacesFor(Version())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return interfaces.Codec
|
||||
}
|
||||
|
||||
// ResourceVersioner returns the ResourceVersioner for the API version to test against,
|
||||
// as set by the KUBE_API_VERSION env var.
|
||||
func ResourceVersioner() runtime.ResourceVersioner {
|
||||
interfaces, err := latest.InterfacesFor(Version())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return interfaces.ResourceVersioner
|
||||
}
|
||||
|
Reference in New Issue
Block a user