mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-16 14:45:28 +00:00
Refactor PodStatus to PodCondition in internal API for v1beta3
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
newer "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
@@ -89,7 +90,43 @@ func init() {
|
||||
return s.Convert(&in.Annotations, &out.Annotations, 0)
|
||||
},
|
||||
|
||||
// Convert all the standard objects
|
||||
// Convert all to the new PodCondition constants
|
||||
func(in *newer.PodCondition, out *PodStatus, s conversion.Scope) error {
|
||||
switch *in {
|
||||
case "":
|
||||
*out = ""
|
||||
case newer.PodPending:
|
||||
*out = PodWaiting
|
||||
case newer.PodRunning:
|
||||
*out = PodRunning
|
||||
case newer.PodSucceeded:
|
||||
*out = PodTerminated
|
||||
case newer.PodFailed:
|
||||
*out = PodTerminated
|
||||
default:
|
||||
return errors.New("The string provided is not a valid PodCondition constant value")
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
|
||||
func(in *PodStatus, out *newer.PodCondition, s conversion.Scope) error {
|
||||
switch *in {
|
||||
case "":
|
||||
*out = ""
|
||||
case PodWaiting:
|
||||
*out = newer.PodPending
|
||||
case PodRunning:
|
||||
*out = newer.PodRunning
|
||||
case PodTerminated:
|
||||
// Older API versions did not contain enough info to map to PodFailed
|
||||
*out = newer.PodFailed
|
||||
default:
|
||||
return errors.New("The string provided is not a valid PodCondition constant value")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
// Convert all the standard objects
|
||||
func(in *newer.Pod, out *Pod, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
|
||||
|
Reference in New Issue
Block a user