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

{AKS} Extend --data-collection-settings with containerlogv2 #26793

Merged
merged 4 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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')
wanlonghenry marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -7355,18 +7355,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