mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Merge pull request #3565 from dchen1107/podstatus
Introduce PodStatusResult, and deprecate PodContainerInfo.
This commit is contained in:
@@ -25,9 +25,9 @@ var Scheme = runtime.NewScheme()
|
||||
|
||||
func init() {
|
||||
Scheme.AddKnownTypes("",
|
||||
&PodContainerInfo{},
|
||||
&PodList{},
|
||||
&Pod{},
|
||||
&PodList{},
|
||||
&PodStatusResult{},
|
||||
&ReplicationControllerList{},
|
||||
&ReplicationController{},
|
||||
&ServiceList{},
|
||||
@@ -55,9 +55,9 @@ func init() {
|
||||
Scheme.AddKnownTypeWithName("", "ServerOpList", &OperationList{})
|
||||
}
|
||||
|
||||
func (*PodContainerInfo) IsAnAPIObject() {}
|
||||
func (*Pod) IsAnAPIObject() {}
|
||||
func (*PodList) IsAnAPIObject() {}
|
||||
func (*PodStatusResult) IsAnAPIObject() {}
|
||||
func (*ReplicationController) IsAnAPIObject() {}
|
||||
func (*ReplicationControllerList) IsAnAPIObject() {}
|
||||
func (*Service) IsAnAPIObject() {}
|
||||
|
||||
@@ -418,6 +418,7 @@ type ContainerStatus struct {
|
||||
type PodInfo map[string]ContainerStatus
|
||||
|
||||
// PodContainerInfo is a wrapper for PodInfo that can be encode/decoded
|
||||
// DEPRECATED: Replaced with PodStatusResult
|
||||
type PodContainerInfo struct {
|
||||
TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -503,6 +504,15 @@ type PodStatus struct {
|
||||
Info PodInfo `json:"info,omitempty"`
|
||||
}
|
||||
|
||||
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
|
||||
type PodStatusResult struct {
|
||||
TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
// Status represents the current information about a pod. This data may not be up
|
||||
// to date.
|
||||
Status PodStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
|
||||
type Pod struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
@@ -314,6 +314,30 @@ func init() {
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(in *newer.PodStatusResult, out *PodStatusResult, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.ObjectMeta, &out.TypeMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Status, &out.State, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(in *PodStatusResult, out *newer.PodStatusResult, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.TypeMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.State, &out.Status, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
func(in *newer.ReplicationController, out *ReplicationController, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
|
||||
|
||||
@@ -27,7 +27,7 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta1")
|
||||
func init() {
|
||||
api.Scheme.AddKnownTypes("v1beta1",
|
||||
&Pod{},
|
||||
&PodContainerInfo{},
|
||||
&PodStatusResult{},
|
||||
&PodList{},
|
||||
&ReplicationController{},
|
||||
&ReplicationControllerList{},
|
||||
@@ -57,7 +57,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (*Pod) IsAnAPIObject() {}
|
||||
func (*PodContainerInfo) IsAnAPIObject() {}
|
||||
func (*PodStatusResult) IsAnAPIObject() {}
|
||||
func (*PodList) IsAnAPIObject() {}
|
||||
func (*ReplicationController) IsAnAPIObject() {}
|
||||
func (*ReplicationControllerList) IsAnAPIObject() {}
|
||||
|
||||
@@ -412,6 +412,11 @@ type PodState struct {
|
||||
Info PodInfo `json:"info,omitempty" description:"map of container name to container status"`
|
||||
}
|
||||
|
||||
type PodStatusResult struct {
|
||||
TypeMeta `json:",inline"`
|
||||
State PodState `json:"state,omitempty" description:"current state of the pod"`
|
||||
}
|
||||
|
||||
// PodList is a list of Pods.
|
||||
type PodList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
@@ -345,6 +345,31 @@ func init() {
|
||||
return nil
|
||||
},
|
||||
|
||||
func(in *newer.PodStatusResult, out *PodStatusResult, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.ObjectMeta, &out.TypeMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Status, &out.State, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(in *PodStatusResult, out *newer.PodStatusResult, s conversion.Scope) error {
|
||||
if err := s.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.TypeMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.State, &out.Status, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
||||
func(in *newer.PodSpec, out *PodState, s conversion.Scope) error {
|
||||
if err := s.Convert(&in, &out.Manifest, 0); err != nil {
|
||||
return err
|
||||
|
||||
@@ -27,7 +27,7 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta2")
|
||||
func init() {
|
||||
api.Scheme.AddKnownTypes("v1beta2",
|
||||
&Pod{},
|
||||
&PodContainerInfo{},
|
||||
&PodStatusResult{},
|
||||
&PodList{},
|
||||
&ReplicationController{},
|
||||
&ReplicationControllerList{},
|
||||
@@ -57,7 +57,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (*Pod) IsAnAPIObject() {}
|
||||
func (*PodContainerInfo) IsAnAPIObject() {}
|
||||
func (*PodStatusResult) IsAnAPIObject() {}
|
||||
func (*PodList) IsAnAPIObject() {}
|
||||
func (*ReplicationController) IsAnAPIObject() {}
|
||||
func (*ReplicationControllerList) IsAnAPIObject() {}
|
||||
|
||||
@@ -375,6 +375,11 @@ type PodState struct {
|
||||
Info PodInfo `json:"info,omitempty" description:"map of container name to container status"`
|
||||
}
|
||||
|
||||
type PodStatusResult struct {
|
||||
TypeMeta `json:",inline"`
|
||||
State PodState `json:"state,omitempty" description:"current state of the pod"`
|
||||
}
|
||||
|
||||
// PodList is a list of Pods.
|
||||
type PodList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
@@ -26,9 +26,9 @@ var Codec = runtime.CodecFor(api.Scheme, "v1beta3")
|
||||
|
||||
func init() {
|
||||
api.Scheme.AddKnownTypes("v1beta3",
|
||||
&PodContainerInfo{},
|
||||
&Pod{},
|
||||
&PodList{},
|
||||
&PodStatusResult{},
|
||||
&PodTemplate{},
|
||||
&PodTemplateList{},
|
||||
&BoundPod{},
|
||||
@@ -56,9 +56,9 @@ func init() {
|
||||
api.Scheme.AddKnownTypeWithName("v1beta3", "ServerOpList", &OperationList{})
|
||||
}
|
||||
|
||||
func (*PodContainerInfo) IsAnAPIObject() {}
|
||||
func (*Pod) IsAnAPIObject() {}
|
||||
func (*PodList) IsAnAPIObject() {}
|
||||
func (*PodStatusResult) IsAnAPIObject() {}
|
||||
func (*PodTemplate) IsAnAPIObject() {}
|
||||
func (*PodTemplateList) IsAnAPIObject() {}
|
||||
func (*BoundPod) IsAnAPIObject() {}
|
||||
|
||||
@@ -435,13 +435,6 @@ type ContainerStatus struct {
|
||||
// PodInfo contains one entry for every container with available info.
|
||||
type PodInfo map[string]ContainerStatus
|
||||
|
||||
// PodContainerInfo is a wrapper for PodInfo that can be encode/decoded
|
||||
type PodContainerInfo struct {
|
||||
TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
ContainerInfo PodInfo `json:"containerInfo" description:"information about each container in this pod"`
|
||||
}
|
||||
|
||||
type RestartPolicyAlways struct{}
|
||||
|
||||
// TODO(dchen1107): Define what kinds of failures should restart.
|
||||
@@ -511,6 +504,15 @@ type PodStatus struct {
|
||||
Info PodInfo `json:"info,omitempty"`
|
||||
}
|
||||
|
||||
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
|
||||
type PodStatusResult struct {
|
||||
TypeMeta `json:",inline"`
|
||||
ObjectMeta `json:"metadata,omitempty"`
|
||||
// Status represents the current information about a pod. This data may not be up
|
||||
// to date.
|
||||
Status PodStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// Pod is a collection of containers that can run on a host. This resource is created
|
||||
// by clients and scheduled onto hosts. BoundPod represents the state of this resource
|
||||
// to hosts.
|
||||
|
||||
Reference in New Issue
Block a user