Skip to content

Commit

Permalink
[AKS]customizing node resource group (#636)
Browse files Browse the repository at this point in the history
* customizing node resource group

* make 2.0 and 3.0 python work

* add index
  • Loading branch information
zqingqing1 authored and tjprescott committed Apr 25, 2019
1 parent 409ee53 commit ceffc76
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Release History
===============
0.3.2
+++++
* Add support of customizing node resource group

0.3.1
+++++
* Add support of pod security policy.
Expand Down
7 changes: 6 additions & 1 deletion src/aks-preview/azext_aks_preview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ def load_command_table(self, args):
return self.command_table

def load_arguments(self, command):
super(ContainerServiceCommandsLoader, self).load_arguments(command)
from sys import version_info
if version_info[0] < 3:
super(ContainerServiceCommandsLoader, self).load_arguments(command)
else:
super().load_arguments(command)

from ._params import load_arguments
load_arguments(self, command)

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 @@ -151,6 +151,9 @@
- name: --enable-pod-security-policy
type: bool
short-summary: (PREVIEW) Enable pod security policy.
- name: --node-resource-group
type: string
short-summary: The node resource group is the resource group where all customer's resources will be created in, such as virtual machines.
examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
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 @@ -70,6 +70,7 @@ def load_arguments(self, _):
c.argument('enable_vmss', action='store_true')
c.argument('node_zones', zones_type, options_list='--node-zones', help='(PREVIEW) Space-separated list of availability zones where agent nodes will be placed.')
c.argument('enable_pod_security_policy', action='store_true')
c.argument('node_resource_group')

with self.argument_context('aks update') as c:
c.argument('enable_cluster_autoscaler', options_list=["--enable-cluster-autoscaler", "-e"], action='store_true')
Expand Down
4 changes: 4 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
node_zones=None,
generate_ssh_keys=False, # pylint: disable=unused-argument
enable_pod_security_policy=False,
node_resource_group=None,
no_wait=False):
if not no_ssh_key:
try:
Expand Down Expand Up @@ -515,6 +516,9 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint:
aad_profile=aad_profile,
enable_pod_security_policy=bool(enable_pod_security_policy))

if node_resource_group:
mc.node_resource_group = node_resource_group

# Due to SPN replication latency, we do a few retries here
max_retry = 30
retry_exception = Exception(None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class ManagedCluster(Resource):
'provisioning_state': {'readonly': True},
'max_agent_pools': {'readonly': True},
'fqdn': {'readonly': True},
'node_resource_group': {'readonly': True},
}

_attribute_map = {
Expand Down Expand Up @@ -128,7 +127,7 @@ def __init__(self, **kwargs):
self.windows_profile = kwargs.get('windows_profile', None)
self.service_principal_profile = kwargs.get('service_principal_profile', None)
self.addon_profiles = kwargs.get('addon_profiles', None)
self.node_resource_group = None
self.node_resource_group = kwargs.get('node_resource_group', None)
self.enable_rbac = kwargs.get('enable_rbac', None)
self.enable_pod_security_policy = kwargs.get('enable_pod_security_policy', None)
self.network_profile = kwargs.get('network_profile', None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class ManagedCluster(Resource):
'provisioning_state': {'readonly': True},
'max_agent_pools': {'readonly': True},
'fqdn': {'readonly': True},
'node_resource_group': {'readonly': True},
}

_attribute_map = {
Expand All @@ -116,7 +115,7 @@ class ManagedCluster(Resource):
'api_server_authorized_ip_ranges': {'key': 'properties.apiServerAuthorizedIPRanges', 'type': '[str]'},
}

def __init__(self, *, location: str, tags=None, kubernetes_version: str=None, dns_prefix: str=None, agent_pool_profiles=None, linux_profile=None, windows_profile=None, service_principal_profile=None, addon_profiles=None, enable_rbac: bool=None, enable_pod_security_policy: bool=None, network_profile=None, aad_profile=None, api_server_authorized_ip_ranges=None, **kwargs) -> None:
def __init__(self, *, location: str, tags=None, kubernetes_version: str=None, dns_prefix: str=None, node_resource_group: str=None, agent_pool_profiles=None, linux_profile=None, windows_profile=None, service_principal_profile=None, addon_profiles=None, enable_rbac: bool=None, enable_pod_security_policy: bool=None, network_profile=None, aad_profile=None, api_server_authorized_ip_ranges=None, **kwargs) -> None:
super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs)
self.provisioning_state = None
self.max_agent_pools = None
Expand All @@ -128,7 +127,7 @@ def __init__(self, *, location: str, tags=None, kubernetes_version: str=None, dn
self.windows_profile = windows_profile
self.service_principal_profile = service_principal_profile
self.addon_profiles = addon_profiles
self.node_resource_group = None
self.node_resource_group = node_resource_group
self.enable_rbac = enable_rbac
self.enable_pod_security_policy = enable_pod_security_policy
self.network_profile = network_profile
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open as open1
from setuptools import setup, find_packages

VERSION = "0.3.1"
VERSION = "0.3.2"
CLASSIFIERS = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
Expand Down
8 changes: 4 additions & 4 deletions src/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
],
"aks-preview": [
{
"downloadUrl": "https://azurecliaks.blob.core.windows.net/azure-cli-extension/aks_preview-0.2.3-py2.py3-none-any.whl",
"filename": "aks_preview-0.2.3-py2.py3-none-any.whl",
"downloadUrl": "https://azurecliaks.blob.core.windows.net/azure-cli-extension/aks_preview-0.3.2-py2.py3-none-any.whl",
"filename": "aks_preview-0.3.2-py2.py3-none-any.whl",
"metadata": {
"azext.isPreview": true,
"azext.minCliCoreVersion": "2.0.49",
Expand Down Expand Up @@ -88,9 +88,9 @@
"metadata_version": "2.0",
"name": "aks-preview",
"summary": "Provides a preview for upcoming AKS features",
"version": "0.2.3"
"version": "0.3.2"
},
"sha256Digest": "455d3c5a99627ae8b5870897852c09b41056d42d4a46719134cb4852754fc9d2"
"sha256Digest": "5839622f96bd4e42c4542eefb55a22c589f0d858924be790e1d5818e95912881"
},
{
"downloadUrl": "https://azurecliaks.blob.core.windows.net/azure-cli-extension/aks_preview-0.3.0-py2.py3-none-any.whl",
Expand Down

0 comments on commit ceffc76

Please sign in to comment.