You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hs.message = "Waiting for roll out to finish: More replicas need to be updated"
86
+
return hs
87
+
end
88
+
-- Since the scale down delay can be very high, BlueGreen does not wait for all the old replicas to scale
89
+
-- down before marking itself healthy. As a result, only evaluate this condition if the strategy is canary.
90
+
if obj.spec.strategy.canary ~= nil and replicasStatus > updatedReplicas then
91
+
hs.status = "Progressing"
92
+
hs.message = "Waiting for roll out to finish: old replicas are pending termination"
93
+
return hs
94
+
end
95
+
if availableReplicas < updatedReplicas then
96
+
hs.status = "Progressing"
97
+
hs.message = "Waiting for roll out to finish: updated replicas are still becoming available"
98
+
return hs
99
+
end
100
+
return nil
101
+
end
102
+
103
+
function getNumberValueOrDefault(field)
104
+
if field ~= nil then
105
+
return field
106
+
end
107
+
return 0
108
+
end
109
+
110
+
function checkPaused(obj)
111
+
hs = {}
112
+
local paused = false
113
+
if obj.status.verifyingPreview ~= nil then
114
+
paused = obj.status.verifyingPreview
115
+
elseif obj.spec.paused ~= nil then
116
+
paused = obj.spec.paused
117
+
end
118
+
119
+
if paused then
120
+
hs.status = "Suspended"
121
+
hs.message = "Rollout is paused"
122
+
return hs
123
+
end
124
+
return nil
125
+
end
126
+
127
+
hs = {}
128
+
if obj.status ~= nil then
129
+
if obj.status.conditions ~= nil then
130
+
for _, condition in ipairs(obj.status.conditions) do
131
+
if condition.type == "InvalidSpec" then
132
+
hs.status = "Degraded"
133
+
hs.message = condition.message
134
+
return hs
135
+
end
136
+
if condition.type == "Progressing" and condition.reason == "RolloutAborted" then
137
+
hs.status = "Degraded"
138
+
hs.message = condition.message
139
+
return hs
140
+
end
141
+
if condition.type == "Progressing" and condition.reason == "ProgressDeadlineExceeded" then
142
+
hs.status = "Degraded"
143
+
hs.message = condition.message
144
+
return hs
145
+
end
146
+
end
147
+
end
148
+
if obj.status.currentPodHash ~= nil then
149
+
if obj.spec.strategy.blueGreen ~= nil then
150
+
isPaused = checkPaused(obj)
151
+
if isPaused ~= nil then
152
+
return isPaused
153
+
end
154
+
replicasHS = checkReplicasStatus(obj)
155
+
if replicasHS ~= nil then
156
+
return replicasHS
157
+
end
158
+
if obj.status.blueGreen ~= nil and obj.status.blueGreen.activeSelector ~= nil and obj.status.blueGreen.activeSelector == obj.status.currentPodHash then
159
+
hs.status = "Healthy"
160
+
hs.message = "The active Service is serving traffic to the current pod spec"
161
+
return hs
162
+
end
163
+
hs.status = "Progressing"
164
+
hs.message = "The current pod spec is not receiving traffic from the active service"
165
+
return hs
166
+
end
167
+
if obj.spec.strategy.recreate ~= nil then
168
+
isPaused = checkPaused(obj)
169
+
if isPaused ~= nil then
170
+
return isPaused
171
+
end
172
+
replicasHS = checkReplicasStatus(obj)
173
+
if replicasHS ~= nil then
174
+
return replicasHS
175
+
end
176
+
if obj.status.recreate ~= nil and obj.status.recreate.currentRS ~= nil and obj.status.recreate.currentRS == obj.status.currentPodHash then
0 commit comments