From 123a1b37c2bf43a6d72b1762faf590df08633920 Mon Sep 17 00:00:00 2001 From: Jacob LeGrone Date: Thu, 19 Jul 2018 20:45:37 -0400 Subject: [PATCH] Require ACI region/resource group only for non-AKS deployments --- charts/virtual-kubelet/templates/deployment.yaml | 16 +++++++++------- charts/virtual-kubelet/templates/secret.yaml | 2 +- charts/virtual-kubelet/values.yaml | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/charts/virtual-kubelet/templates/deployment.yaml b/charts/virtual-kubelet/templates/deployment.yaml index 0d07189ea..93b2ad6ce 100644 --- a/charts/virtual-kubelet/templates/deployment.yaml +++ b/charts/virtual-kubelet/templates/deployment.yaml @@ -4,8 +4,6 @@ metadata: name: {{ template "vk.fullname" . }} {{ include "vk.labels" . | indent 2 }} component: kubelet - annotations: - virtual-kubelet/provider: {{ required "provider is required" .Values.provider }} spec: replicas: 1 template: @@ -32,10 +30,6 @@ spec: fieldPath: status.podIP {{- if eq .Values.provider "azure" }} {{- with .Values.providers.azure }} - - name: ACI_RESOURCE_GROUP - value: {{ required "aciResourceGroup is required" .aciResourceGroup }} - - name: ACI_REGION - value: {{ required "aciRegion is required" .aciRegion }} {{- if .loganalytics.enabled }} - name: LOG_ANALYTICS_AUTH_LOCATION value: /etc/virtual-kubelet/loganalytics.json @@ -54,9 +48,17 @@ spec: secretKeyRef: name: {{ template "vk.fullname" $ }} key: clientSecret + - name: ACI_RESOURCE_GROUP + value: {{ .aciResourceGroup }} + - name: ACI_REGION + value: {{ .aciRegion }} {{- else }} - name: AZURE_AUTH_LOCATION value: /etc/virtual-kubelet/credentials.json + - name: ACI_RESOURCE_GROUP + value: {{ required "aciResourceGroup is required" .aciResourceGroup }} + - name: ACI_REGION + value: {{ required "aciRegion is required" .aciRegion }} {{- end }} {{- end }} {{- end }} @@ -71,7 +73,7 @@ spec: {{- end }} command: ["virtual-kubelet"] args: [ - "--provider", "{{ .Values.provider }}", + "--provider", "{{ required "provider is required" .Values.provider }}", "--namespace", "{{ .Values.monitoredNamespace }}", "--nodename", "{{ required "nodeName is required" .Values.nodeName }}", "--os", "{{ .Values.nodeOsType }}", diff --git a/charts/virtual-kubelet/templates/secret.yaml b/charts/virtual-kubelet/templates/secret.yaml index 7df587009..3ee607a46 100644 --- a/charts/virtual-kubelet/templates/secret.yaml +++ b/charts/virtual-kubelet/templates/secret.yaml @@ -23,7 +23,7 @@ data: loganalytics.json: {{ printf "{\"workspaceID\": \"%s\",\"workspaceKey\": \"%s\"}" (required "workspaceID is required for loganalytics" .loganalytics.workspaceID ) (required "workspaceKey is required for loganalytics" .loganalytics.workspaceKey ) }} {{- end }} {{- if .targetAKS }} - clientSecret: {{ required "clientKey is required" .clientKey | b64enc | quote }} + clientSecret: {{ default "" .clientKey | b64enc | quote }} {{- else }} credentials.json: {{ printf "{ \"clientId\": \"%s\", \"clientSecret\": \"%s\", \"subscriptionId\": \"%s\", \"tenantId\": \"%s\", \"activeDirectoryEndpointUrl\": \"https://login.microsoftonline.com/\", \"resourceManagerEndpointUrl\": \"https://management.azure.com/\", \"activeDirectoryGraphResourceId\": \"https://graph.windows.net/\", \"sqlManagementEndpointUrl\": \"database.windows.net\", \"galleryEndpointUrl\": \"https://gallery.azure.com/\", \"managementEndpointUrl\": \"https://management.core.windows.net/\" }" (default "MISSING" .clientId) (default "MISSING" .clientKey) (default "MISSING" .subscriptionId) (default "MISSING" .tenantId) | b64enc | quote }} {{- end }} diff --git a/charts/virtual-kubelet/values.yaml b/charts/virtual-kubelet/values.yaml index b874909a6..822a85cdc 100644 --- a/charts/virtual-kubelet/values.yaml +++ b/charts/virtual-kubelet/values.yaml @@ -20,8 +20,9 @@ providers: clientKey: tenantId: subscriptionId: + ## `aciResourceGroup` and `aciRegion` are required only for non-AKS deployments aciResourceGroup: - aciRegion: "westus" + aciRegion: loganalytics: enabled: false workspaceID: