-
Notifications
You must be signed in to change notification settings - Fork 115
Zane/deploy to prod helm #1602
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
Merged
Merged
Zane/deploy to prod helm #1602
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0e47838
helm chart deployment
zanejohnson-azure d93a730
yml path fix
zanejohnson-azure ff03ebb
use env
zanejohnson-azure 22cca74
remove depen
zanejohnson-azure d480280
chart path
zanejohnson-azure 55f2f91
add verification
zanejohnson-azure 3689c09
use zane-test-helm
zanejohnson-azure 623ca77
add region
zanejohnson-azure 6380b95
update
zanejohnson-azure a7af652
add 2nd cluster
zanejohnson-azure a663776
refactor
zanejohnson-azure 7487d15
minor
zanejohnson-azure e7abb94
replace with two prod clusters
zanejohnson-azure 477c56b
minor changes
zanejohnson-azure e7899a4
minor
zanejohnson-azure e31638d
minor fix
zanejohnson-azure 059ddd7
final cleanup
zanejohnson-azure File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
258 changes: 258 additions & 0 deletions
258
.pipelines/helm-deploy-templates/ama-logs-helm-deploy.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,258 @@ | ||
| # Template for deploying ama-logs to an AKS cluster via Helm | ||
| # Usage: | ||
| # - template: helm-deploy-templates/ama-logs-helm-deploy.yaml | ||
| # parameters: | ||
| # clusterName: 'my-cluster' | ||
| # resourceGroup: 'my-rg' | ||
| # region: 'eastus' | ||
| # subscriptionId: '9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb' | ||
| # workspaceId: 'your-workspace-id' | ||
| # imageTag: '$(AgentImageTagSuffix)' # e.g., 3.1.32 | ||
| # environment: 'deployment environment' | ||
|
|
||
| parameters: | ||
| # Required cluster parameters | ||
| - name: clusterName | ||
| type: string | ||
| - name: resourceGroup | ||
| type: string | ||
| - name: region | ||
| type: string | ||
| - name: subscriptionId | ||
| type: string | ||
| - name: workspaceId | ||
| type: string | ||
| displayName: 'Log Analytics Workspace ID' | ||
| - name: imageTag | ||
| type: string | ||
| displayName: 'Image tag suffix (e.g., 3.1.32)' | ||
| - name: environment | ||
| type: string | ||
| displayName: 'Azure DevOps Environment name' | ||
|
|
||
| # Optional parameters with defaults | ||
| - name: cloudEnvironment | ||
| type: string | ||
| default: 'azurepubliccloud' | ||
| - name: kubernetesVersion | ||
| type: string | ||
| default: '1.32.7' | ||
| - name: azureSubscription | ||
| type: string | ||
| default: 'ContainerInsights_Build_Subscription_CI' | ||
| - name: namespace | ||
| type: string | ||
| default: 'default' | ||
| - name: releaseName | ||
| type: string | ||
| default: 'azuremonitor-containers' | ||
| - name: helmVersion | ||
| type: string | ||
| default: '3.12.3' | ||
| - name: dependsOn | ||
| type: object | ||
| default: [] | ||
|
|
||
| jobs: | ||
| - deployment: Deploy_AmaLogs_${{ replace(parameters.clusterName, '-', '_') }} | ||
| displayName: 'Deploy: ama-logs to ${{ parameters.clusterName }}' | ||
| environment: ${{ parameters.environment }} | ||
| dependsOn: ${{ parameters.dependsOn }} | ||
| variables: | ||
| - name: OneESPT | ||
| value: true | ||
| readonly: true | ||
| - name: OneESPT.BuildType | ||
| value: Official | ||
| readonly: true | ||
| - name: OneESPT.OS | ||
| value: linux | ||
| readonly: true | ||
| - name: skipComponentGovernanceDetection | ||
| value: true | ||
| - name: Codeql.SkipTaskAutoInjection | ||
| value: true | ||
| - name: AKS_RESOURCE_ID | ||
| value: '/subscriptions/${{ parameters.subscriptionId }}/resourceGroups/${{ parameters.resourceGroup }}/providers/Microsoft.ContainerService/managedClusters/${{ parameters.clusterName }}' | ||
| strategy: | ||
| runOnce: | ||
| deploy: | ||
| steps: | ||
| - checkout: self | ||
| displayName: Checkout repository | ||
| - task: HelmInstaller@1 | ||
| displayName: Install Helm | ||
| inputs: | ||
| helmVersionToInstall: '${{ parameters.helmVersion }}' | ||
| - task: HelmDeploy@0 | ||
| displayName: 'Helm Deploy: ama-logs to ${{ parameters.clusterName }}' | ||
| inputs: | ||
| connectionType: 'Azure Resource Manager' | ||
| azureSubscription: '${{ parameters.azureSubscription }}' | ||
| azureResourceGroup: '${{ parameters.resourceGroup }}' | ||
| kubernetesCluster: '${{ parameters.clusterName }}' | ||
| useClusterAdmin: true | ||
| namespace: '${{ parameters.namespace }}' | ||
| command: 'upgrade' | ||
| chartType: 'FilePath' | ||
| # The following chart is copied over from feature branch https://github.com/microsoft/Docker-Provider/tree/longw/addon-to-extension-quick-Test | ||
| # TODO: When it is merged to ci_prod, the following chartPath will be updated accordingly. | ||
Check noticeCode scanning / devskim A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note
Suspicious comment
|
||
| chartPath: '$(Build.SourcesDirectory)/charts/azuremonitor-containerinsights-for-prod-clusters' | ||
rashmichandrashekar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| releaseName: '${{ parameters.releaseName }}' | ||
| overrideValues: 'global.commonGlobals.CloudEnvironment=${{ parameters.cloudEnvironment }},global.commonGlobals.Region=${{ parameters.region }},OmsAgent.aksResourceID=$(AKS_RESOURCE_ID),OmsAgent.workspaceID=${{ parameters.workspaceId }},OmsAgent.imageTagLinux=${{ parameters.imageTag }},OmsAgent.imageTagWindows=win-${{ parameters.imageTag }}' | ||
| waitForExecution: false | ||
| arguments: '--timeout 10m --install' | ||
| - task: AzureCLI@2 | ||
| displayName: Verify Deployment | ||
| inputs: | ||
| azureSubscription: '${{ parameters.azureSubscription }}' | ||
| scriptType: bash | ||
| scriptLocation: inlineScript | ||
| inlineScript: | | ||
| echo "==========================================" | ||
| echo "Deployment Summary" | ||
| echo "==========================================" | ||
| echo "Cluster: ${{ parameters.clusterName }}" | ||
| echo "Resource Group: ${{ parameters.resourceGroup }}" | ||
| echo "Region: ${{ parameters.region }}" | ||
| echo "Linux Image Tag: ${{ parameters.imageTag }}" | ||
| echo "Windows Image Tag: win-${{ parameters.imageTag }}" | ||
| echo "" | ||
|
|
||
| echo "Getting AKS credentials..." | ||
| az aks get-credentials --resource-group ${{ parameters.resourceGroup }} --name ${{ parameters.clusterName }} --overwrite-existing --admin | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| echo "Waiting for pods to be ready (60s max)..." | ||
| echo "==========================================" | ||
|
|
||
| # Wait for daemonset pods (pods are always deployed to kube-system namespace) | ||
| kubectl rollout status daemonset/ama-logs -n kube-system --timeout=60s || echo "Warning: Daemonset rollout not complete within timeout" | ||
|
|
||
| # Wait for replicaset pod | ||
| kubectl rollout status deployment/ama-logs-rs -n kube-system --timeout=60s 2>/dev/null || \ | ||
| kubectl rollout status replicaset -l rsName=ama-logs-rs -n kube-system --timeout=60s 2>/dev/null || \ | ||
| echo "Warning: ReplicaSet rollout status check skipped" | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| echo "Pod Status" | ||
| echo "==========================================" | ||
| kubectl get pods -n kube-system | grep ama-logs || echo "No ama-logs pods found" | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| echo "Helm Release Status" | ||
| echo "==========================================" | ||
| helm status ${{ parameters.releaseName }} -n ${{ parameters.namespace }} 2>/dev/null || echo "Helm release status not available" | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| echo "Image Verification" | ||
| echo "==========================================" | ||
| EXPECTED_LINUX_TAG="${{ parameters.imageTag }}" | ||
| EXPECTED_WINDOWS_TAG="win-${{ parameters.imageTag }}" | ||
| VERIFICATION_PASSED=true | ||
|
|
||
| echo "Expected Linux image tag: $EXPECTED_LINUX_TAG" | ||
| echo "Expected Windows image tag: $EXPECTED_WINDOWS_TAG" | ||
| echo "" | ||
|
|
||
| # ---- 1. Linux DaemonSet Pod Verification (ama-logs + ama-logs-prometheus containers) ---- | ||
| # Note: Pods are always deployed to kube-system namespace regardless of helm release namespace | ||
| echo "--- 1. Linux DaemonSet Verification ---" | ||
|
|
||
| # Check ama-logs container | ||
| LINUX_AMA_LOGS_IMAGE=$(kubectl get pods -n kube-system -l component=ama-logs-agent -o jsonpath='{.items[0].spec.containers[?(@.name=="ama-logs")].image}' 2>/dev/null) | ||
|
|
||
| if [ -z "$LINUX_AMA_LOGS_IMAGE" ]; then | ||
| echo "❌ ERROR: Could not retrieve ama-logs container image from Linux DaemonSet" | ||
| VERIFICATION_PASSED=false | ||
| else | ||
| echo "ama-logs container image: $LINUX_AMA_LOGS_IMAGE" | ||
| LINUX_AMA_LOGS_TAG=$(echo "$LINUX_AMA_LOGS_IMAGE" | cut -d':' -f2) | ||
| if [ "$LINUX_AMA_LOGS_TAG" == "$EXPECTED_LINUX_TAG" ]; then | ||
| echo "✅ ama-logs container: PASSED" | ||
| else | ||
| echo "❌ ama-logs container MISMATCH! Expected: $EXPECTED_LINUX_TAG, Actual: $LINUX_AMA_LOGS_TAG" | ||
| VERIFICATION_PASSED=false | ||
| fi | ||
| fi | ||
|
|
||
| # Check ama-logs-prometheus container | ||
| LINUX_PROM_IMAGE=$(kubectl get pods -n kube-system -l component=ama-logs-agent -o jsonpath='{.items[0].spec.containers[?(@.name=="ama-logs-prometheus")].image}' 2>/dev/null) | ||
|
|
||
| if [ -z "$LINUX_PROM_IMAGE" ]; then | ||
| echo "❌ ERROR: Could not retrieve ama-logs-prometheus container image from Linux DaemonSet" | ||
| VERIFICATION_PASSED=false | ||
| else | ||
| echo "ama-logs-prometheus container image: $LINUX_PROM_IMAGE" | ||
| LINUX_PROM_TAG=$(echo "$LINUX_PROM_IMAGE" | cut -d':' -f2) | ||
| if [ "$LINUX_PROM_TAG" == "$EXPECTED_LINUX_TAG" ]; then | ||
| echo "✅ ama-logs-prometheus container: PASSED" | ||
| else | ||
| echo "❌ ama-logs-prometheus container MISMATCH! Expected: $EXPECTED_LINUX_TAG, Actual: $LINUX_PROM_TAG" | ||
| VERIFICATION_PASSED=false | ||
| fi | ||
| fi | ||
|
|
||
| echo "" | ||
|
|
||
| # ---- 2. ReplicaSet Pod Verification (ama-logs container) ---- | ||
| echo "--- 2. ReplicaSet Verification ---" | ||
|
|
||
| RS_AMA_LOGS_IMAGE=$(kubectl get pods -n kube-system -l rsName=ama-logs-rs -o jsonpath='{.items[0].spec.containers[?(@.name=="ama-logs")].image}' 2>/dev/null) | ||
|
|
||
| if [ -z "$RS_AMA_LOGS_IMAGE" ]; then | ||
| echo "❌ ERROR: Could not retrieve ama-logs container image from ReplicaSet" | ||
| VERIFICATION_PASSED=false | ||
| else | ||
| echo "ama-logs container image: $RS_AMA_LOGS_IMAGE" | ||
| RS_AMA_LOGS_TAG=$(echo "$RS_AMA_LOGS_IMAGE" | cut -d':' -f2) | ||
| if [ "$RS_AMA_LOGS_TAG" == "$EXPECTED_LINUX_TAG" ]; then | ||
| echo "✅ ReplicaSet ama-logs container: PASSED" | ||
| else | ||
| echo "❌ ReplicaSet ama-logs container MISMATCH! Expected: $EXPECTED_LINUX_TAG, Actual: $RS_AMA_LOGS_TAG" | ||
| VERIFICATION_PASSED=false | ||
| fi | ||
| fi | ||
|
|
||
| echo "" | ||
|
|
||
| # ---- 3. Windows DaemonSet Pod Verification (ama-logs-windows container) ---- | ||
| echo "--- 3. Windows DaemonSet Verification ---" | ||
|
|
||
| WINDOWS_POD_EXISTS=$(kubectl get pods -n kube-system -l component=ama-logs-agent-windows -o jsonpath='{.items[0].metadata.name}' 2>/dev/null) | ||
|
|
||
| if [ -z "$WINDOWS_POD_EXISTS" ]; then | ||
| echo "INFO: No Windows ama-logs pods found (cluster may not have Windows nodes)" | ||
| echo "Skipping Windows verification" | ||
| else | ||
| WINDOWS_IMAGE=$(kubectl get pods -n kube-system -l component=ama-logs-agent-windows -o jsonpath='{.items[0].spec.containers[?(@.name=="ama-logs-windows")].image}' 2>/dev/null) | ||
|
|
||
| if [ -z "$WINDOWS_IMAGE" ]; then | ||
| echo "❌ ERROR: Could not retrieve ama-logs-windows container image" | ||
| VERIFICATION_PASSED=false | ||
| else | ||
| echo "ama-logs-windows container image: $WINDOWS_IMAGE" | ||
| WINDOWS_TAG=$(echo "$WINDOWS_IMAGE" | cut -d':' -f2) | ||
| if [ "$WINDOWS_TAG" == "$EXPECTED_WINDOWS_TAG" ]; then | ||
| echo "✅ Windows ama-logs-windows container: PASSED" | ||
| else | ||
| echo "❌ Windows ama-logs-windows container MISMATCH! Expected: $EXPECTED_WINDOWS_TAG, Actual: $WINDOWS_TAG" | ||
| VERIFICATION_PASSED=false | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| echo "Final Verification Result" | ||
| echo "==========================================" | ||
| if [ "$VERIFICATION_PASSED" = true ]; then | ||
| echo "✅ SUCCESS: All image tag verifications PASSED" | ||
| else | ||
| echo "❌ FAILED: One or more image tag verifications failed" | ||
| exit 1 | ||
| fi | ||
4 changes: 4 additions & 0 deletions
4
charts/azuremonitor-containerinsights-for-prod-clusters/Chart.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| apiVersion: v2 | ||
| description: azure-monitor-containers helm chart | ||
| name: azuremonitor-containers | ||
| version: 3.2.1-dev-test |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.