Skip to content

Commit

Permalink
az k8s-extension create | Attempt to register a Resource Provider tha…
Browse files Browse the repository at this point in the history
…t is already registered (#8357)
  • Loading branch information
dupuyjs authored Jan 22, 2025
1 parent 5fcf3f1 commit d6552fa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/k8s-extension/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.6.3
++++++++++++++++++
* Do not attempt to register Microsoft.Monitor and Microsoft.Dashboard resource providers if they are already registered.

1.6.2
++++++++++++++++++
* microsoft.workloadiam: Enhanced security by utilizing protected configuration settings for the join token instead of regular configuration settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
CONFIG_SETTINGS_HELM_TENANT_ID = 'global.workload-iam.tenantID'
CONFIG_SETTINGS_HELM_JOIN_TOKEN = 'workload-iam-local-authority.localAuthorityArgs.joinToken'


def settings_dict_to_lowercase(settings):
"""
Create new dictionary where the keys of the known user settings are all lowercase (but leave the
Expand All @@ -47,6 +48,7 @@ def settings_dict_to_lowercase(settings):

return validated_settings


class EntraWorkloadIAM(DefaultExtension):

def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_type, cluster_rp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def rp_registrations(cmd, subscription_id):
raise CLIError(e)
isInsightsRpRegistered = False
isAlertsManagementRpRegistered = False
isMoniotrRpRegistered = False
isMonitorRpRegistered = False
isDashboardRpRegistered = False
json_response = json.loads(r.text)
values_array = json_response["value"]
Expand All @@ -67,9 +67,9 @@ def rp_registrations(cmd, subscription_id):
if value["namespace"].lower() == "microsoft.alertsmanagement" and value["registrationState"].lower() == "registered":
isAlertsManagementRpRegistered = True
if value["namespace"].lower() == "microsoft.monitor" and value["registrationState"].lower() == "registered":
isAlertsManagementRpRegistered = True
isMonitorRpRegistered = True
if value["namespace"].lower() == "microsoft.dashboard" and value["registrationState"].lower() == "registered":
isAlertsManagementRpRegistered = True
isDashboardRpRegistered = True
if isInsightsRpRegistered is False:
print(f"Registering microsoft.insights RP for the subscription {subscription_id}")
headers = ['User-Agent=arc-azuremonitormetrics.register_insights_rp']
Expand All @@ -78,7 +78,7 @@ def rp_registrations(cmd, subscription_id):
print(f"Registering microsoft.alertsmanagement RP for the subscription {subscription_id}")
headers = ['User-Agent=arc-azuremonitormetrics.register_alertsmanagement_rp']
post_request(cmd, subscription_id, "microsoft.alertsmanagement", headers)
if isMoniotrRpRegistered is False:
if isMonitorRpRegistered is False:
print(f"Registering microsoft.monitor RP for the subscription {subscription_id}")
headers = ['User-Agent=arc-azuremonitormetrics.register_monitor_rp']
post_request(cmd, subscription_id, "microsoft.monitor", headers)
Expand Down
2 changes: 1 addition & 1 deletion src/k8s-extension/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# TODO: Add any additional SDK dependencies here
DEPENDENCIES = []

VERSION = "1.6.2"
VERSION = "1.6.3"

with open("README.rst", "r", encoding="utf-8") as f:
README = f.read()
Expand Down

0 comments on commit d6552fa

Please sign in to comment.