diff --git a/bicep/main.bicep b/bicep/main.bicep index a58339eba..326ba4c93 100644 --- a/bicep/main.bicep +++ b/bicep/main.bicep @@ -842,6 +842,9 @@ param aad_tenant_id string = '' @description('Create, and use a new Log Analytics workspace for AKS logs') param omsagent bool = false +@description('Enables the ContainerLogsV2 table to be of type Basic') +param containerLogsV2BasicLogs bool = false + @description('Enable RBAC using AAD') param enableAzureRBAC bool = false @@ -1522,6 +1525,17 @@ resource aks_law 'Microsoft.OperationalInsights/workspaces@2022-10-01' = if (cre ) } + +resource containerLogsV2_Basiclogs 'Microsoft.OperationalInsights/workspaces/tables@2022-10-01' = if(containerLogsV2BasicLogs){ + name: '${aks_law_name}/ContainerLogV2' + properties: { + plan: 'Basic' + } + dependsOn: [ + aks + ] +} + //This role assignment enables AKS->LA Fast Alerting experience var MonitoringMetricsPublisherRole = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '3913510d-42f4-4e42-8a64-420c390055eb') resource FastAlertingRole_Aks_Law 'Microsoft.Authorization/roleAssignments@2022-04-01' = if (omsagent) { diff --git a/helper/src/components/addonsTab.js b/helper/src/components/addonsTab.js index 822767f64..342afb416 100644 --- a/helper/src/components/addonsTab.js +++ b/helper/src/components/addonsTab.js @@ -8,6 +8,26 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { const { addons, net } = tabValues const osmFeatureFlag = featureFlag.includes('osm') const wiFeatureFlag = featureFlag.includes('workloadId') + function setContainerLogV2BasicLogs(v) { + // Function ensures that the ContainerLogV2 schema is + // enabled when enabling ContainerLogV2 Basic Logs. + if(v){ + updateFn("containerLogsV2", v) + updateFn("containerLogsV2BasicLogs", v) + }else{ + updateFn("containerLogsV2BasicLogs", v) + } + } + function setContainerLogsV2(v){ + // Function ensures that all the dependencies + // of the ContainerLogV2 schema is disabled. + if(v){ + updateFn("containerLogsV2", v) + }else{ + updateFn("containerLogsV2", v) + updateFn("containerLogsV2BasicLogs", v) + } + } return ( @@ -257,6 +277,13 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { decrementButtonAriaLabel="Decrease value by 1" styles={{ root: { marginTop: '15px'}}} /> + setContainerLogsV2(v)} label={Enable the ContainerLogV2 schema (docs) (*preview)} /> + + Enable the ContainerLogV2 (successor for ContainerLog) schema for additional data capture and friendlier schema. Disabling this feature will also disable features that are dependent on it (e.g. Basic Logs). + + setContainerLogV2BasicLogs(v)} label={Set Basic Logs for ContainerLogV2 (docs) (*preview)} /> + + Enable the Basic log data plan to cost optimise on log ingestion at the cost of a lower retention period, some log query operations that are no longer available and no alerts. Enabling Basic Logs for ContainerLogsV2 has a dependency on the ContainerLogsV2 schema and thus enabling this capability will automatically enable ContainerLogsV2. In addition, the ContainerLogsV2 table's retention is fixed at eight days. More information available via the provided docs link. updateFn("createAksMetricAlerts", v)} label={Create recommended metric alerts, enable you to monitor your system resource when it's running on peak capacity or hitting failure rates (docs) } /> diff --git a/helper/src/components/deployTab.js b/helper/src/components/deployTab.js index 306a3df78..d4052ba5f 100644 --- a/helper/src/components/deployTab.js +++ b/helper/src/components/deployTab.js @@ -149,7 +149,10 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, ...(net.networkPluginMode && {networkPluginMode: 'Overlay'}), ...(net.ebpfDataplane && {ebpfDataplane: 'cilium'}) }), - ...(urlParams.getAll('feature').includes('defender') && cluster.DefenderForContainers !== defaults.cluster.DefenderForContainers && { DefenderForContainers: cluster.DefenderForContainers }) + ...(urlParams.getAll('feature').includes('defender') && cluster.DefenderForContainers !== defaults.cluster.DefenderForContainers && { DefenderForContainers: cluster.DefenderForContainers }), + ...(addons.monitor === "aci" && { + ...(addons.containerLogsV2BasicLogs && { containerLogsV2BasicLogs: addons.containerLogsV2BasicLogs}) + }) } const post_params = { @@ -182,6 +185,12 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, }), } + const preview_post_params = { + ...(addons.monitor === "aci" && { + ...(addons.containerLogsV2 && { containerLogsV2: addons.containerLogsV2}) + }) + } + const params2tf = p => Object.keys(p).map(k => { return ` ${k} = ${k.toLowerCase().endsWith('principalid') ? '{value=data.azurerm_client_config.current.client_id}' : `{value=var.${k}}`}\n` }).join('') @@ -219,6 +228,12 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, const deployRelease = deploy.templateVersions.find(t => t.key === deploy.selectedTemplate) || {} + const preview_post_deploycmd = Object.keys(preview_post_params).map(k => { + const val = preview_post_params[k] + const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val + return ` \\\n\t-p ${k}=${targetVal}` + }).join('') + const post_deploycmd = `\n\n# Deploy charts into cluster\n` + (deploy.selectedTemplate === "local" ? `bash .${ cluster.apisecurity === "private" ? '' : '/postdeploy/scripts'}/postdeploy.sh ` : `curl -sL ${deployRelease.post_url} | bash -s -- `) + (deploy.selectedTemplate === 'local' ? (cluster.apisecurity === "private" ? '-r .' : '') : `-r ${deployRelease.base_download_url}`) + @@ -226,7 +241,9 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, const val = post_params[k] const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val return ` \\\n\t-p ${k}=${targetVal}` - }).join('') + }).join('')+ + (!deploy.disablePreviews ? preview_post_deploycmd : '') + const post_deploystr = cluster.apisecurity !== "private" ? '# Get credentials for your new AKS cluster & login (interactive)\n' + @@ -254,7 +271,7 @@ export default function DeployTab({ defaults, updateFn, tabValues, invalidArray, const val = finalParams[k] const targetVal = Array.isArray(val) ? JSON.stringify(JSON.stringify(val)) : val return ` \\\n\t${k}=${targetVal}` - }).join('') + '\n\n' + (Object.keys(post_params).length >0 ? post_deploystr : '') + }).join('') + '\n\n' + (Object.keys(post_params).length >0 || (!deploy.disablePreviews && Object.keys(preview_post_params).length >0) ? post_deploystr : '') const deployTfcmd = `#download the *.tf files and run these commands to deploy using terraform\n#for more AKS Construction samples of deploying with terraform, see https://aka.ms/aksc/terraform\n\nterraform fmt\nterraform init\nterraform validate\nterraform plan -out main.tfplan\nterraform apply main.tfplan\nterraform output` @@ -382,9 +399,9 @@ az role assignment create --role "Managed Identity Operator" --assignee-principa
Deploy ClusterBuilt with bicep

powered by Bicep

- {Object.keys(preview_params).length > 0 && + {(Object.keys(preview_params).length > 0 || Object.keys(preview_post_params).length > 0) && - Your deployment contains Preview Features which may require subscription registration and have Azure Region limitations. Please ensure you have registered for these previews, and have installed the 'az extension add --name aks-preview' before running the relevant scripts.
Preview Features you have selected: {Object.keys(preview_params).join(', ')}.
+ Your deployment contains Preview Features which may require subscription registration and have Azure Region limitations. Please ensure you have registered for these previews, and have installed the 'az extension add --name aks-preview' before running the relevant scripts.
Preview Features you have selected: {Object.keys(Object.assign(preview_params,preview_post_params)).join(', ')}.
*Require for cert-manager" echo " TenantId= *Require for cert-manager" echo " acrName= * If provided, used imported images for 3rd party charts" + echo " containerLogsV2= - Enables ContainerLogsV2" exit 1 fi @@ -401,3 +403,14 @@ if [ "$denydefaultNetworkPolicy" ]; then echo "# ----------- Default Deny All Network Policy, east-west traffic in cluster" kubectl apply -f ${release_version:-./postdeploy/k8smanifests}/networkpolicy-deny-all.yml fi + +if [ "$containerLogsV2" ]; then + echo "Downloading default ConfigMap" + configMapYamlFile="$(curl -s https://raw.githubusercontent.com/microsoft/Docker-Provider/ci_prod/kubernetes/container-azm-ms-agentconfig.yaml)" + echo "Setting containerlog_schema_version to v2" + configMapYamlFile=$(sed 's/#\[log_collection_settings.schema\]/[log_collection_settings.schema]/'<<<$configMapYamlFile) + configMapYamlFile=$(sed 's/# containerlog_schema_version = \"v2\"/containerlog_schema_version = "v2"/'<<<$configMapYamlFile) + echo "$configMapYamlFile" > container-azm-ms-agentconfig.yaml + echo "Applying ConfigMap using kubectl apply" + kubectl apply -f container-azm-ms-agentconfig.yaml +fi \ No newline at end of file