|
4 | 4 | "context"
|
5 | 5 | "fmt"
|
6 | 6 |
|
| 7 | + "strings" |
| 8 | + |
7 | 9 | "k8s.io/klog"
|
8 | 10 |
|
9 | 11 | "github.com/openshift/cluster-version-operator/lib"
|
@@ -74,7 +76,28 @@ func waitForDeploymentCompletion(ctx context.Context, client appsclientv1.Deploy
|
74 | 76 | if d.Generation <= d.Status.ObservedGeneration && d.Status.UpdatedReplicas == d.Status.Replicas && d.Status.UnavailableReplicas == 0 {
|
75 | 77 | return true, nil
|
76 | 78 | }
|
77 |
| - klog.V(4).Infof("Deployment %s is not ready. status: (replicas: %d, updated: %d, ready: %d, unavailable: %d)", d.Name, d.Status.Replicas, d.Status.UpdatedReplicas, d.Status.ReadyReplicas, d.Status.UnavailableReplicas) |
| 79 | + |
| 80 | + deploymentConditions := make([]string, 0, len(d.Status.Conditions)) |
| 81 | + for _, dc := range d.Status.Conditions { |
| 82 | + switch dc.Type { |
| 83 | + case appsv1.DeploymentProgressing, appsv1.DeploymentAvailable: |
| 84 | + if dc.Status == "False" { |
| 85 | + deploymentConditions = append(deploymentConditions, fmt.Sprintf(", reason: %s, message: %s", dc.Reason, dc.Message)) |
| 86 | + } |
| 87 | + case appsv1.DeploymentReplicaFailure: |
| 88 | + if dc.Status == "True" { |
| 89 | + deploymentConditions = append(deploymentConditions, fmt.Sprintf(", reason: %s, message: %s", dc.Reason, dc.Message)) |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + klog.V(4).Infof("Deployment %s is not ready. status: (replicas: %d, updated: %d, ready: %d, unavailable: %d%s)", |
| 95 | + d.Name, |
| 96 | + d.Status.Replicas, |
| 97 | + d.Status.UpdatedReplicas, |
| 98 | + d.Status.ReadyReplicas, |
| 99 | + d.Status.UnavailableReplicas, |
| 100 | + strings.Join(deploymentConditions, "")) |
78 | 101 | return false, nil
|
79 | 102 | }, ctx.Done())
|
80 | 103 | }
|
|
0 commit comments