[home-assistant] Adds control over vscode image arguments (#75)

* Added ability to control vscode arguments

Signed-off-by: Richard Cox <cox.richard200@gmail.com>

* Fixed helpers function to handle null and empty string vscode.args value

Signed-off-by: Richard Cox <cox.richard200@gmail.com>

Co-authored-by: Jeff Billimek <jeff@billimek.com>
This commit is contained in:
Richard Cox 2020-09-29 14:45:50 -05:00 committed by GitHub
parent 6104d0bc80
commit c516c4e05d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 10 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 0.115.2
description: Home Assistant
name: home-assistant
version: 2.4.1
version: 2.5.0
keywords:
- home-assistant
- hass

View File

@ -135,6 +135,7 @@ The following tables lists the configurable parameters of the Home Assistant cha
| `vscode.vscodePath` | Base path of the VS Code configuration files | `/config/.vscode` |
| `vscode.password` | If this is set, will require a password to access the VS Code Server UI | `` |
| `vscode.extraEnv` | Extra ENV vars to pass to the configuration UI | `{}` |
| `vscode.args` | Optional arguments to pass into vscode image. Defaulting to "-" uses default arguments. | `-` |
| `vscode.ingress.enabled` | Enables Ingress for the VS Code UI | `false` |
| `vscode.ingress.annotations` | Ingress annotations for the VS Code UI | `{}` |
| `vscode.ingress.hosts` | Ingress accepted hostnames for the VS Code UI | `chart-example.local` |

View File

@ -30,3 +30,24 @@ Create chart name and version as used by the chart label.
{{- define "home-assistant.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create argument list for vscode image.
*/}}
{{- define "home-assistant.vscode.args" -}}
{{- if empty .Values.vscode.args -}}
{{- "" -}}
{{- else if (eq (typeOf .Values.vscode.args) "string") -}}
- --port={{ .Values.vscode.service.port }}
{{- if not (.Values.vscode.password) }}
- --auth=none
{{- end }}
{{- if .Values.vscode.vscodePath }}
- --extensions-dir={{ .Values.vscode.vscodePath }}
- --user-data-dir={{ .Values.vscode.vscodePath }}
- {{ .Values.vscode.hassConfig }}
{{- end }}
{{- else -}}
{{ toYaml .Values.vscode.args }}
{{- end -}}
{{- end -}}

View File

@ -1,3 +1,4 @@
{{- $args := include "home-assistant.vscode.args" . -}}
apiVersion: apps/v1
kind: Deployment
metadata:
@ -273,15 +274,9 @@ spec:
imagePullPolicy: {{ .Values.vscode.image.pullPolicy }}
workingDir: {{ .Values.vscode.hassConfig }}
args:
- --port={{ .Values.vscode.service.port }}
{{- if not (.Values.vscode.password) }}
- --auth=none
{{- end }}
{{- if .Values.vscode.vscodePath }}
- --extensions-dir={{ .Values.vscode.vscodePath }}
- --user-data-dir={{ .Values.vscode.vscodePath }}
- {{ .Values.vscode.hassConfig }}
{{- end }}
{{- with $args }}
{{ . | indent 12 }}
{{- end }}
ports:
- name: vscode
containerPort: {{ .Values.vscode.service.port }}

View File

@ -250,6 +250,10 @@ vscode:
##
extraEnv: {}
## Set to "-" to use default argument list
## Otherwise convert to list of arguments
args: "-"
ingress:
enabled: false
annotations: {}