Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/fleet/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@ Release History

1.0.3
++++++
* Added `az fleet reconcile` & `az fleet member reconcile` commands.
* Added `az fleet reconcile` & `az fleet member reconcile` commands.

1.0.4
++++++
* Added new --upgrade-type parameter "ControlPlaneOnly" for command `az fleet updaterun create --upgrade-type`.
4 changes: 2 additions & 2 deletions src/fleet/azext_fleet/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@
parameters:
- name: --upgrade-type
type: string
short-summary: Specify the upgrade type of members. Acceptable values are 'Full' and 'NodeImageOnly'.
short-summary: Specify the upgrade type of members. Acceptable values are 'Full', 'ControlPlaneOnly', and 'NodeImageOnly'.
- name: --kubernetes-version
type: string
short-summary: Specify the kubernetes version to upgrade member(s) to, when --upgrade-type is set to 'Full'. Acceptable format is x.x.x (eg. 1.2.3).
short-summary: Specify the kubernetes version to upgrade member(s) to, when --upgrade-type is set to 'Full' or 'ControlPlaneOnly'. Acceptable format is x.x.x (eg. 1.2.3).
- name: --stages
type: string
short-summary: Path to a JSON file that defines stages to upgrade a fleet. See examples for reference.
Expand Down
2 changes: 1 addition & 1 deletion src/fleet/azext_fleet/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def load_arguments(self, _):
c.argument('fleet_name', options_list=['--fleet-name', '-f'], help='Specify the fleet name.')

with self.argument_context('fleet updaterun create') as c:
c.argument('upgrade_type', arg_type=get_enum_type(['Full', 'NodeImageOnly']))
c.argument('upgrade_type', arg_type=get_enum_type(['Full', 'NodeImageOnly', 'ControlPlaneOnly']))
c.argument('kubernetes_version', validator=validate_kubernetes_version)
c.argument('node_image_selection', arg_type=get_enum_type(['Latest', 'Consistent']), help='Node Image Selection is an option that lets you choose how your clusters\' nodes are upgraded')
c.argument('stages', type=file_type, completer=FilesCompleter(), help='Path to a json file that defines stages to upgrade a fleet. See examples for further reference.')
Expand Down
14 changes: 14 additions & 0 deletions src/fleet/azext_fleet/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

UPGRADE_TYPE_CONTROLPLANEONLY = "ControlPlaneOnly"
UPGRADE_TYPE_FULL = "Full"
UPGRADE_TYPE_NODEIMAGEONLY = "NodeImageOnly"

UPGRADE_TYPE_ERROR_MESSAGES = {
UPGRADE_TYPE_CONTROLPLANEONLY: f"Please set kubernetes version when upgrade type is '{UPGRADE_TYPE_CONTROLPLANEONLY}'.", # pylint: disable=line-too-long
UPGRADE_TYPE_FULL: f"Please set kubernetes version when upgrade type is '{UPGRADE_TYPE_FULL}'.",
UPGRADE_TYPE_NODEIMAGEONLY: f"Cannot set kubernetes version when upgrade type is '{UPGRADE_TYPE_NODEIMAGEONLY}'."
}
19 changes: 15 additions & 4 deletions src/fleet/azext_fleet/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

from azext_fleet._client_factory import CUSTOM_MGMT_FLEET
from azext_fleet._helpers import print_or_merge_credentials
from azext_fleet.constants import UPGRADE_TYPE_CONTROLPLANEONLY
from azext_fleet.constants import UPGRADE_TYPE_FULL
from azext_fleet.constants import UPGRADE_TYPE_NODEIMAGEONLY
from azext_fleet.constants import UPGRADE_TYPE_ERROR_MESSAGES


# pylint: disable=too-many-locals
Expand Down Expand Up @@ -316,10 +320,17 @@ def create_update_run(cmd,
stages=None,
update_strategy_name=None,
no_wait=False):
if upgrade_type == "Full" and kubernetes_version is None:
raise CLIError("Please set kubernetes version when upgrade type is 'Full'.")
if upgrade_type == "NodeImageOnly" and kubernetes_version is not None:
raise CLIError("Cannot set kubernetes version when upgrade type is 'NodeImageOnly'.")

if upgrade_type in UPGRADE_TYPE_ERROR_MESSAGES:
if (
((upgrade_type in (UPGRADE_TYPE_FULL, UPGRADE_TYPE_CONTROLPLANEONLY)) and kubernetes_version is None) or # pylint: disable=line-too-long
(upgrade_type == UPGRADE_TYPE_NODEIMAGEONLY and kubernetes_version is not None)
):
raise CLIError(UPGRADE_TYPE_ERROR_MESSAGES[upgrade_type])
else:
raise CLIError((f"The upgrade type parameter '{upgrade_type}' is not valid."
f"Valid options are: '{UPGRADE_TYPE_FULL}', '{UPGRADE_TYPE_CONTROLPLANEONLY}', or '{UPGRADE_TYPE_NODEIMAGEONLY}'")) # pylint: disable=line-too-long

if stages is not None and update_strategy_name is not None:
raise CLIError("Cannot set stages when update strategy name is set.")

Expand Down
2 changes: 1 addition & 1 deletion src/fleet/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '1.0.3'
VERSION = '1.0.4'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down