Skip to content

Commit

Permalink
[AKS][aks-preview] az aks nodepool upgrade: Add new parameter `--ak…
Browse files Browse the repository at this point in the history
…s-custom-headers` (Azure#3658)

* Add `--aks-custom-headers` for `az aks nodepool upgrade`

* add test for nodepool upgrade

* add live_only decorator for nodepool upgrade test

* fix test

* remove misleading comment for live_only

* add generate recording file
  • Loading branch information
mainred authored Jul 22, 2021
1 parent f65cade commit 3065663
Show file tree
Hide file tree
Showing 7 changed files with 3,378 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/aks-preview/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============

0.5.24
+++++
* * Add "--aks-custom-headers" for "az aks nodepool upgrade"

0.5.23
+++++
* Fix issue that `maintenanceconfiguration add` subcommand cannot work
Expand Down
3 changes: 3 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,9 @@
- name: --max-surge
type: string
short-summary: Extra nodes used to speed upgrade. When specified, it represents the number or percent used, eg. 5 or 33%
- name: --aks-custom-headers
type: string
short-summary: Send custom headers. When specified, format should be Key1=Value1,Key2=Value2
"""

helps['aks nodepool update'] = """
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def load_arguments(self, _):

with self.argument_context('aks nodepool upgrade') as c:
c.argument('max_surge', type=str, validator=validate_max_surge)
c.argument('aks_custom_headers')

with self.argument_context('aks nodepool update') as c:
c.argument('enable_cluster_autoscaler', options_list=["--enable-cluster-autoscaler", "-e"], action='store_true')
Expand Down
7 changes: 5 additions & 2 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3308,7 +3308,8 @@ def aks_agentpool_upgrade(cmd, # pylint: disable=unused-argument
kubernetes_version='',
no_wait=False,
node_image_only=False,
max_surge=None):
max_surge=None,
aks_custom_headers=None):
if kubernetes_version != '' and node_image_only:
raise CLIError('Conflicting flags. Upgrading the Kubernetes version will also upgrade node image version.'
'If you only want to upgrade the node version please use the "--node-image-only" option only.')
Expand All @@ -3329,7 +3330,9 @@ def aks_agentpool_upgrade(cmd, # pylint: disable=unused-argument
if max_surge:
instance.upgrade_settings.max_surge = max_surge

return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, cluster_name, nodepool_name, instance)
headers = get_aks_custom_headers(aks_custom_headers)

return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name, cluster_name, nodepool_name, instance, headers=headers)


def aks_agentpool_get_upgrade_profile(cmd, # pylint: disable=unused-argument
Expand Down
Loading

0 comments on commit 3065663

Please sign in to comment.