-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{Azurestack} ACR & AKS: Adding Tests and Fixing Authorization api-version for hybrid profile #18443
Changes from 10 commits
e00e9c9
b6eb4fc
6ac2e68
a7de925
0732048
c5c6dc4
38e6a3b
f9865ec
7d43d85
7c520b7
234ba1e
086785c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -286,6 +286,7 @@ def _get_endpoint_and_token_status(cmd, login_server, ignore_errors): | |
|
||
|
||
def _check_registry_health(cmd, registry_name, ignore_errors): | ||
from azure.cli.core.profiles import ResourceType | ||
if registry_name is None: | ||
logger.warning("Registry name must be provided to check connectivity.") | ||
return | ||
|
@@ -310,23 +311,25 @@ def _check_registry_health(cmd, registry_name, ignore_errors): | |
if status_validated: | ||
_get_endpoint_and_token_status(cmd, login_server, ignore_errors) | ||
|
||
# CMK settings | ||
if registry and registry.encryption and registry.encryption.key_vault_properties: # pylint: disable=too-many-nested-blocks | ||
client_id = registry.encryption.key_vault_properties.identity | ||
valid_identity = False | ||
if registry.identity: | ||
valid_identity = (client_id == 'system') and bool(registry.identity.principal_id) # use system identity? | ||
if not valid_identity and registry.identity.user_assigned_identities: | ||
for k, v in registry.identity.user_assigned_identities.items(): | ||
if v.client_id == client_id: | ||
from msrestazure.azure_exceptions import CloudError | ||
try: | ||
valid_identity = (resolve_identity_client_id(cmd.cli_ctx, k) == client_id) | ||
except CloudError: | ||
pass | ||
if not valid_identity: | ||
from ._errors import CMK_MANAGED_IDENTITY_ERROR | ||
_handle_error(CMK_MANAGED_IDENTITY_ERROR.format_error_message(registry_name), ignore_errors) | ||
if cmd.supported_api_version(min_api='2020-11-01-preview', resource_type=ResourceType.MGMT_CONTAINERREGISTRY): # pylint: disable=too-many-nested-blocks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remember to specify operation_group if it is not the default one |
||
# CMK settings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please also add acr code owner to review your change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Bhuvaneswari-Santharam I tested this locally and it looks good. @northtyphoon we should consider adding some unit tests for |
||
if registry and registry.encryption and registry.encryption.key_vault_properties: # pylint: disable=too-many-nested-blocks | ||
client_id = registry.encryption.key_vault_properties.identity | ||
valid_identity = False | ||
if registry.identity: | ||
valid_identity = ((client_id == 'system') and | ||
bool(registry.identity.principal_id)) # use system identity? | ||
if not valid_identity and registry.identity.user_assigned_identities: | ||
for k, v in registry.identity.user_assigned_identities.items(): | ||
if v.client_id == client_id: | ||
from msrestazure.azure_exceptions import CloudError | ||
try: | ||
valid_identity = (resolve_identity_client_id(cmd.cli_ctx, k) == client_id) | ||
except CloudError: | ||
pass | ||
if not valid_identity: | ||
from ._errors import CMK_MANAGED_IDENTITY_ERROR | ||
_handle_error(CMK_MANAGED_IDENTITY_ERROR.format_error_message(registry_name), ignore_errors) | ||
|
||
|
||
def _check_private_endpoint(cmd, registry_name, vnet_of_private_endpoint): # pylint: disable=too-many-locals, too-many-statements | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
interactions: | ||
- request: | ||
body: '{"location": "westus", "sku": {"name": "Premium"}, "properties": {"adminUserEnabled": | ||
false}}' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
CommandName: | ||
- acr create | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '93' | ||
Content-Type: | ||
- application/json; charset=utf-8 | ||
ParameterSetName: | ||
- -n -g -l --sku | ||
User-Agent: | ||
- python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 | ||
azure-mgmt-containerregistry/3.0.0rc17 Azure-SDK-For-Python AZURECLI/2.23.0 | ||
accept-language: | ||
- en-US | ||
method: PUT | ||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.ContainerRegistry/registries/clireg000002?api-version=2019-05-01 | ||
response: | ||
body: | ||
string: '{"sku":{"name":"Premium","tier":"Premium"},"type":"Microsoft.ContainerRegistry/registries","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.ContainerRegistry/registries/clireg000002","name":"clireg000002","location":"westus","tags":{},"properties":{"loginServer":"clireg000002.azurecr.io","creationDate":"2021-06-09T09:12:05.571844Z","provisioningState":"Succeeded","adminUserEnabled":false,"networkRuleSet":{"defaultAction":"Allow","virtualNetworkRules":[],"ipRules":[]},"policies":{"quarantinePolicy":{"status":"disabled"},"trustPolicy":{"type":"Notary","status":"disabled"},"retentionPolicy":{"days":7,"lastUpdatedTime":"2021-06-09T09:12:06.5641607+00:00","status":"disabled"}}}}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '826' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Jun 2021 09:12:06 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
server: | ||
- Microsoft-HTTPAPI/2.0 | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
transfer-encoding: | ||
- chunked | ||
vary: | ||
- Accept-Encoding | ||
x-content-type-options: | ||
- nosniff | ||
x-ms-ratelimit-remaining-subscription-writes: | ||
- '1199' | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
CommandName: | ||
- acr replication create | ||
Connection: | ||
- keep-alive | ||
ParameterSetName: | ||
- -n -r -l | ||
User-Agent: | ||
- AZURECLI/2.23.0 azsdk-python-azure-mgmt-resource/16.1.0 Python/3.7.4 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resources?$filter=resourceType%20eq%20%27Microsoft.ContainerRegistry%2Fregistries%27&api-version=2019-10-01 | ||
response: | ||
body: | ||
string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.ContainerRegistry/registries/clireg000002","name":"clireg000002","type":"Microsoft.ContainerRegistry/registries","sku":{"name":"Premium","tier":"Premium"},"location":"westus","tags":{}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testacr/providers/Microsoft.ContainerRegistry/registries/testacr1986","name":"testacr1986","type":"Microsoft.ContainerRegistry/registries","sku":{"name":"Standard","tier":"Standard"},"location":"eastus","tags":{}}]}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '671' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Jun 2021 09:12:07 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
vary: | ||
- Accept-Encoding | ||
x-content-type-options: | ||
- nosniff | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
CommandName: | ||
- acr replication create | ||
Connection: | ||
- keep-alive | ||
ParameterSetName: | ||
- -n -r -l | ||
User-Agent: | ||
- python/3.7.4 (Windows-10-10.0.19041-SP0) msrest/0.6.21 msrest_azure/0.6.3 | ||
azure-mgmt-containerregistry/3.0.0rc17 Azure-SDK-For-Python AZURECLI/2.23.0 | ||
accept-language: | ||
- en-US | ||
method: GET | ||
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.ContainerRegistry/registries/clireg000002?api-version=2019-05-01 | ||
response: | ||
body: | ||
string: '{"sku":{"name":"Premium","tier":"Premium"},"type":"Microsoft.ContainerRegistry/registries","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.ContainerRegistry/registries/clireg000002","name":"clireg000002","location":"westus","tags":{},"properties":{"loginServer":"clireg000002.azurecr.io","creationDate":"2021-06-09T09:12:05.571844Z","provisioningState":"Succeeded","adminUserEnabled":false,"networkRuleSet":{"defaultAction":"Allow","virtualNetworkRules":[],"ipRules":[]},"policies":{"quarantinePolicy":{"status":"disabled"},"trustPolicy":{"type":"Notary","status":"disabled"},"retentionPolicy":{"days":7,"lastUpdatedTime":"2021-06-09T09:12:06.5641607+00:00","status":"disabled"}}}}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '826' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Jun 2021 09:12:06 GMT | ||
expires: | ||
- '-1' | ||
pragma: | ||
- no-cache | ||
server: | ||
- Microsoft-HTTPAPI/2.0 | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
transfer-encoding: | ||
- chunked | ||
vary: | ||
- Accept-Encoding | ||
x-content-type-options: | ||
- nosniff | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a downgrade for authorization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a downgrade, This is a bug fix. In our earlier PR we have mistakenly updated the api version @Juliehzl