Skip to content

Commit

Permalink
Provider registration case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed May 11, 2021
1 parent cf95612 commit fea6e00
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/k8s-extension/azext_k8s_extension/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@


# pylint: disable=broad-except
def _validate_cc_registration(cmd):
def validate_cc_registration(cmd):
try:
rp_client = _resource_providers_client(cmd.cli_ctx)
registration_state = rp_client.get(consts.PROVIDER_NAMESPACE).registration_state

if registration_state != "Registered":
if registration_state.lower() != consts.REGISTERED.lower():
logger.warning("'Extensions' cannot be used because '%s' provider has not been registered."
"More details for registering this provider can be found here - "
"https://aka.ms/RegisterKubernetesConfigurationProvider", consts.PROVIDER_NAMESPACE)
Expand Down
1 change: 1 addition & 0 deletions src/k8s-extension/azext_k8s_extension/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
EXTENSION_NAME = 'k8s-extension'
EXTENSION_PACKAGE_NAME = "azext_k8s_extension"
PROVIDER_NAMESPACE = 'Microsoft.KubernetesConfiguration'
REGISTERED = "Registered"
4 changes: 2 additions & 2 deletions src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azext_k8s_extension.vendored_sdks.models import ConfigurationIdentity
from azext_k8s_extension.vendored_sdks.models import ErrorResponseException
from azext_k8s_extension.vendored_sdks.models import Scope
from azext_k8s_extension._validators import _validate_cc_registration
from azext_k8s_extension._validators import validate_cc_registration

from .partner_extensions.ContainerInsights import ContainerInsights
from .partner_extensions.AzureDefender import AzureDefender
Expand Down Expand Up @@ -136,7 +136,7 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c
__validate_scope_after_customization(extension_instance.scope)

# Check that registration has been done on Microsoft.KubernetesConfiguration for the subscription
_validate_cc_registration(cmd)
validate_cc_registration(cmd)

# Create identity, if required
if create_identity:
Expand Down

0 comments on commit fea6e00

Please sign in to comment.