diff --git a/config/crds/core_v1alpha1_podgroup.yaml b/config/crds/core_v1alpha1_podgroup.yaml index bbc85fb074..f64093a739 100644 --- a/config/crds/core_v1alpha1_podgroup.yaml +++ b/config/crds/core_v1alpha1_podgroup.yaml @@ -23,5 +23,17 @@ spec: format: int32 type: integer type: object + status: + properties: + succeeded: + format: int32 + type: integer + failed: + format: int32 + type: integer + running: + format: int32 + type: integer + type: object type: object version: v1alpha1 diff --git a/config/crds/extensions_v1alpha1_job.yaml b/config/crds/extensions_v1alpha1_job.yaml index 1b59f5cf0a..920e0ba794 100644 --- a/config/crds/extensions_v1alpha1_job.yaml +++ b/config/crds/extensions_v1alpha1_job.yaml @@ -39,7 +39,7 @@ spec: type: object status: properties: - Succeeded: + succeeded: format: int32 type: integer failed: @@ -56,4 +56,4 @@ spec: type: integer type: object type: object - version: v1alpha1 \ No newline at end of file + version: v1alpha1 diff --git a/pkg/apis/core/v1alpha1/podgroup.go b/pkg/apis/core/v1alpha1/types.go similarity index 74% rename from pkg/apis/core/v1alpha1/podgroup.go rename to pkg/apis/core/v1alpha1/types.go index c7c0b83c9a..1a1af8cd3c 100644 --- a/pkg/apis/core/v1alpha1/podgroup.go +++ b/pkg/apis/core/v1alpha1/types.go @@ -35,6 +35,11 @@ type PodGroup struct { // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status // +optional Spec PodGroupSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // Status represents the current information about a pod group. + // This data may not be up to date. + // +optional + Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // PodGroupSpec represents the template of a pod group. @@ -45,6 +50,19 @@ type PodGroupSpec struct { NumMember int32 `json:"numMember,omitempty" protobuf:"bytes,1,opt,name=numMember"` } +// PodGroupStatus represents the current state of a pod group. +type PodGroupStatus struct { + // The number of actively running pods. + // +optional + Running int32 `json:"running,omitempty" protobuf:"bytes,3,opt,name=running"` + // The number of pods which reached phase Succeeded. + // +optional + Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,3,opt,name=succeeded"` + // The number of pods which reached phase Failed. + // +optional + Failed int32 `json:"failed,omitempty" protobuf:"bytes,3,opt,name=failed"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // PodGroupList is a collection of pod groups. diff --git a/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go index 936b918d4a..81ac15a5a8 100644 --- a/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/core/v1alpha1/zz_generated.deepcopy.go @@ -30,6 +30,7 @@ func (in *PodGroup) DeepCopyInto(out *PodGroup) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) out.Spec = in.Spec + out.Status = in.Status return } @@ -99,3 +100,19 @@ func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. +func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { + if in == nil { + return nil + } + out := new(PodGroupStatus) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/extensions/v1alpha1/job.go b/pkg/apis/extensions/v1alpha1/job.go index b91ec3ad07..6914186ade 100644 --- a/pkg/apis/extensions/v1alpha1/job.go +++ b/pkg/apis/extensions/v1alpha1/job.go @@ -81,7 +81,7 @@ type JobStatus struct { // The number of pods which reached phase Succeeded. // +optional - Succeeded int32 `json:"Succeeded,omitempty" protobuf:"bytes,3,opt,name=succeeded"` + Succeeded int32 `json:"succeeded,omitempty" protobuf:"bytes,3,opt,name=succeeded"` // The number of pods which reached phase Failed. // +optional