api: add terminatingReplicas field to ReplicaSet and Deployment statuses

- update internal ReplicaSet and Deployment type documentation to match with
  versioned API
- made Replicaset and Deployment type documentation more consistent
This commit is contained in:
Filip Křepinský 2024-11-04 19:13:51 +01:00
parent 067012f584
commit f7c46df665
7 changed files with 129 additions and 55 deletions

View File

@ -507,19 +507,19 @@ type DeploymentStatus struct {
// +optional
ObservedGeneration int64
// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
// Total number of non-terminating pods targeted by this deployment (their labels match the selector).
// +optional
Replicas int32
// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
// Total number of non-terminating pods targeted by this deployment that have the desired template spec.
// +optional
UpdatedReplicas int32
// Total number of ready pods targeted by this deployment.
// Total number of non-terminating pods targeted by this Deployment with a Ready Condition.
// +optional
ReadyReplicas int32
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32
@ -529,6 +529,13 @@ type DeploymentStatus struct {
// +optional
UnavailableReplicas int32
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32
// Represents the latest available observations of a deployment's current state.
Conditions []DeploymentCondition
@ -865,22 +872,30 @@ type ReplicaSetSpec struct {
// ReplicaSetStatus represents the current status of a ReplicaSet.
type ReplicaSetStatus struct {
// Replicas is the number of actual replicas.
// Replicas is the most recently observed number of non-terminating pods.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Replicas int32
// The number of pods that have labels matching the labels of the pod template of the replicaset.
// The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.
// +optional
FullyLabeledReplicas int32
// The number of ready replicas for this replica set.
// The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.
// +optional
ReadyReplicas int32
// The number of available replicas (ready for at least minReadySeconds) for this replica set.
// The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.
// +optional
AvailableReplicas int32
// ObservedGeneration is the most recent generation observed by the controller.
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32
// ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
// +optional
ObservedGeneration int64

View File

@ -159,6 +159,12 @@ const (
// Enable usage of Provision of PVCs from snapshots in other namespaces
CrossNamespaceVolumeDataSource featuregate.Feature = "CrossNamespaceVolumeDataSource"
// owner: @atiratree
// kep: http://kep.k8s.io/3973
//
// Deployments and replica sets can now also track terminating pods via .status.terminatingReplicas.
DeploymentPodReplacementPolicy featuregate.Feature = "DeploymentPodReplacementPolicy"
// owner: @elezar
// kep: http://kep.k8s.io/4009
//

View File

@ -152,6 +152,10 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
{Version: version.MustParse("1.32"), Default: true, LockToDefault: true, PreRelease: featuregate.GA},
},
DeploymentPodReplacementPolicy: {
{Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha},
},
DevicePluginCDIDevices: {
{Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha},
{Version: version.MustParse("1.29"), Default: true, PreRelease: featuregate.Beta},

View File

@ -486,19 +486,19 @@ type DeploymentStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
// Total number of non-terminating pods targeted by this deployment (their labels match the selector).
// +optional
Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
// Total number of non-terminating pods targeted by this deployment that have the desired template spec.
// +optional
UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
// readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.
// Total number of non-terminating pods targeted by this Deployment with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
@ -508,6 +508,13 @@ type DeploymentStatus struct {
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
// Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
@ -839,16 +846,16 @@ type ReplicaSetList struct {
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of ReplicaSets.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// ReplicaSetSpec is the specification of a ReplicaSet.
type ReplicaSetSpec struct {
// Replicas is the number of desired replicas.
// Replicas is the number of desired pods.
// This is a pointer to distinguish between explicit zero and unspecified.
// Defaults to 1.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
// +optional
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
@ -866,29 +873,36 @@ type ReplicaSetSpec struct {
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#pod-template
// +optional
Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
}
// ReplicaSetStatus represents the current status of a ReplicaSet.
type ReplicaSetStatus struct {
// Replicas is the most recently observed number of replicas.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
// Replicas is the most recently observed number of non-terminating pods.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
// The number of pods that have labels matching the labels of the pod template of the replicaset.
// The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.
// +optional
FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
// readyReplicas is the number of pods targeted by this ReplicaSet with a Ready Condition.
// The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
// The number of available replicas (ready for at least minReadySeconds) for this replica set.
// The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
// ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`

View File

@ -548,33 +548,40 @@ type RollingUpdateDeployment struct {
// DeploymentStatus is the most recently observed status of the Deployment.
type DeploymentStatus struct {
// observedGeneration is the generation observed by the deployment controller.
// The generation observed by the deployment controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
// replicas is the total number of non-terminated pods targeted by this deployment (their labels match the selector).
// Total number of non-terminating pods targeted by this deployment (their labels match the selector).
// +optional
Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
// updatedReplicas is the total number of non-terminated pods targeted by this deployment that have the desired template spec.
// Total number of non-terminating pods targeted by this deployment that have the desired template spec.
// +optional
UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
// readyReplicas is the number of pods targeted by this Deployment controller with a Ready Condition.
// Total number of non-terminating pods targeted by this Deployment with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
// unavailableReplicas is the total number of unavailable pods targeted by this deployment. This is the total number of
// Total number of unavailable pods targeted by this deployment. This is the total number of
// pods that are still required for the deployment to have 100% available capacity. They may
// either be pods that are running but not yet available or pods that still have not been created.
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Conditions represent the latest available observations of a deployment's current state.
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
// Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map

View File

@ -530,19 +530,19 @@ type DeploymentStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
// Total number of non-terminating pods targeted by this deployment (their labels match the selector).
// +optional
Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
// Total number of non-terminating pods targeted by this deployment that have the desired template spec.
// +optional
UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
// readyReplicas is the number of pods targeted by this Deployment controller with a Ready Condition.
// Total number of non-terminating pods targeted by this Deployment with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
@ -552,6 +552,13 @@ type DeploymentStatus struct {
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
// Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
@ -897,16 +904,16 @@ type ReplicaSetList struct {
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of ReplicaSets.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// ReplicaSetSpec is the specification of a ReplicaSet.
type ReplicaSetSpec struct {
// Replicas is the number of desired replicas.
// Replicas is the number of desired pods.
// This is a pointer to distinguish between explicit zero and unspecified.
// Defaults to 1.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
// +optional
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
@ -924,29 +931,36 @@ type ReplicaSetSpec struct {
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#pod-template
// +optional
Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
}
// ReplicaSetStatus represents the current status of a ReplicaSet.
type ReplicaSetStatus struct {
// Replicas is the most recently observed number of replicas.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
// Replicas is the most recently observed number of non-terminating pods.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
// The number of pods that have labels matching the labels of the pod template of the replicaset.
// The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.
// +optional
FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
// readyReplicas is the number of pods targeted by this ReplicaSet controller with a Ready Condition.
// The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
// The number of available replicas (ready for at least minReadySeconds) for this replica set.
// The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
// ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`

View File

@ -245,19 +245,19 @@ type DeploymentStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
// Total number of non-terminating pods targeted by this deployment (their labels match the selector).
// +optional
Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
// Total number of non-terminating pods targeted by this deployment that have the desired template spec.
// +optional
UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
// Total number of ready pods targeted by this deployment.
// Total number of non-terminating pods targeted by this Deployment with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
// Total number of available non-terminating pods (ready for at least minReadySeconds) targeted by this deployment.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
@ -267,6 +267,13 @@ type DeploymentStatus struct {
// +optional
UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
// Total number of terminating pods targeted by this deployment. Terminating pods have a non-null
// .metadata.deletionTimestamp and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,9,opt,name=terminatingReplicas"`
// Represents the latest available observations of a deployment's current state.
// +patchMergeKey=type
// +patchStrategy=merge
@ -941,16 +948,16 @@ type ReplicaSetList struct {
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of ReplicaSets.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// ReplicaSetSpec is the specification of a ReplicaSet.
type ReplicaSetSpec struct {
// Replicas is the number of desired replicas.
// Replicas is the number of desired pods.
// This is a pointer to distinguish between explicit zero and unspecified.
// Defaults to 1.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
// +optional
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
@ -969,29 +976,36 @@ type ReplicaSetSpec struct {
// Template is the object that describes the pod that will be created if
// insufficient replicas are detected.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/#pod-template
// +optional
Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
}
// ReplicaSetStatus represents the current status of a ReplicaSet.
type ReplicaSetStatus struct {
// Replicas is the most recently observed number of replicas.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
// Replicas is the most recently observed number of non-terminating pods.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset
Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
// The number of pods that have labels matching the labels of the pod template of the replicaset.
// The number of non-terminating pods that have labels matching the labels of the pod template of the replicaset.
// +optional
FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
// The number of ready replicas for this replica set.
// The number of non-terminating pods targeted by this ReplicaSet with a Ready Condition.
// +optional
ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
// The number of available replicas (ready for at least minReadySeconds) for this replica set.
// The number of available non-terminating pods (ready for at least minReadySeconds) for this replica set.
// +optional
AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
// The number of terminating pods for this replica set. Terminating pods have a non-null .metadata.deletionTimestamp
// and have not yet reached the Failed or Succeeded .status.phase.
//
// This is an alpha field. Enable DeploymentPodReplacementPolicy to be able to use this field.
// +optional
TerminatingReplicas *int32 `json:"terminatingReplicas,omitempty" protobuf:"varint,7,opt,name=terminatingReplicas"`
// ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`