Skip to content

Commit

Permalink
check if property provider is azure
Browse files Browse the repository at this point in the history
  • Loading branch information
britaniar committed Nov 5, 2024
1 parent 1a95097 commit 956739b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions charts/member-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 <release-name> <chart-name> -f azure.yaml`
You can create a file `azure.yaml` with the following content, and pass it to `helm install` command: `helm install <release-name> <chart-name> --set propertyProvider=azure -f azure.yaml`

```yaml
config:
Expand Down
4 changes: 3 additions & 1 deletion charts/member-agent/templates/cloudconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{{- if eq .Values.propertyProvider "azure" }}
apiVersion: v1
kind: Secret
metadata:
name: cloud-config
namespace: {{ .Values.namespace }}
type: Opaque
data:
config.json: {{ .Values.config.cloudConfig | toJson | indent 4 | b64enc | quote }}
config.json: {{ .Values.config.cloudConfig | toJson | indent 4 | b64enc | quote }}
{{- end }}
6 changes: 5 additions & 1 deletion charts/member-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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:
Expand All @@ -126,4 +130,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

0 comments on commit 956739b

Please sign in to comment.