Skip to content

Commit

Permalink
Merge pull request #55272 from janetkuo/ds-conditions
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 55331, 55272, 55228, 49763, 55242). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Add DaemonSet conditions

**What this PR does / why we need it**:

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
xref kubernetes/enhancements#353, #7856

**Special notes for your reviewer**:
A `conditions` field is added to DaemonSetStatus for consistency. No valid DaemonSet condition type is supported yet.
@kubernetes/sig-apps-api-reviews

**Release note**:

```release-note
DaemonSet status now has a new field named "conditions", making it consistent with other workloads controllers.
```

Kubernetes-commit: f644681a803c335ea18838441800a7b2fc791e6c
  • Loading branch information
k8s-publish-robot committed Dec 7, 2017
2 parents 43f9bc2 + f28f524 commit 730e5c0
Show file tree
Hide file tree
Showing 15 changed files with 2,098 additions and 830 deletions.
754 changes: 540 additions & 214 deletions apps/v1/generated.pb.go

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions apps/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions apps/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,33 @@ type DaemonSetStatus struct {
// create the name for the newest ControllerRevision.
// +optional
CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`

// Represents the latest available observations of a DaemonSet's current state.
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []DaemonSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
}

type DaemonSetConditionType string

// TODO: Add valid condition types of a DaemonSet.

// DaemonSetCondition describes the state of a DaemonSet at a certain point.
type DaemonSetCondition struct {
// Type of DaemonSet condition.
Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"`
// Status of the condition, one of True, False, Unknown.
Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
// Last time the condition transitioned from one status to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
// The reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// A human readable message indicating details about the transition.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}

// +genclient
Expand Down
14 changes: 14 additions & 0 deletions apps/v1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ func (DaemonSet) SwaggerDoc() map[string]string {
return map_DaemonSet
}

var map_DaemonSetCondition = map[string]string{
"": "DaemonSetCondition describes the state of a DaemonSet at a certain point.",
"type": "Type of DaemonSet condition.",
"status": "Status of the condition, one of True, False, Unknown.",
"lastTransitionTime": "Last time the condition transitioned from one status to another.",
"reason": "The reason for the condition's last transition.",
"message": "A human readable message indicating details about the transition.",
}

func (DaemonSetCondition) SwaggerDoc() map[string]string {
return map_DaemonSetCondition
}

var map_DaemonSetList = map[string]string{
"": "DaemonSetList is a collection of daemon sets.",
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
Expand Down Expand Up @@ -93,6 +106,7 @@ var map_DaemonSetStatus = map[string]string{
"numberAvailable": "The number of nodes that should be running the daemon pod and have one or more of the daemon pod running and available (ready for at least spec.minReadySeconds)",
"numberUnavailable": "The number of nodes that should be running the daemon pod and have none of the daemon pod running and available (ready for at least spec.minReadySeconds)",
"collisionCount": "Count of hash collisions for the DaemonSet. The DaemonSet controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest ControllerRevision.",
"conditions": "Represents the latest available observations of a DaemonSet's current state.",
}

func (DaemonSetStatus) SwaggerDoc() map[string]string {
Expand Down
28 changes: 28 additions & 0 deletions apps/v1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
in.(*DaemonSet).DeepCopyInto(out.(*DaemonSet))
return nil
}, InType: reflect.TypeOf(&DaemonSet{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*DaemonSetCondition).DeepCopyInto(out.(*DaemonSetCondition))
return nil
}, InType: reflect.TypeOf(&DaemonSetCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
in.(*DaemonSetList).DeepCopyInto(out.(*DaemonSetList))
return nil
Expand Down Expand Up @@ -237,6 +241,23 @@ func (in *DaemonSet) DeepCopyObject() runtime.Object {
}
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DaemonSetCondition) DeepCopyInto(out *DaemonSetCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DaemonSetCondition.
func (in *DaemonSetCondition) DeepCopy() *DaemonSetCondition {
if in == nil {
return nil
}
out := new(DaemonSetCondition)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DaemonSetList) DeepCopyInto(out *DaemonSetList) {
*out = *in
Expand Down Expand Up @@ -319,6 +340,13 @@ func (in *DaemonSetStatus) DeepCopyInto(out *DaemonSetStatus) {
**out = **in
}
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]DaemonSetCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}

Expand Down
Loading

0 comments on commit 730e5c0

Please sign in to comment.