Skip to content

Commit

Permalink
{AKS} Extend --data-collection-settings with containerlogv2 (Azure#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wanlonghenry committed Jul 7, 2023
1 parent bd55892 commit 1f4602a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -599,9 +599,9 @@ def validate_data_collection_settings(dataCollectionSettings):
if isinstance(namspaces, list) is False:
raise InvalidArgumentValueError('namespaces must be an array type')
if 'enableContainerLogV2' in dataCollectionSettings.keys():
enableContainerLogV2Value = dataCollectionSettings["enableContainerLogV2"].lower()
if enableContainerLogV2Value not in ["true", "false"]:
raise InvalidArgumentValueError('enableContainerLogV2Value value MUST be either true or false')
enableContainerLogV2Value = dataCollectionSettings["enableContainerLogV2"]
if not isinstance(enableContainerLogV2Value, bool):
raise InvalidArgumentValueError('enableContainerLogV2Value value must be either true or false')
if 'streams' in dataCollectionSettings.keys():
streams = dataCollectionSettings["streams"]
if isinstance(streams, list) is False:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"namespaces": [
"kube-system"
],
"enableContainerLogV2": "true",
"enableContainerLogV2": true,
"streams": [
"Microsoft-ContainerLogV2"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7365,18 +7365,13 @@ def create_new_cluster_with_monitoring_aad_auth(self, resource_group, resource_g

if data_collection_settings:
self.cmd(get_cmd, checks=[
self.check('properties.dataSources.extensions[0].name', f'ContainerInsightsExtension')
])
self.cmd(get_cmd, checks=[
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.interval', f'1m')
])
self.cmd(get_cmd, checks=[
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.namespaceFilteringMode', f'Include')
])
self.cmd(get_cmd, checks=[
self.check('properties.dataSources.extensions[0].name', f'ContainerInsightsExtension'),
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.interval', f'1m'),
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.namespaceFilteringMode', f'Include'),
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.namespaces[0]', f'kube-system'),
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.streams[0]', f'Microsoft-ContainerLogV2'),
self.check('properties.dataFlows[0].streams[0]', f'Microsoft-ContainerLogV2')
self.check('properties.dataFlows[0].streams[0]', f'Microsoft-ContainerLogV2'),
self.check('properties.dataSources.extensions[0].extensionSettings.dataCollectionSettings.enableContainerLogV2', True)
])
# check that the DCR-A was created
dcra_resource_id = f"{cluster_resource_id}/providers/Microsoft.Insights/dataCollectionRuleAssociations/ContainerInsightsExtension"
Expand Down

0 comments on commit 1f4602a

Please sign in to comment.