mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
rebased and changed io helpers to use new API groups
This commit is contained in:
parent
7bc55b5aea
commit
bd4705c414
@ -38,7 +38,8 @@ func LoadPodFromFile(filePath string) (*api.Pod, error) {
|
||||
return nil, fmt.Errorf("file was empty: %s", filePath)
|
||||
}
|
||||
pod := &api.Pod{}
|
||||
if err := latest.Codec.DecodeInto(podDef, pod); err != nil {
|
||||
|
||||
if err := latest.GroupOrDie("").Codec.DecodeInto(podDef, pod); err != nil {
|
||||
return nil, fmt.Errorf("failed decoding file: %v", err)
|
||||
}
|
||||
return pod, nil
|
||||
@ -49,7 +50,7 @@ func SavePodToFile(pod *api.Pod, filePath string, perm os.FileMode) error {
|
||||
if filePath == "" {
|
||||
return fmt.Errorf("file path not specified")
|
||||
}
|
||||
data, err := latest.Codec.Encode(pod)
|
||||
data, err := latest.GroupOrDie("").Codec.Encode(pod)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed encoding pod: %v", err)
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ func TestSavePodToFile(t *testing.T) {
|
||||
pod := volume.NewPersistentVolumeRecyclerPodTemplate()
|
||||
|
||||
// sets all default values on a pod for equality comparison after decoding from file
|
||||
encoded, err := latest.Codec.Encode(pod)
|
||||
latest.Codec.DecodeInto(encoded, pod)
|
||||
encoded, err := latest.GroupOrDie("").Codec.Encode(pod)
|
||||
latest.GroupOrDie("").Codec.DecodeInto(encoded, pod)
|
||||
|
||||
path := fmt.Sprintf("/tmp/kube-io-test-%s", uuid.New())
|
||||
defer os.Remove(path)
|
||||
|
Loading…
Reference in New Issue
Block a user