Skip to content

Commit 78b2aab

Browse files
authored
Gangams/bleu updates (#1477)
* Add Bleu cloud support * Add Bleu cloud support * add Bleu cloud support * improve the code * improve the code * yaml updates * improve the log message * fix bug * improve the code * add unit tests for bash scripts * add unit tests * refactor code * add unit tests * test fixes * test fixes * test fixes * test fixes * fix bug * fix pr feedback * fix pr feedback * invoke new unit tests as part of the PR pipeline * fix test failures * add windows powershell tests to unit tests pipeline * add windows powershell tests to unit tests pipeline * add windows powershell tests to unit tests pipeline * add windows powershell tests to unit tests pipeline * add windows powershell tests to unit tests pipeline * add windows powershell tests to unit tests pipeline * add windows powershell tests to unit tests pipeline
1 parent cb0c36d commit 78b2aab

36 files changed

+1741
-109
lines changed

.github/workflows/run_unit_tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ on:
1010
- ci_dev
1111
- ci_prod
1212
jobs:
13+
Linux-Bash-Tests:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out repository code
17+
uses: actions/checkout@v2
18+
- name: Make test files executable
19+
run: |
20+
chmod +x test/unit-tests/test_main.sh
21+
chmod +x test/unit-tests/test_framework.sh
22+
find test/unit-tests/test_functions -type f -name "*.sh" -exec chmod +x {} \;
23+
find test/unit-tests/test_cases -type f -name "*.sh" -exec chmod +x {} \;
24+
- name: Run Bash unit tests
25+
run: |
26+
cd ${{ github.workspace }}
27+
./test/unit-tests/test_main.sh
28+
1329
Golang-Tests:
1430
runs-on: ubuntu-latest
1531
steps:
@@ -37,3 +53,28 @@ jobs:
3753
run: |
3854
cd ${{ github.workspace }}
3955
./test/unit-tests/run_ruby_tests.sh
56+
57+
Windows-PowerShell-Tests:
58+
runs-on: windows-latest
59+
steps:
60+
- name: Check out repository code
61+
uses: actions/checkout@v2
62+
63+
- name: Setup PowerShell modules
64+
shell: pwsh
65+
run: |
66+
Set-PSRepository PSGallery -InstallationPolicy Trusted
67+
Install-Module -Name Pester -RequiredVersion 5.3.3 -Force -SkipPublisherCheck
68+
Install-Module -Name PSScriptAnalyzer -Force
69+
70+
- name: Set execution policy and Import modules
71+
shell: pwsh
72+
run: |
73+
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
74+
Import-Module Pester -RequiredVersion 5.3.3
75+
76+
- name: Run PowerShell unit tests
77+
shell: pwsh
78+
run: |
79+
cd ${{ github.workspace }}
80+
./test/unit-tests/test_main.ps1

build/common/installer/scripts/tomlparser-geneva-config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
@disable_windows = false
1414
@disable_linux = false
1515

16-
GENEVA_SUPPORTED_ENVIRONMENTS = ["Test", "Stage", "DiagnosticsProd", "FirstpartyProd", "BillingProd", "ExternalProd", "CaMooncake", "CaFairfax", "CaBlackforest"]
17-
@geneva_account_environment = "" # Supported values Test, Stage, DiagnosticsProd, FirstpartyProd, BillingProd, ExternalProd, CaMooncake, CaFairfax, CaBlackforest
16+
GENEVA_SUPPORTED_ENVIRONMENTS = ["Test", "Stage", "DiagnosticsProd", "FirstpartyProd", "BillingProd", "ExternalProd", "CaMooncake", "CaFairfax", "CaBlackforest", "Bleu"]
17+
@geneva_account_environment = "" # Supported values Test, Stage, DiagnosticsProd, FirstpartyProd, BillingProd, ExternalProd, CaMooncake, CaFairfax, CaBlackforest, Bleu
1818
@geneva_account_name = ""
1919
@geneva_account_namespace = ""
2020
@geneva_account_namespace_windows = ""

charts/azuremonitor-containers-geneva/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ replicaCount: 1
77
genevaLogsConfig:
88
aadpodidbinding: "<AAD_POD_IDENTITY_NAME>" # AAD POD Identity Name in case of AAD POD Managed Identity
99
authid: "<client_id#<guid>>" # MUST be in this format: client_id#<guid of the user assigned managed identity>
10-
environment: "<your_geneva_environment_name>" # Supported values Test, Stage, DiagnosticsProd, FirstpartyProd, BillingProd, ExternalProd, CaMooncake, CaFairfax, CaBlackforest
10+
environment: "<your_geneva_environment_name>" # Supported values Test, Stage, DiagnosticsProd, FirstpartyProd, BillingProd, ExternalProd, CaMooncake, CaFairfax, CaBlackforest, Bleu
1111
account: "<your_geneva_account_name>" # name of the Geneva Logs account
1212
namespace: "<your_geneva_account_namespace>" # name of the Geneva Logs account namespace
1313
region: "<your_geneva_account_gcs_region>" # GCS region of the Geneva Logs Account.
@@ -17,7 +17,7 @@ image:
1717
repository: mcr.microsoft.com/azuremonitor/containerinsights/ciprod
1818
tag: "3.1.27"
1919
pullPolicy: IfNotPresent
20-
agentVersion: "azure-mdsd-1.31.4"
20+
agentVersion: "azure-mdsd-1.35.1"
2121
nameOverride: ""
2222
enableInternalMetrics: false
2323
enableKubernetesMetadata: false

charts/azuremonitor-containers/templates/ama-logs-arc-k8s-crd.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ spec:
2323
audience: https://monitor.azure.com/
2424
{{- else if eq (.Values.Azure.Cluster.Cloud | lower) "azurechinacloud" }}
2525
audience: https://monitor.azure.cn/
26+
{{- else if eq (.Values.Azure.Cluster.Cloud | lower) "bleu" }}
27+
audience: https://monitor.sovcloud-api.fr/
2628
{{- else if eq (.Values.Azure.Cluster.Cloud | lower) "azureusgovernmentcloud" }}
2729
audience: https://monitor.azure.us/
2830
{{- else if and .Values.amalogs.isArcACluster (ne .Values.amalogs.tokenAudience "<your_token_audience>") }}

charts/azuremonitor-containers/templates/ama-logs-daemonset-windows.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ spec:
109109
- name: AZMON_KUBERNETES_METADATA_ENABLED
110110
value: "true"
111111
{{- end }}
112+
- name: CLUSTER_CLOUD_ENVIRONMENT
113+
value: "{{ .Values.Azure.Cluster.Cloud | lower }}"
112114
volumeMounts:
113115
# Uncomment when telegraf upgraded to 1.28.5 or higher
114116
# {{- if .Values.amalogs.enableServiceAccountTimeBoundToken }}

charts/azuremonitor-containers/templates/ama-logs-daemonset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ spec:
139139
- name: AZMON_TELEGRAF_LIVENESSPROBE_ENABLED
140140
value: {{ .Values.amalogs.enableTelegrafLivenessprobe | quote }}
141141
{{- end }}
142+
- name: CLUSTER_CLOUD_ENVIRONMENT
143+
value: "{{ .Values.Azure.Cluster.Cloud | lower }}"
142144
- name: HOSTNAME
143145
valueFrom:
144146
fieldRef:
@@ -251,6 +253,8 @@ spec:
251253
valueFrom:
252254
fieldRef:
253255
fieldPath: spec.nodeName
256+
- name: CLUSTER_CLOUD_ENVIRONMENT
257+
value: "{{ .Values.Azure.Cluster.Cloud | lower }}"
254258
securityContext:
255259
privileged: true
256260
capabilities:

charts/azuremonitor-containers/templates/ama-logs-deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ spec:
126126
valueFrom:
127127
fieldRef:
128128
fieldPath: spec.nodeName
129+
- name: CLUSTER_CLOUD_ENVIRONMENT
130+
value: "{{ .Values.Azure.Cluster.Cloud | lower }}"
129131
securityContext:
130132
privileged: true
131133
capabilities:

charts/azuremonitor-containers/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ amalogs:
2828
tagWindows: "win-3.1.27"
2929
pullPolicy: IfNotPresent
3030
dockerProviderVersion: "18.0.1-0"
31-
agentVersion: "azure-mdsd-1.31.4"
31+
agentVersion: "azure-mdsd-1.35.1"
3232
winAgentVersion: "46.17.2" # there is no base agent version for windows agent
3333

3434
# The priority used by the ama-logs priority class for the daemonset pods

kubernetes/ama-logs.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ spec:
459459
value: "28331"
460460
- name: AZMON_RETINA_FLOW_LOGS_ENABLED
461461
value: "false"
462+
- name: CLUSTER_CLOUD_ENVIRONMENT
463+
value: "azurepubliccloud" # Change this to the cloud environment of your cluster
462464
securityContext:
463465
privileged: true
464466
capabilities:
@@ -576,6 +578,8 @@ spec:
576578
# Uncomment below lines for MSI Auth Mode testing
577579
# - name: USING_AAD_MSI_AUTH
578580
# value: "true"
581+
- name: CLUSTER_CLOUD_ENVIRONMENT
582+
value: "azurepubliccloud" # Change this to the cloud environment of your cluster
579583
securityContext:
580584
privileged: true
581585
capabilities:
@@ -863,6 +867,8 @@ spec:
863867
# fieldPath: status.hostIP
864868
# - name: USING_AAD_MSI_AUTH
865869
# value: "true"
870+
# - name: CLUSTER_CLOUD_ENVIRONMENT
871+
# value: "azurepubliccloud" # Change this to the cloud environment of your cluster
866872
# securityContext:
867873
# privileged: true
868874
# capabilities:
@@ -1104,6 +1110,8 @@ spec:
11041110
value: "false"
11051111
- name: AZMON_WINDOWS_FLUENT_BIT_ENABLED
11061112
value: "false"
1113+
- name: CLUSTER_CLOUD_ENVIRONMENT
1114+
value: "azurepubliccloud" # Change this to the cloud environment of your cluster
11071115
securityContext:
11081116
privileged: true
11091117
capabilities:
@@ -1364,6 +1372,8 @@ spec:
13641372
value: "false"
13651373
- name: APPMONITORING_OPENTELEMETRYLOGS_PORT
13661374
value: "28331"
1375+
- name: CLUSTER_CLOUD_ENVIRONMENT
1376+
value: "azurepubliccloud" # Change this to the cloud environment of your cluster
13671377
volumeMounts:
13681378
# Uncomment below lines when telegraf upgraded to 1.28.5 or higher
13691379
# - name: kube-api-access

kubernetes/linux/main.sh

Lines changed: 66 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,60 @@ startTime=$(date +%s)
55

66
echo "startup script start @ $(date +'%Y-%m-%dT%H:%M:%S')"
77

8+
# Supported cloud environments
9+
SUPPORTED_CLOUDS=("azurepubliccloud" "azurechinacloud" "azureusgovernmentcloud" "usnat" "ussec" "bleu")
10+
11+
getDomainFromSecret() {
12+
# Read the domain from the AMA logs secret and convert to lowercase
13+
domain="opinsights.azure.com"
14+
if [ -e "/etc/ama-logs-secret/DOMAIN" ]; then
15+
domain=$(cat /etc/ama-logs-secret/DOMAIN)
16+
fi
17+
# Convert to lowercase
18+
domain=$(echo "$domain" | tr '[:upper:]' '[:lower:]')
19+
echo "$domain"
20+
}
21+
22+
getClusterCloudEnvironment() {
23+
# Use provided cloud environment variable if it's set and valid
24+
if [ -n "$CLUSTER_CLOUD_ENVIRONMENT" ]; then
25+
CLUSTER_CLOUD_ENVIRONMENT=$(echo "$CLUSTER_CLOUD_ENVIRONMENT" | tr '[:upper:]' '[:lower:]')
26+
for cloud in "${SUPPORTED_CLOUDS[@]}"; do
27+
if [ "$CLUSTER_CLOUD_ENVIRONMENT" == "$cloud" ]; then
28+
echo "$CLUSTER_CLOUD_ENVIRONMENT"
29+
return
30+
fi
31+
done
32+
fi
33+
34+
# Fallback to reading from the AMA logs secret if CLUSTER_CLOUD_ENVIRONMENT is not set or invalid
35+
domain=$(getDomainFromSecret)
36+
# Map domain to cloud environment
37+
case "$domain" in
38+
"opinsights.azure.com")
39+
echo "azurepubliccloud"
40+
;;
41+
"opinsights.azure.cn")
42+
echo "azurechinacloud"
43+
;;
44+
"opinsights.azure.us")
45+
echo "azureusgovernmentcloud"
46+
;;
47+
"opinsights.azure.eaglex.ic.gov")
48+
echo "usnat"
49+
;;
50+
"opinsights.azure.microsoft.scloud")
51+
echo "ussec"
52+
;;
53+
"opinsights.sovcloud-api.fr")
54+
echo "bleu"
55+
;;
56+
""|*)
57+
echo "unknown"
58+
;;
59+
esac
60+
}
61+
862
startAMACoreAgent() {
963
echo "AMACoreAgent: Starting AMA Core Agent since High Log scale mode is enabled"
1064

@@ -74,6 +128,15 @@ setCloudSpecificApplicationInsightsConfig() {
74128
echo "export APPLICATIONINSIGHTS_ENDPOINT=$APPLICATIONINSIGHTS_ENDPOINT" >>~/.bashrc
75129
source ~/.bashrc
76130
;;
131+
"bleu")
132+
# TODO: Bleu cloud is a new cloud environment, we don't have AI in this cloud yet so using Public cloud for now.
133+
# Update this once we have AI in Bleu cloud.
134+
APPLICATIONINSIGHTS_AUTH="NzAwZGM5OGYtYTdhZC00NThkLWI5NWMtMjA3ZjM3NmM3YmRi"
135+
APPLICATIONINSIGHTS_ENDPOINT="https://dc.applicationinsights.azure.com/v2/track"
136+
echo "export APPLICATIONINSIGHTS_AUTH=$APPLICATIONINSIGHTS_AUTH" >>~/.bashrc
137+
echo "export APPLICATIONINSIGHTS_ENDPOINT=$APPLICATIONINSIGHTS_ENDPOINT" >>~/.bashrc
138+
source ~/.bashrc
139+
;;
77140
*)
78141
echo "default is Public cloud"
79142
;;
@@ -455,28 +518,11 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ] && [ "${GENEVA_LOGS_INTEGRATIO
455518
done
456519
source integration_npm_config_env_var
457520
fi
458-
if [ -e "/etc/ama-logs-secret/DOMAIN" ]; then
459-
domain=$(cat /etc/ama-logs-secret/DOMAIN)
460-
else
461-
domain="opinsights.azure.com"
462-
fi
463521

464-
# Set environment variable for if public cloud by checking the workspace domain.
465-
if [ -z $domain ]; then
466-
CLOUD_ENVIRONMENT="unknown"
467-
elif [ $domain == "opinsights.azure.com" ]; then
468-
CLOUD_ENVIRONMENT="azurepubliccloud"
469-
elif [ $domain == "opinsights.azure.cn" ]; then
470-
CLOUD_ENVIRONMENT="azurechinacloud"
471-
elif [ $domain == "opinsights.azure.us" ]; then
472-
CLOUD_ENVIRONMENT="azureusgovernmentcloud"
473-
elif [ $domain == "opinsights.azure.eaglex.ic.gov" ]; then
474-
CLOUD_ENVIRONMENT="usnat"
475-
elif [ $domain == "opinsights.azure.microsoft.scloud" ]; then
476-
CLOUD_ENVIRONMENT="ussec"
477-
fi
478-
export CLOUD_ENVIRONMENT=$CLOUD_ENVIRONMENT
522+
export domain=$(getDomainFromSecret)
523+
export CLOUD_ENVIRONMENT=$(getClusterCloudEnvironment)
479524
echo "export CLOUD_ENVIRONMENT=$CLOUD_ENVIRONMENT" >>~/.bashrc
525+
echo "Cluster Cloud Environment: $CLOUD_ENVIRONMENT"
480526

481527
export PROXY_ENDPOINT=""
482528
# Check for internet connectivity or workspace deletion

0 commit comments

Comments
 (0)