Skip to content
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

Don't Send Identity Headers If In DF #67

Merged
merged 5 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/k8s-extension/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Release History
===============

0.6.1
++++++++++++++++++
* Remove sending identity for clusters in Dogfood
* Provide fix for getting tested distros for microsoft.openservicemesh
* Add location to model for identity

0.6.0
++++++++++++++++++
* Update extension resource models to Track2
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 @@ -8,3 +8,4 @@
EXTENSION_PACKAGE_NAME = "azext_k8s_extension"
PROVIDER_NAMESPACE = 'Microsoft.KubernetesConfiguration'
REGISTERED = "Registered"
DF_RM_ENDPOINT = 'https://api-dogfood.resources.windows-int.net/'
7 changes: 6 additions & 1 deletion src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c
validate_cc_registration(cmd)

# Create identity, if required
if create_identity:
# We don't create the identity if we are in DF
if create_identity and not __is_dogfood_cluster(cmd):
extension_instance.identity, extension_instance.location = \
__create_identity(cmd, resource_group_name, cluster_name, cluster_type, cluster_rp)

Expand Down Expand Up @@ -292,3 +293,7 @@ def __get_config_settings_from_file(file_path):
raise Exception("File {} is empty".format(file_path))

return settings


def __is_dogfood_cluster(cmd):
return cmd.cli_ctx.cloud.endpoints.resource_manager == consts.DF_RM_ENDPOINT
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ class ExtensionInstance(ProxyResource):
:param identity: The identity of the configuration.
:type identity:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity
:param location: Location of resource type
:type location: str
"""

_validation = {
Expand Down Expand Up @@ -311,6 +313,7 @@ class ExtensionInstance(ProxyResource):
'last_status_time': {'key': 'properties.lastStatusTime', 'type': 'str'},
'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDefinition'},
'identity': {'key': 'identity', 'type': 'ConfigurationIdentity'},
'location': {'key': 'location', 'type': 'str'},
}

def __init__(
Expand All @@ -332,6 +335,7 @@ def __init__(
self.last_status_time = None
self.error_info = None
self.identity = kwargs.get('identity', None)
self.location = kwargs.get('location', None)


class ExtensionInstancesList(msrest.serialization.Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ class ExtensionInstance(ProxyResource):
:param identity: The identity of the configuration.
:type identity:
~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity
:param location: Location of resource type
:type location: str
"""

_validation = {
Expand Down Expand Up @@ -329,6 +331,7 @@ class ExtensionInstance(ProxyResource):
'last_status_time': {'key': 'properties.lastStatusTime', 'type': 'str'},
'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDefinition'},
'identity': {'key': 'identity', 'type': 'ConfigurationIdentity'},
'location': {'key': 'location', 'type': 'str'},
}

def __init__(
Expand All @@ -344,6 +347,7 @@ def __init__(
configuration_protected_settings: Optional[Dict[str, str]] = None,
statuses: Optional[List["ExtensionStatus"]] = None,
identity: Optional["ConfigurationIdentity"] = None,
location: Optional[str] = None,
**kwargs
):
super(ExtensionInstance, self).__init__(system_data=system_data, **kwargs)
Expand All @@ -361,6 +365,7 @@ def __init__(
self.last_status_time = None
self.error_info = None
self.identity = identity
self.location = location


class ExtensionInstancesList(msrest.serialization.Model):
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 @@ -32,7 +32,7 @@
# TODO: Add any additional SDK dependencies here
DEPENDENCIES = []

VERSION = "0.6.0"
VERSION = "0.6.1"

with open('README.rst', 'r', encoding='utf-8') as f:
README = f.read()
Expand Down
4 changes: 3 additions & 1 deletion testing/test/extensions/public/AzureMonitor.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Describe 'Azure Monitor Testing' {
do
{
if (Has-ExtensionData $extensionName) {
break
if (Has-Identity-Provisioned) {
break
}
}
Start-Sleep -Seconds 10
$n += 1
Expand Down
6 changes: 6 additions & 0 deletions testing/test/helper/Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ function Has-ExtensionData {
return $false
}


function Has-Identity-Provisioned {
$output = kubectl get azureclusteridentityrequests -n azure-arc container-insights-clusteridentityrequest -o json | ConvertFrom-Json
return ($null -ne $output.status.expirationTime) -and ($null -ne $output.status.tokenReference.dataName) -and ($null -ne $output.status.tokenReference.secretName)
}

function Get-ExtensionStatus {
param(
[string]$extensionName
Expand Down