Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Provide detailed pod status when listing services #1380

Merged
merged 1 commit into from
Sep 26, 2018

Conversation

lelenanam
Copy link
Contributor

For deployments, daemonSet, statefulSet provide:

  • status of rollout
  • numbers of desired, updated, ready, available, outdated pods
  • slice of errors for controller

Fixes #1303

Copy link
Member

@squaremo squaremo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach of just looking at the conditions on the controller -- thank you for taking my comments on the prior PR into account.

Three requested changes:

  • please either explain, or revise, the code that compiles errors from the conditions (I've expended on this in the comments)
  • the errors, or their replacement, need to be represented in the API response
  • daemonsets etc., should get the same treatment as deployments.

api/v6/api.go Outdated
@@ -34,6 +35,7 @@ type ControllerStatus struct {
Containers []Container
ReadOnly ReadOnlyReason
Status string
Pods cluster.Pods

This comment was marked as abuse.

@@ -120,27 +122,50 @@ func (dk *deploymentKind) getPodControllers(c *Cluster, namespace string) ([]pod
return podControllers, nil
}

func deploymentErrors(d *apiapps.Deployment) []string {
var errs []string
for _, cond := range d.Status.Conditions {

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

}

return podController{
apiVersion: "apps/v1",
kind: "DaemonSet",
name: daemonSet.ObjectMeta.Name,
status: status,
pods: pods,

This comment was marked as abuse.

@lelenanam
Copy link
Contributor Author

StatefulSet Status is missing UpdatedReplicas field: kubernetes/kubernetes#52653

@lelenanam lelenanam force-pushed the 1303-listservices-controller-status branch from 5eb5a34 to c375d49 Compare September 24, 2018 19:02
@lelenanam
Copy link
Contributor Author

lelenanam commented Sep 24, 2018

  • please either explain, or revise, the code that compiles errors from the conditions (I've expended on this in the comments)

added comment

  • the errors, or their replacement, need to be represented in the API response

moved Errors to RolloutStatus struct

  • daemonsets etc., should get the same treatment as deployments.

I wasn't able to find a way to get errors from deamonSet and statefulSet conditions.
I can include alldeamonSet and statefulSet conditions to errors list but not all of them might be about errors.

@lelenanam lelenanam force-pushed the 1303-listservices-controller-status branch 2 times, most recently from 558a66a to 858efbb Compare September 24, 2018 20:36
@rade rade requested a review from squaremo September 25, 2018 08:28
Copy link
Member

@squaremo squaremo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional code looks good to me ✔️ Thanks Elena 🔆

Before you merge it, I would appreciate an explanation (as comments in the code) of why the interpretation for Deployments is correct, and why conditions aren't used elsewhere; and, documentation on how to use the RolloutStatus value in the API (including what to do if it's empty).

Available int32
// Outdated number of pods that are on a different pod spec.
Outdated int32
// Messages about unexpected rollout progress

This comment was marked as abuse.

@@ -21,6 +21,23 @@ type Cluster interface {
PublicSSHKey(regenerate bool) (ssh.PublicKey, error)
}

// RolloutStatus describes numbers of pods in a different states and

This comment was marked as abuse.

updated, wanted := daemonSetStatus.UpdatedNumberScheduled, daemonSetStatus.DesiredNumberScheduled
if updated == wanted {
status = StatusUpdating
if rollout.Ready == rollout.Desired && rollout.Available == rollout.Desired && rollout.Outdated == 0 {

This comment was marked as abuse.

@lelenanam lelenanam force-pushed the 1303-listservices-controller-status branch 2 times, most recently from 14440db to c40b751 Compare September 26, 2018 21:15
// - in progress: Updated, Ready or Available numbers are not equal to Desired, or Outdated not equal to 0
// - stuck: Messages contains info if deploynemt unavailable or exceeded its progress deadline
// - complete: Updated, Ready and Available numbers are equal to Desired and Outdateds equal to 0
// See https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#deployment-status

This comment was marked as abuse.

// Deployment may get stuck trying to deploy its newest ReplicaSet without ever completing.
// One way to detect this condition is to specify a deadline parameter in Deployment spec:
// .spec.progressDeadlineSeconds
// See https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#failed-deployment

This comment was marked as abuse.

For deployments, daemonSet, statefulSet provide:
 - status of rollout
 - numbers of desired, updated, ready, available, outdated pods
 - slice of errors for controller (for now only for deployment)

Fixes #1303
@lelenanam lelenanam force-pushed the 1303-listservices-controller-status branch from c40b751 to df28361 Compare September 26, 2018 23:41
@lelenanam lelenanam merged commit 38d1507 into master Sep 26, 2018
@lelenanam lelenanam deleted the 1303-listservices-controller-status branch September 26, 2018 23:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants