Skip to content

Commit 58b329f

Browse files
Merge pull request #789 from dmage/nodeca-progressing
Bug 2093440: Add progressing condition for node-ca daemon set
2 parents fbc291c + 674772a commit 58b329f

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pkg/operator/nodecadaemon.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,26 @@ func (c *NodeCADaemonController) sync() error {
100100
Status: operatorv1.ConditionUnknown,
101101
}
102102

103+
progressingCondition := operatorv1.OperatorCondition{
104+
Type: "NodeCADaemonProgressing",
105+
Status: operatorv1.ConditionUnknown,
106+
}
107+
103108
dsObj, err := gen.Get()
104109
if errors.IsNotFound(err) {
105110
availableCondition.Status = operatorv1.ConditionFalse
106111
availableCondition.Reason = "NotFound"
107112
availableCondition.Message = "The daemon set node-ca does not exist"
113+
114+
progressingCondition.Status = operatorv1.ConditionTrue
115+
progressingCondition.Reason = "NotFound"
116+
progressingCondition.Message = "The daemon set node-ca does not exist"
108117
} else if err != nil {
109118
availableCondition.Reason = "Unknown"
110119
availableCondition.Message = fmt.Sprintf("Unable to check daemon set availability: %s", err)
120+
121+
progressingCondition.Reason = "Unknown"
122+
progressingCondition.Message = fmt.Sprintf("Unable to check daemon set progress: %s", err)
111123
} else {
112124
ds := dsObj.(*appsv1.DaemonSet)
113125
if ds.Status.NumberAvailable > 0 {
@@ -119,6 +131,20 @@ func (c *NodeCADaemonController) sync() error {
119131
availableCondition.Reason = "NoAvailableReplicas"
120132
availableCondition.Message = "The daemon set node-ca does not have available replicas"
121133
}
134+
135+
if ds.Generation != ds.Status.ObservedGeneration {
136+
progressingCondition.Status = operatorv1.ConditionTrue
137+
progressingCondition.Reason = "Progressing"
138+
progressingCondition.Message = "The daemon set node-ca is updating node pods"
139+
} else if ds.Status.NumberUnavailable > 0 {
140+
progressingCondition.Status = operatorv1.ConditionTrue
141+
progressingCondition.Reason = "Unavailable"
142+
progressingCondition.Message = "The daemon set node-ca is deploying node pods"
143+
} else {
144+
progressingCondition.Status = operatorv1.ConditionFalse
145+
progressingCondition.Reason = "AsExpected"
146+
progressingCondition.Message = "The daemon set node-ca is deployed"
147+
}
122148
}
123149

124150
err = resource.ApplyMutator(gen)
@@ -127,6 +153,7 @@ func (c *NodeCADaemonController) sync() error {
127153
ctx,
128154
c.operatorClient,
129155
v1helpers.UpdateConditionFn(availableCondition),
156+
v1helpers.UpdateConditionFn(progressingCondition),
130157
v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{
131158
Type: "NodeCADaemonControllerDegraded",
132159
Status: operatorv1.ConditionTrue,
@@ -141,6 +168,7 @@ func (c *NodeCADaemonController) sync() error {
141168
ctx,
142169
c.operatorClient,
143170
v1helpers.UpdateConditionFn(availableCondition),
171+
v1helpers.UpdateConditionFn(progressingCondition),
144172
v1helpers.UpdateConditionFn(operatorv1.OperatorCondition{
145173
Type: "NodeCADaemonControllerDegraded",
146174
Status: operatorv1.ConditionFalse,

0 commit comments

Comments
 (0)