Skip to content

Commit 7041077

Browse files
authored
Merge pull request #238 from hpe-container-platform-community/snowch/implement-cluster-upgrade-209
Example edit
2 parents 0809ff9 + 954e609 commit 7041077

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/hpe-container-platform-community/hpecp-python-library)
1111
[![Good first issues open](https://img.shields.io/github/issues/hpe-container-platform-community/hpecp-python-library/good%20first%20issue.svg?label=good%20first%20issue)](https://github.com/hpe-container-platform-community/hpecp-python-library/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
1212

13-
13+
1414
----
1515

1616
## Documentation

hpecp/cli/k8scluster.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,24 @@ def k8s_supported_versions(
290290
print(vers)
291291
else:
292292
print(" ".join(vers))
293+
294+
@base.intercept_exception
295+
def upgrade_cluster(
296+
self, id, k8s_upgrade_version, worker_upgrade_percent=20
297+
):
298+
"""Upgrade a cluster.
299+
300+
TODO
301+
302+
Returns
303+
-------
304+
TODO
305+
306+
Raises
307+
------
308+
APIException
309+
"""
310+
311+
base.get_client().k8s_cluster.upgrade_cluster(
312+
id, k8s_upgrade_version, worker_upgrade_percent
313+
)

hpecp/k8s_cluster.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,3 +514,37 @@ def add_addons(self, id, addons=[]):
514514
description="k8s_cluster/add_addons",
515515
data=data,
516516
)
517+
518+
def upgrade_cluster(
519+
self, id, k8s_upgrade_version, worker_upgrade_percent=20
520+
):
521+
"""Upgrade a cluster.
522+
523+
TODO
524+
525+
Returns
526+
-------
527+
TODO
528+
529+
Raises
530+
------
531+
APIException
532+
"""
533+
data = {
534+
"change_spec": {
535+
"k8s_upgrade": {
536+
"worker_upgrade_percent": worker_upgrade_percent,
537+
"k8s_upgrade_version": k8s_upgrade_version,
538+
}
539+
},
540+
"operation": "reconfigure",
541+
"reason": "Kubernetes upgrade",
542+
}
543+
544+
response = self.client._request(
545+
url="{}/change_task".format(id),
546+
http_method="post",
547+
description="K8sClusterController/upgrade_cluster",
548+
data=data,
549+
)
550+
return response.json()

0 commit comments

Comments
 (0)