File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,33 @@ def ready(self):
169
169
self .obj ["status" ]["updatedReplicas" ] == self .replicas
170
170
)
171
171
172
+ def rollout_undo (self , target_revision = None ):
173
+ """Produces same action as kubectl rollout undo deployment command.
174
+ Input variable is revision to rollback to (in kubectl, --to-revision)
175
+ """
176
+ if target_revision is None :
177
+ revision = {}
178
+ else :
179
+ revision = {
180
+ "revision" : target_revision
181
+ }
182
+
183
+ params = {
184
+ "kind" : "DeploymentRollback" ,
185
+ "apiVersion" : self .version ,
186
+ "name" : self .name ,
187
+ "rollbackTo" : revision
188
+ }
189
+
190
+ kwargs = {
191
+ "version" : self .version ,
192
+ "namespace" : self .namespace ,
193
+ "operation" : "rollback" ,
194
+ }
195
+ r = self .api .post (** self .api_kwargs (data = json .dumps (params ), ** kwargs ))
196
+ r .raise_for_status ()
197
+ return r .text
198
+
172
199
173
200
class Endpoint (NamespacedAPIObject ):
174
201
You can’t perform that action at this time.
0 commit comments