Skip to content
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
29 changes: 15 additions & 14 deletions ReleaseProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,48 +39,49 @@ Image automatically synched to MCR CN from Public cloud MCR.

Make PR against [AKS-Engine](https://github.com/Azure/aks-engine). Refer PR https://github.com/Azure/aks-engine/pull/2318

## Arc for Kubernetes
## Arc for Kubernetes

Ev2 pipeline used to deploy the chart of the Arc K8s Container Insights Extension as per Safe Deployment Process.
Ev2 pipeline used to deploy the chart of the Arc K8s Container Insights Extension as per Safe Deployment Process.
Here is the high level process
```
1. Specify chart version of the release candidate and trigger [container-insights-arc-k8s-extension-ci_prod-release](https://github-private.visualstudio.com/microsoft/_release?_a=releases&view=all)
2. Get the approval from one of team member for the release
3. Once the approved, release should be triggered automatically
3. Once the approved, release should be triggered automatically
4. use `cimon-arck8s-eastus2euap` for validating latest release in canary region
5. TBD - Notify vendor team for the validation on all Arc K8s supported platforms
```

## Microsoft Charts Repo release for On-prem K8s
> Note: This chart repo being used in the ARO v4 onboarding script as well.

Since HELM charts repo being deprecated, Microsoft charts repo being used for HELM chart release of on-prem K8s clusters.
To make chart release PR, fork [Microsoft-charts-repo]([https://github.com/microsoft/charts/tree/gh-pages) and make the PR against `gh-pages` branch of the upstream repo.
Since HELM charts repo being deprecated, Microsoft charts repo being used for HELM chart release of on-prem K8s clusters.
To make chart release PR, fork [Microsoft-charts-repo]([https://github.com/microsoft/charts/tree/gh-pages) and make the PR against `gh-pages` branch of the upstream repo.

Refer PR - https://github.com/microsoft/charts/pull/23 for example.
Once the PR merged, latest version of HELM chart should be available in couple of mins in https://microsoft.github.io/charts/repo and https://artifacthub.io/.

Instructions to create PR
```
# 1. create helm package for the release candidate
# 1. create helm package for the release candidate
git clone git@github.com:microsoft/Docker-Provider.git
git checkout ci_prod
cd ~/Docker-Provider/charts/azuremonitor-containers # this path based on where you have cloned the repo
helm package .
helm package .

# 2. clone your fork repo and checkout gh_pages branch # gh_pages branch used as release branch
cd ~
# 2. clone your fork repo and checkout gh_pages branch # gh_pages branch used as release branch
cd ~
git clone <your-forked-repo-of-microsoft-charts-repo>
cd ~/charts # assumed the root dir of the clone is charts
git checkout gh_pages

# 3. copy release candidate helm package
cd ~/charts/repo/azuremonitor-containers
# 3. copy release candidate helm package
cd ~/charts/repo/azuremonitor-containers
# update chart version value with the version of chart being released
cp ~/Docker-Provider/charts/azuremonitor-containers/azuremonitor-containers-<chart-version>.tgz .
cp ~/Docker-Provider/charts/azuremonitor-containers/azuremonitor-containers-<chart-version>.tgz .
cd ~/charts/repo
# update repo index file
# update repo index file
helm repo index .

# 4. Review the changes and make PR. Please note, you may need to revert unrelated changes automatically added by `helm repo index .` command

```
Expand Down
23 changes: 9 additions & 14 deletions scripts/onboarding/managed/enable-monitoring.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ $isArcK8sCluster = $false
$isAksCluster = $false
$isUsingServicePrincipal = $false

# released chart version in mcr
$mcr = "mcr.microsoft.com"
$mcrChartVersion = "2.8.3"
$mcrChartRepoPath = "azuremonitor/containerinsights/preview/azuremonitor-containers"
$helmLocalRepoName = "."
# microsoft helm chart repo
$microsoftHelmRepo="https://microsoft.github.io/charts/repo"
$microsoftHelmRepoName="microsoft"

$omsAgentDomainName="opinsights.azure.com"

if ([string]::IsNullOrEmpty($azureCloudName) -eq $true) {
Expand Down Expand Up @@ -547,16 +546,12 @@ Write-Host "Helm version" : $helmVersion
Write-Host("Installing or upgrading if exists, Azure Monitor for containers HELM chart ...")
try {

Write-Host("pull the chart from mcr.microsoft.com")
[System.Environment]::SetEnvironmentVariable("HELM_EXPERIMENTAL_OCI", 1, "Process")

Write-Host("pull the chart from mcr.microsoft.com")
helm chart pull ${mcr}/${mcrChartRepoPath}:${mcrChartVersion}

Write-Host("export the chart from local cache to current directory")
helm chart export ${mcr}/${mcrChartRepoPath}:${mcrChartVersion} --destination .
Write-Host("Add helm chart repo- ${microsoftHelmRepoName} with repo path: ${microsoftHelmRepo}")
helm repo add ${microsoftHelmRepoName} ${microsoftHelmRepo}
Write-Host("Updating the helm chart repo- ${microsoftHelmRepoName} to get latest chart versions")
helm repo update ${microsoftHelmRepoName}

$helmChartRepoPath = "${helmLocalRepoName}" + "/" + "${helmChartName}"
$helmChartRepoPath = "${microsoftHelmRepoName}" + "/" + "${helmChartName}"

Write-Host("helmChartRepoPath is : ${helmChartRepoPath}")

Expand Down
42 changes: 25 additions & 17 deletions scripts/onboarding/managed/enable-monitoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ defaultAzureCloud="AzureCloud"
# default domain will be for public cloud
omsAgentDomainName="opinsights.azure.com"

# released chart version in mcr
mcrChartVersion="2.8.3"
mcr="mcr.microsoft.com"
mcrChartRepoPath="azuremonitor/containerinsights/preview/azuremonitor-containers"
helmLocalRepoName="."
# microsoft helm chart repo
microsoftHelmRepo="https://microsoft.github.io/charts/repo"
microsoftHelmRepoName="microsoft"
helmChartName="azuremonitor-containers"

# default release name used during onboarding
Expand Down Expand Up @@ -435,9 +433,10 @@ create_default_log_analytics_workspace() {

workspaceResourceGroup="DefaultResourceGroup-"$workspaceRegionCode
isRGExists=$(az group exists -g $workspaceResourceGroup)
isRGExists=$(echo $isRGExists | tr -d '"\r\n')
workspaceName="DefaultWorkspace-"$subscriptionId"-"$workspaceRegionCode

if $isRGExists; then
if [ "${isRGExists}" == "true" ]; then
echo "using existing default resource group:"$workspaceResourceGroup
else
echo "creating resource group: $workspaceResourceGroup in region: $workspaceRegion"
Expand All @@ -455,7 +454,7 @@ create_default_log_analytics_workspace() {
fi

workspaceResourceId=$(az resource show -g $workspaceResourceGroup -n $workspaceName --resource-type $workspaceResourceProvider --query id -o json)
workspaceResourceId=$(echo $workspaceResourceId | tr -d '"')
workspaceResourceId=$(echo $workspaceResourceId | tr -d '"' | tr -d '"\r\n')
echo "workspace resource Id: ${workspaceResourceId}"
}

Expand Down Expand Up @@ -495,10 +494,16 @@ install_helm_chart() {
adminUserName=$(az aro list-credentials -g $clusterResourceGroup -n $clusterName --query 'kubeadminUsername' -o tsv)
adminPassword=$(az aro list-credentials -g $clusterResourceGroup -n $clusterName --query 'kubeadminPassword' -o tsv)
apiServer=$(az aro show -g $clusterResourceGroup -n $clusterName --query apiserverProfile.url -o tsv)
# certain az cli versions adds /r/n so trim them
adminUserName=$(echo $adminUserName | tr -d '"\r\n')
adminPassword=$(echo $adminPassword | tr -d '"\r\n')
apiServer=$(echo $apiServer | tr -d '"\r\n')
echo "login to the cluster via oc login"
oc login $apiServer -u $adminUserName -p $adminPassword
echo "creating project azure-monitor-for-containers"
echo "creating project: azure-monitor-for-containers"
oc new-project $openshiftProjectName
echo "swicthing to project: azure-monitor-for-containers"
oc project $openshiftProjectName
echo "getting config-context of aro v4 cluster"
kubeconfigContext=$(oc config current-context)
fi
Expand All @@ -513,15 +518,7 @@ install_helm_chart() {
clusterRegion=$(az resource show --ids ${clusterResourceId} --query location -o tsv)
echo "cluster region is : ${clusterRegion}"

echo "pull the chart version ${mcrChartVersion} from ${mcr}/${mcrChartRepoPath}"
export HELM_EXPERIMENTAL_OCI=1
helm chart pull $mcr/$mcrChartRepoPath:$mcrChartVersion

echo "export the chart from local cache to current directory"
helm chart export $mcr/$mcrChartRepoPath:$mcrChartVersion --destination .

helmChartRepoPath=$helmLocalRepoName/$helmChartName

helmChartRepoPath=$microsoftHelmRepoName/$helmChartName
echo "helm chart repo path: ${helmChartRepoPath}"

if [ ! -z "$proxyEndpoint" ]; then
Expand Down Expand Up @@ -581,6 +578,14 @@ enable_aks_monitoring_addon() {
echo "status after enabling of aks monitoringa addon:$status"
}

# add helm chart repo and update repo to get latest chart version
add_and_update_helm_chart_repo() {
echo "adding helm repo: ${microsoftHelmRepoName} with repo path: ${microsoftHelmRepo}"
helm repo add ${microsoftHelmRepoName} ${microsoftHelmRepo}
echo "updating helm repo: ${microsoftHelmRepoName} to get local charts updated with latest ones"
helm repo update
}

# parse and validate args
parse_args $@

Expand Down Expand Up @@ -644,6 +649,9 @@ else
attach_monitoring_tags
fi

# add helm repo & update to get the latest chart version
add_and_update_helm_chart_repo

# install helm chart
install_helm_chart

Expand Down
44 changes: 27 additions & 17 deletions scripts/onboarding/managed/upgrade-monitoring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
set -e
set -o pipefail

# released chart version for Azure Arc enabled Kubernetes public preview
mcrChartVersion="2.8.3"
mcr="mcr.microsoft.com"
mcrChartRepoPath="azuremonitor/containerinsights/preview/azuremonitor-containers"

# microsoft helm chart repo
microsoftHelmRepo="https://microsoft.github.io/charts/repo"
microsoftHelmRepoName="microsoft"
# default to public cloud since only supported cloud is azure public clod
defaultAzureCloud="AzureCloud"
helmLocalRepoName="."
# microsoft helm chart repo
microsoftHelmRepo="https://microsoft.github.io/charts/repo"
microsoftHelmRepoName="microsoft"
helmChartName="azuremonitor-containers"

# default release name used during onboarding
Expand All @@ -38,6 +38,9 @@ arcK8sResourceProvider="Microsoft.Kubernetes/connectedClusters"
# default of resourceProvider is Azure Arc enabled Kubernetes and this will get updated based on the provider cluster resource
resourceProvider="Microsoft.Kubernetes/connectedClusters"

# resource provider for azure redhat openshift v4 cluster
aroV4ResourceProvider="Microsoft.RedHatOpenShift/OpenShiftClusters"

# Azure Arc enabled Kubernetes cluster resource
isArcK8sCluster=false

Expand Down Expand Up @@ -235,10 +238,14 @@ upgrade_helm_chart_release() {
adminUserName=$(az aro list-credentials -g $clusterResourceGroup -n $clusterName --query 'kubeadminUsername' -o tsv)
adminPassword=$(az aro list-credentials -g $clusterResourceGroup -n $clusterName --query 'kubeadminPassword' -o tsv)
apiServer=$(az aro show -g $clusterResourceGroup -n $clusterName --query apiserverProfile.url -o tsv)
# certain az cli versions adds /r/n so trim them
adminUserName=$(echo $adminUserName |tr -d '"\r\n')
adminPassword=$(echo $adminPassword |tr -d '"\r\n')
apiServer=$(echo $apiServer |tr -d '"\r\n')
echo "login to the cluster via oc login"
oc login $apiServer -u $adminUserName -p $adminPassword
echo "creating project azure-monitor-for-containers"
oc new-project $openshiftProjectName
echo "switching to project azure-monitor-for-containers"
oc project $openshiftProjectName
echo "getting config-context of aro v4 cluster"
kubeconfigContext=$(oc config current-context)
fi
Expand All @@ -249,15 +256,7 @@ upgrade_helm_chart_release() {
echo "installing Azure Monitor for containers HELM chart on to the cluster with kubecontext:${kubeconfigContext} ..."
fi

export HELM_EXPERIMENTAL_OCI=1

echo "pull the chart from ${mcr}/${mcrChartRepoPath}:${mcrChartVersion}"
helm chart pull ${mcr}/${mcrChartRepoPath}:${mcrChartVersion}

echo "export the chart from local cache to current directory"
helm chart export ${mcr}/${mcrChartRepoPath}:${mcrChartVersion} --destination .

helmChartRepoPath=$helmLocalRepoName/$helmChartName
helmChartRepoPath=$microsoftHelmRepoName/$helmChartName

echo "upgrading the release: $releaseName to chart version : ${mcrChartVersion}"
helm get values $releaseName -o yaml | helm upgrade --install $releaseName $helmChartRepoPath -f -
Expand Down Expand Up @@ -296,6 +295,14 @@ validate_and_configure_supported_cloud() {
fi
}

# add helm chart repo and update repo to get latest chart version
add_and_update_helm_chart_repo() {
echo "adding helm repo: ${microsoftHelmRepoName} with repo path: ${microsoftHelmRepo}"
helm repo add ${microsoftHelmRepoName} ${microsoftHelmRepo}
echo "updating helm repo: ${microsoftHelmRepoName} to get local charts updated with latest ones"
helm repo update
}

# parse and validate args
parse_args $@

Expand All @@ -322,6 +329,9 @@ fi
# validate the cluster has monitoring tags
validate_monitoring_tags

# add helm repo & update to get the latest chart version
add_and_update_helm_chart_repo

# upgrade helm chart release
upgrade_helm_chart_release

Expand Down