Skip to content

Commit

Permalink
Merge pull request #1 from julienstroheker/juliens/obo
Browse files Browse the repository at this point in the history
test and cleanup
  • Loading branch information
vineeth-thumma committed Nov 9, 2023
2 parents fa445b9 + 15700d6 commit ec012c1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/connectedk8s/azext_connectedk8s/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
Operate_RG_Cluster_Name_Conflict = 'The provided cluster name and rg correspond to different cluster being operated on'
Custom_Locations_Registration_Check_Fault_Type = "Error while checking resource provider registration of custom locations."
Custom_Locations_OID_Fetch_Fault_Type = "Error while fetching oid for custom locations."
Application_Details_Not_Provided_For_Azure_RBAC_Fault = 'Application ID or secret not provided for Azure RBAC'
Successfully_Enabled_Features = 'Successsfully enabled features: {} for the Connected Cluster {}'
Successfully_Disabled_Features = 'Successsfully disabled features: {} for the Connected Cluster {}'
Error_enabling_Features = 'Error while updating agents for enabling features. Please run \"kubectl get pods -n azure-arc\" to check the pods in case of timeout error. Error: {}'
Expand Down
2 changes: 1 addition & 1 deletion src/connectedk8s/azext_connectedk8s/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
- name: Enables the Cluster-Connect feature.
text: az connectedk8s enable-features -n clusterName -g resourceGroupName --features cluster-connect
- name: Enable Azure RBAC feature.
text: az connectedk8s enable-features -n clusterName -g resourceGroupName --features azure-rbac --app-id appID --app-secret="appSecret" --skip-azure-rbac-list "user1@domain.com,spn_oid"
text: az connectedk8s enable-features -n clusterName -g resourceGroupName --features azure-rbac --skip-azure-rbac-list "user1@domain.com,spn_oid"
- name: Enable multiple features.
text: az connectedk8s enable-features -n clusterName -g resourceGroupName --features cluster-connect custom-locations
"""
Expand Down
2 changes: 0 additions & 2 deletions src/connectedk8s/azext_connectedk8s/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ def load_arguments(self, _):
c.argument('kube_config', options_list=['--kube-config'], help='Path to the kube config file.')
c.argument('kube_context', options_list=['--kube-context'], help='Kubconfig context from current machine.')
c.argument('features', features_types, options_list=['--features'], help='Space-separated list of features you want to enable.')
c.argument('azrbac_client_id', options_list=['--app-id'], arg_group='Azure RBAC', help='Application ID for enabling Azure RBAC. Specify when enabling azure-rbac.')
c.argument('azrbac_client_secret', options_list=['--app-secret'], arg_group='Azure RBAC', help='Application secret for enabling Azure RBAC. Specify when enabling azure-rbac.')
c.argument('azrbac_skip_authz_check', options_list=['--skip-azure-rbac-list'], arg_group='Azure RBAC', help='Comma separated list of names of usernames/email/oid. Azure RBAC will be skipped for these users. Specify when enabling azure-rbac.')
c.argument('cl_oid', options_list=['--custom-locations-oid'], help="OID of 'custom-locations' app")

Expand Down
2 changes: 1 addition & 1 deletion src/connectedk8s/azext_connectedk8s/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1351,7 +1351,7 @@ def get_all_helm_values(release_namespace, kube_config, kube_context, helm_clien


def enable_features(cmd, client, resource_group_name, cluster_name, features, kube_config=None, kube_context=None,
azrbac_client_id=None, azrbac_client_secret=None, azrbac_skip_authz_check=None, cl_oid=None):
azrbac_skip_authz_check=None, cl_oid=None):
logger.warning("This operation might take a while...\n")

# Validate custom token operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ def test_enable_disable_features(self,resource_group):
assert(enabled_cmd1["systemDefaultValues"]['customLocations']['enabled'] == bool(1))
assert(enabled_cmd1["systemDefaultValues"]['clusterconnect-agent']['enabled'] == bool(1))

# scenario-4: azure rbac turned off and turning azure rbac on again using app id and app secret
# scenario-4: azure rbac turned off and turning azure rbac on again using 1P
self.cmd('connectedk8s disable-features -n {name} -g {rg} --features azure-rbac --kube-config {kubeconfig} --kube-context {managed_cluster_name}-admin -y')
cmd_output1 = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
_, error_helm_delete = cmd_output1.communicate()
assert(cmd_output1.returncode == 0)
disabled_cmd1 = json.loads(cmd_output1.communicate()[0].strip())
assert(disabled_cmd1["systemDefaultValues"]['guard']['enabled'] == bool(0))

self.cmd('az connectedk8s enable-features -n {name} -g {rg} --kube-config {kubeconfig} --kube-context {managed_cluster_name}-admin --features azure-rbac --app-id ffba4043-836e-4dcc-906c-fbf60bf54eef --app-secret="6a6ae7a7-4260-40d3-ba00-af909f2ca8f0"')
self.cmd('az connectedk8s enable-features -n {name} -g {rg} --kube-config {kubeconfig} --kube-context {managed_cluster_name}-admin --features azure-rbac')

# deleting the cluster
self.cmd('connectedk8s delete -g {rg} -n {name} --kube-config {kubeconfig} --kube-context {managed_cluster_name}-admin -y')
Expand Down

0 comments on commit ec012c1

Please sign in to comment.