Skip to content

Commit

Permalink
Arc Platform GA changes (#3880)
Browse files Browse the repository at this point in the history
* replaced existing GA sdk with 2021-10-01 GA sdk

* removed aio, made changes for listclusteruser, moved proxy command to ga

* added track-2 sdk

* made changes to use v1.3.016682 of CSP and tested the changes on windows

* updated csp to 1.3.017131

* updated history.srt and setup.py

* lint fix

* changed csp storage endpoint to cdn

* updated HISTORY.srt

* updated setup.py

* disabled proxy command in fairfax and bumped version to 1.2.0

* added exception telemetry

* minor
  • Loading branch information
Atharva Mulmuley authored Oct 5, 2021
1 parent 995397c commit d867f98
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 146 deletions.
7 changes: 7 additions & 0 deletions src/connectedk8s/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Release History
===============
1.2.0
++++++

* Updated CSP version to 1.3.017131
* Updated GA SDK to 2021-10-01
* Updated CSP endpoint to CDN
* Disabled proxy command in fairfax

1.1.11
++++++
Expand Down
9 changes: 5 additions & 4 deletions src/connectedk8s/azext_connectedk8s/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,17 @@
Cannot_Create_ClusterRoleBindings_Fault_Type = 'Cannot create cluster role bindings on this Kubernets cluster'
CC_Provider_Namespace_Not_Registered_Fault_Type = "Connected Cluster Provider MS.K8 namespace not registered"
Default_Namespace_Does_Not_Exist_Fault_Type = "The default namespace defined in the kubeconfig doesn't exist on the kubernetes cluster."
CLIENT_PROXY_VERSION = '1.1.0'
ClusterConnect_Not_Present_Fault_Type = "cluster-connect-feature-unavailable"
CLIENT_PROXY_VERSION = '1.3.017131'
API_SERVER_PORT = 47011
CLIENT_PROXY_PORT = 47010
CLIENTPROXY_CLIENT_ID = '04b07795-8ddb-461a-bbee-02f9e1bf7b46'
API_CALL_RETRIES = 200
DEFAULT_REQUEST_TIMEOUT = 10 # seconds
RELEASE_DATE_WINDOWS = 'release12-03-21'
RELEASE_DATE_LINUX = 'release12-03-21'
RELEASE_DATE_WINDOWS = 'release13-09-21'
RELEASE_DATE_LINUX = 'release13-09-21'
CSP_REFRESH_TIME = 300
# URL constants
CSP_Storage_Url = "https://k8sconnectcsp.blob.core.windows.net"
CSP_Storage_Url = "https://k8sconnectcsp.azureedge.net"
HELM_STORAGE_URL = "https://k8connecthelm.azureedge.net"
HELM_VERSION = 'v3.6.3'
4 changes: 3 additions & 1 deletion src/connectedk8s/azext_connectedk8s/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def load_command_table(self, _):
g.custom_command('disable-features', 'disable_features', is_preview=True)
g.custom_command('list', 'list_connectedk8s', table_transformer=connectedk8s_list_table_format)
g.custom_show_command('show', 'get_connectedk8s', table_transformer=connectedk8s_show_table_format)
g.custom_command('proxy', 'client_side_proxy_wrapper')

with self.command_group('connectedk8s', connectedk8s_sdk_prev, client_factory=cf_connected_cluster_prev_2021_04_01) as g:
g.custom_command('proxy', 'client_side_proxy_wrapper', is_preview=True)
pass
# use this block for using preview sdk client for a command
15 changes: 10 additions & 5 deletions src/connectedk8s/azext_connectedk8s/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
import azext_connectedk8s._constants as consts
import azext_connectedk8s._utils as utils
from glob import glob
from .vendored_sdks.models import ConnectedCluster, ConnectedClusterIdentity
from .vendored_sdks.preview_2021_04_01.models import ListClusterUserCredentialsProperties
from .vendored_sdks.models import ConnectedCluster, ConnectedClusterIdentity, ListClusterUserCredentialProperties
from threading import Timer, Thread
import sys
import hashlib
Expand Down Expand Up @@ -1599,11 +1598,17 @@ def client_side_proxy_wrapper(cmd,
context_name=None,
api_server_port=consts.API_SERVER_PORT):

cloud = send_cloud_telemetry(cmd)
if cloud == consts.Azure_USGovCloudName:
telemetry.set_debug_info('User tried proxy command in fairfax')
telemetry.set_exception(exception='Proxy command is not present yet in fairfax cloud.', fault_type=consts.ClusterConnect_Not_Present_Fault_Type,
summary=f'User tried proxy command in fairfax.')
raise ClientRequestError(f'Cluster Connect feature is not yet available in {consts.Azure_USGovCloudName}')

client_proxy_port = consts.CLIENT_PROXY_PORT
if int(client_proxy_port) == int(api_server_port):
raise ClientRequestError('Proxy uses port 47010 internally.', recommendation='Please pass some other unused port through --port option.')

cloud = send_cloud_telemetry(cmd)
args = []
operating_system = platform.system()
proc_name = f'arcProxy{operating_system}'
Expand Down Expand Up @@ -1852,11 +1857,11 @@ def client_side_proxy(cmd,

# Fetching hybrid connection details from Userrp
try:
list_prop = ListClusterUserCredentialsProperties(
list_prop = ListClusterUserCredentialProperties(
authentication_method=auth_method,
client_proxy=True
)
response = client.list_cluster_user_credentials(resource_group_name, cluster_name, list_prop)
response = client.list_cluster_user_credential(resource_group_name, cluster_name, list_prop)
except Exception as e:
if flag == 1:
clientproxy_process.terminate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(

self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2021-03-01"
self.api_version = "2021-10-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-hybridkubernetes/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
104 changes: 0 additions & 104 deletions src/connectedk8s/azext_connectedk8s/vendored_sdks/_metadata.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
from ._models_py3 import ConnectedClusterIdentity
from ._models_py3 import ConnectedClusterList
from ._models_py3 import ConnectedClusterPatch
from ._models_py3 import CredentialResult
from ._models_py3 import CredentialResults
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import HybridConnectionConfig
from ._models_py3 import ListClusterUserCredentialProperties
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationList
Expand All @@ -25,9 +29,13 @@
from ._models import ConnectedClusterIdentity # type: ignore
from ._models import ConnectedClusterList # type: ignore
from ._models import ConnectedClusterPatch # type: ignore
from ._models import CredentialResult # type: ignore
from ._models import CredentialResults # type: ignore
from ._models import ErrorAdditionalInfo # type: ignore
from ._models import ErrorDetail # type: ignore
from ._models import ErrorResponse # type: ignore
from ._models import HybridConnectionConfig # type: ignore
from ._models import ListClusterUserCredentialProperties # type: ignore
from ._models import Operation # type: ignore
from ._models import OperationDisplay # type: ignore
from ._models import OperationList # type: ignore
Expand All @@ -36,6 +44,7 @@
from ._models import TrackedResource # type: ignore

from ._connected_kubernetes_client_enums import (
AuthenticationMethod,
ConnectivityStatus,
CreatedByType,
LastModifiedByType,
Expand All @@ -48,15 +57,20 @@
'ConnectedClusterIdentity',
'ConnectedClusterList',
'ConnectedClusterPatch',
'CredentialResult',
'CredentialResults',
'ErrorAdditionalInfo',
'ErrorDetail',
'ErrorResponse',
'HybridConnectionConfig',
'ListClusterUserCredentialProperties',
'Operation',
'OperationDisplay',
'OperationList',
'Resource',
'SystemData',
'TrackedResource',
'AuthenticationMethod',
'ConnectivityStatus',
'CreatedByType',
'LastModifiedByType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def __getattr__(cls, name):
raise AttributeError(name)


class AuthenticationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
"""The mode of client authentication.
"""

TOKEN = "Token"
AAD = "AAD"

class ConnectivityStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)):
"""Represents the connectivity status of the connected cluster.
"""
Expand Down
Loading

0 comments on commit d867f98

Please sign in to comment.