From 956739bb1212188e6a1c487916300426a477b033 Mon Sep 17 00:00:00 2001 From: Britania Rodriguez Reyes Date: Tue, 5 Nov 2024 15:05:45 -0800 Subject: [PATCH] check if property provider is azure --- charts/member-agent/README.md | 4 ++-- charts/member-agent/templates/cloudconfig.yaml | 4 +++- charts/member-agent/templates/deployment.yaml | 6 +++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/member-agent/README.md b/charts/member-agent/README.md index 6e17757ac..9f4b47048 100644 --- a/charts/member-agent/README.md +++ b/charts/member-agent/README.md @@ -46,7 +46,7 @@ helm upgrade member-agent member-agent/ --namespace fleet-system ## Override Azure cloud config -**If PropertyProvider feature is enabled, then a cloud configuration is required.** +**If PropertyProvider feature is set to azure, then a cloud configuration is required.** Cloud configuration provides resource metadata and credentials for `fleet-member-agent` to manipulate Azure resources. It's embedded into a Kubernetes secret and mounted to the pods. The values can be modified under `config.cloudConfig` section in values.yaml or can be provided as a separate file. @@ -69,7 +69,7 @@ The values can be modified under `config.cloudConfig` section in values.yaml or | `vnetName` | The name of the virtual network where the cluster is deployed. | | | `vnetResourceGroup` | The resource group where the virtual network is deployed. | | -You can create a file `azure.yaml` with the following content, and pass it to `helm install` command: `helm install -f azure.yaml` +You can create a file `azure.yaml` with the following content, and pass it to `helm install` command: `helm install --set propertyProvider=azure -f azure.yaml` ```yaml config: diff --git a/charts/member-agent/templates/cloudconfig.yaml b/charts/member-agent/templates/cloudconfig.yaml index 7b0a34d97..e9f889afd 100644 --- a/charts/member-agent/templates/cloudconfig.yaml +++ b/charts/member-agent/templates/cloudconfig.yaml @@ -1,3 +1,4 @@ +{{- if eq .Values.propertyProvider "azure" }} apiVersion: v1 kind: Secret metadata: @@ -5,4 +6,5 @@ metadata: namespace: {{ .Values.namespace }} type: Opaque data: - config.json: {{ .Values.config.cloudConfig | toJson | indent 4 | b64enc | quote }} \ No newline at end of file + config.json: {{ .Values.config.cloudConfig | toJson | indent 4 | b64enc | quote }} +{{- end }} diff --git a/charts/member-agent/templates/deployment.yaml b/charts/member-agent/templates/deployment.yaml index 64d90e0d3..f08d2d969 100644 --- a/charts/member-agent/templates/deployment.yaml +++ b/charts/member-agent/templates/deployment.yaml @@ -87,9 +87,11 @@ spec: volumeMounts: - name: provider-token mountPath: /config + {{- if eq .Values.propertyProvider "azure" }} - name: cloud-provider-config mountPath: /etc/kubernetes/provider readOnly: true + {{- end }} - name: refresh-token image: "{{ .Values.refreshtoken.repository }}:{{ .Values.refreshtoken.tag }}" imagePullPolicy: {{ .Values.refreshtoken.pullPolicy }} @@ -111,9 +113,11 @@ spec: volumes: - name: provider-token emptyDir: {} + {{- if eq .Values.propertyProvider "azure" }} - name: cloud-provider-config secret: secretName: cloud-config + {{- end }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: @@ -126,4 +130,4 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }}