Skip to content

Commit 4c0645b

Browse files
authored
Gangams/workload identity geneva (#1543)
* add workload identity support for geneva app logs * workload identity support * workload identity support for geneva path * revert values yaml changes used for test * improve code * workload identity support * workload identity support
1 parent 45530fa commit 4c0645b

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

charts/azuremonitor-containers-geneva/templates/deployment.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ spec:
2020
agentVersion: {{ .Values.image.agentVersion }}
2121
labels:
2222
rsName: "ama-logs-geneva"
23+
{{- if eq (.Values.genevaLogsConfig.authidType | lower) "authworkloadidentity" }}
24+
azure.workload.identity/use: "true"
25+
{{- else }}
2326
aadpodidbinding: {{ .Values.genevaLogsConfig.aadpodidbinding }}
27+
{{- end }}
2428
spec:
2529
{{- with .Values.affinity }}
2630
affinity: {{- toYaml . | nindent 8 }}
2731
{{- end }}
2832
# terminationGracePeriodSeconds: 45
33+
{{- if eq (.Values.genevaLogsConfig.authidType | lower) "authworkloadidentity" }}
34+
serviceAccountName: {{ .Values.genevaLogsConfig.serviceAccountName | quote }}
35+
{{- end }}
2936
containers:
3037
- name: ama-logs-geneva
3138
image: {{ printf "%s:%s" .Values.image.repository .Values.image.tag }}
@@ -61,10 +68,15 @@ spec:
6168
value: {{ .Values.genevaLogsConfig.namespace | quote }}
6269
- name: MONITORING_CONFIG_VERSION
6370
value: {{ .Values.genevaLogsConfig.configversion | quote }}
71+
{{- if eq (.Values.genevaLogsConfig.authidType | lower) "authworkloadidentity" }}
72+
- name: MONITORING_GCS_AUTH_ID_TYPE
73+
value: "AuthWorkloadIdentity"
74+
{{- else }}
6475
- name: MONITORING_GCS_AUTH_ID_TYPE
6576
value: "AuthMSIToken"
6677
- name: MONITORING_GCS_AUTH_ID
67-
value: {{ .Values.genevaLogsConfig.authid | quote }}
78+
value: {{ .Values.genevaLogsConfig.authid | quote }}
79+
{{- end }}
6880
- name: MONITORING_GCS_REGION
6981
value: {{ .Values.genevaLogsConfig.region | quote }}
7082
- name: MONITORING_USE_GENEVA_CONFIG_SERVICE
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{- if eq (.Values.genevaLogsConfig.authidType | lower) "authworkloadidentity" }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
annotations:
6+
azure.workload.identity/client-id: {{ trimPrefix "client_id#" .Values.genevaLogsConfig.authid | quote }}
7+
name: {{ .Values.genevaLogsConfig.serviceAccountName | quote}}
8+
{{- end }}

charts/azuremonitor-containers-geneva/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
replicaCount: 1
66

77
genevaLogsConfig:
8+
authidType: "AuthMSIToken" # supported values AuthMSIToken or AuthWorkloadIdentity and recommended to use AuthWorkloadIdentity
89
aadpodidbinding: "<AAD_POD_IDENTITY_NAME>" # AAD POD Identity Name in case of AAD POD Managed Identity
910
authid: "<client_id#<guid>>" # MUST be in this format: client_id#<guid of the user assigned managed identity>
1011
environment: "<your_geneva_environment_name>" # Supported values Test, Stage, DiagnosticsProd, FirstpartyProd, BillingProd, ExternalProd, CaMooncake, CaFairfax, CaBlackforest, Bleu
1112
account: "<your_geneva_account_name>" # name of the Geneva Logs account
1213
namespace: "<your_geneva_account_namespace>" # name of the Geneva Logs account namespace
1314
region: "<your_geneva_account_gcs_region>" # GCS region of the Geneva Logs Account.
1415
configversion: "<your_geneva_config_version>" # config version of the agent xml config.
16+
serviceAccountName: "ama-logs-geneva" # Service Account Name in case of AuthWorkloadIdentity. This account with k8snamespace MUST be have federated credential configured in the User Assigned Managed Identity. https://learn.microsoft.com/en-us/azure/aks/workload-identity-deploy-cluster#create-the-federated-identity-credential
1517

1618
image:
1719
repository: mcr.microsoft.com/azuremonitor/containerinsights/ciprod

kubernetes/linux/main.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,8 +1002,13 @@ if [ "${CONTAINER_TYPE}" != "PrometheusSidecar" ] && isGenevaMode; then
10021002
echo "Runnning AMA in Geneva Logs Integration Mode"
10031003
export MONITORING_USE_GENEVA_CONFIG_SERVICE=true
10041004
echo "export MONITORING_USE_GENEVA_CONFIG_SERVICE=true" >> ~/.bashrc
1005-
export MONITORING_GCS_AUTH_ID_TYPE=AuthMSIToken
1006-
echo "export MONITORING_GCS_AUTH_ID_TYPE=AuthMSIToken" >> ~/.bashrc
1005+
if [ "${MONITORING_GCS_AUTH_ID_TYPE}" = "AuthWorkloadIdentity" ]; then
1006+
echo "Using AuthWorkloadIdentity for MONITORING_GCS_AUTH_ID_TYPE"
1007+
else
1008+
export MONITORING_GCS_AUTH_ID_TYPE=AuthMSIToken
1009+
echo "export MONITORING_GCS_AUTH_ID_TYPE=AuthMSIToken" >> ~/.bashrc
1010+
echo "Using AuthMSIToken for MONITORING_GCS_AUTH_ID_TYPE"
1011+
fi
10071012
MDSD_AAD_MSI_AUTH_ARGS="-A"
10081013
# except logs, all other data types ingested via sidecar container MDSD port
10091014
export MDSD_FLUENT_SOCKET_PORT="26230"

0 commit comments

Comments
 (0)