diff --git a/charts/apps/piped/templates/backend/ingress.yaml b/charts/apps/piped/templates/backend/ingress.yaml new file mode 100644 index 0000000..adde5cf --- /dev/null +++ b/charts/apps/piped/templates/backend/ingress.yaml @@ -0,0 +1,76 @@ +--- +{{- if .Values.ingress.backend.enabled }} + {{- $fullName := include "common.names.fullname" . -}} + {{- $ingressName := $fullName -}} + {{- $values := .Values.ingress.backend -}} + + {{- if hasKey . "ObjectValues" -}} + {{- with .ObjectValues.ingress -}} + {{- $values = . -}} + {{- end -}} + {{ end -}} + + {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} + {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} + {{- end -}} + + {{- $primaryService := .Values.backend.service.main -}} + {{- $defaultServiceName := "piped-backend" -}} + {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} + {{- $isStable := include "common.capabilities.ingress.isStable" . }} + --- +apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ $ingressName }}-backend + {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} + {{- end }} + {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and $isStable $values.ingressClassName }} + ingressClassName: {{ $values.ingressClassName }} + {{- end }} + {{- if $values.tls }} + tls: + {{- range $values.tls }} + - hosts: + {{- range .hosts }} + - {{ tpl . $ | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ tpl .secretName $ | quote}} + {{- end }} + {{- end }} + {{- end }} + rules: + {{- range $values.hosts }} + - host: {{ tpl .host $ | quote }} + http: + paths: + {{- range .paths }} + {{- $service := $defaultServiceName -}} + {{- $port := $defaultServicePort.port -}} + {{- if .service -}} + {{- $service = default $service .service.name -}} + {{- $port = default $port .service.port -}} + {{- end }} + - path: {{ tpl .path $ | quote }} + {{- if $isStable }} + pathType: {{ default "Prefix" .pathType }} + {{- end }} + backend: + {{- if $isStable }} + service: + name: {{ $service }} + port: + number: {{ $port }} + {{- else }} + serviceName: {{ $service }} + servicePort: {{ $port }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/apps/piped/templates/frontend/ingress.yaml b/charts/apps/piped/templates/frontend/ingress.yaml new file mode 100644 index 0000000..8b048e1 --- /dev/null +++ b/charts/apps/piped/templates/frontend/ingress.yaml @@ -0,0 +1,76 @@ +--- +{{- if .Values.ingress.main.enabled }} + {{- $fullName := include "common.names.fullname" . -}} + {{- $ingressName := $fullName -}} + {{- $values := .Values.ingress.main -}} + + {{- if hasKey . "ObjectValues" -}} + {{- with .ObjectValues.ingress -}} + {{- $values = . -}} + {{- end -}} + {{ end -}} + + {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} + {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} + {{- end -}} + + {{- $primaryService := .Values.frontend.service.main -}} + {{- $defaultServiceName := "piped-frontend" -}} + {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} + {{- $isStable := include "common.capabilities.ingress.isStable" . }} +--- +apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ $ingressName }} +{{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} +{{- end }} +{{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} + annotations: {{- toYaml . | nindent 4 }} +{{- end }} +spec: +{{- if and $isStable $values.ingressClassName }} + ingressClassName: {{ $values.ingressClassName }} +{{- end }} +{{- if $values.tls }} + tls: + {{- range $values.tls }} + - hosts: + {{- range .hosts }} + - {{ tpl . $ | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ tpl .secretName $ | quote}} + {{- end }} + {{- end }} +{{- end }} + rules: +{{- range $values.hosts }} + - host: {{ tpl .host $ | quote }} + http: + paths: + {{- range .paths }} + {{- $service := $defaultServiceName -}} + {{- $port := $defaultServicePort.port -}} + {{- if .service -}} + {{- $service = default $service .service.name -}} + {{- $port = default $port .service.port -}} + {{- end }} + - path: {{ tpl .path $ | quote }} + {{- if $isStable }} + pathType: {{ default "Prefix" .pathType }} + {{- end }} + backend: + {{- if $isStable }} + service: + name: {{ $service }} + port: + number: {{ $port }} + {{- else }} + serviceName: {{ $service }} + servicePort: {{ $port }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/apps/piped/templates/frontend/lib/_env_vars.tpl b/charts/apps/piped/templates/frontend/lib/_env_vars.tpl index 84ad387..308d4fe 100644 --- a/charts/apps/piped/templates/frontend/lib/_env_vars.tpl +++ b/charts/apps/piped/templates/frontend/lib/_env_vars.tpl @@ -2,7 +2,7 @@ Environment variables used by containers. */}} {{- define "frontend.controller.env_vars" -}} - {{- $values := merge .Values.frontend.env .Values.common_env -}} + {{- $values := merge .Values.frontend.env -}} {{- if hasKey . "ObjectValues" -}} {{- with .ObjectValues.env -}} {{- $values = . -}} diff --git a/charts/apps/piped/templates/ingress.yaml b/charts/apps/piped/templates/ingress.yaml deleted file mode 100644 index 1e1de5c..0000000 --- a/charts/apps/piped/templates/ingress.yaml +++ /dev/null @@ -1,228 +0,0 @@ ---- -{{- if .Values.ingress.main.enabled }} - {{- $fullName := include "common.names.fullname" . -}} - {{- $ingressName := $fullName -}} - {{- $values := .Values.ingress.main -}} - - {{- if hasKey . "ObjectValues" -}} - {{- with .ObjectValues.ingress -}} - {{- $values = . -}} - {{- end -}} - {{ end -}} - - {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} - {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} - {{- end -}} - - {{- $primaryService := .Values.frontend.service.main -}} - {{- $defaultServiceName := "piped-frontend" -}} - {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} - {{- $isStable := include "common.capabilities.ingress.isStable" . }} - --- - apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} - kind: Ingress - metadata: - name: {{ $ingressName }} - {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} - labels: {{- toYaml . | nindent 4 }} - {{- end }} - {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }} - annotations: {{- toYaml . | nindent 4 }} - {{- end }} - spec: - {{- if and $isStable $values.ingressClassName }} - ingressClassName: {{ $values.ingressClassName }} - {{- end }} - {{- if $values.tls }} - tls: - {{- range $values.tls }} - - hosts: - {{- range .hosts }} - - {{ tpl . $ | quote }} - {{- end }} - {{- if .secretName }} - secretName: {{ tpl .secretName $ | quote}} - {{- end }} - {{- end }} - {{- end }} - rules: - {{- range $values.hosts }} - - host: {{ tpl .host $ | quote }} - http: - paths: - {{- range .paths }} - {{- $service := $defaultServiceName -}} - {{- $port := $defaultServicePort.port -}} - {{- if .service -}} - {{- $service = default $service .service.name -}} - {{- $port = default $port .service.port -}} - {{- end }} - - path: {{ tpl .path $ | quote }} - {{- if $isStable }} - pathType: {{ default "Prefix" .pathType }} - {{- end }} - backend: - {{- if $isStable }} - service: - name: {{ $service }} - port: - number: {{ $port }} - {{- else }} - serviceName: {{ $service }} - servicePort: {{ $port }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} ---- -{{- if .Values.ingress.backend.enabled }} - {{- $fullName := include "common.names.fullname" . -}} - {{- $ingressName := $fullName -}} - {{- $values := .Values.ingress.backend -}} - - {{- if hasKey . "ObjectValues" -}} - {{- with .ObjectValues.ingress -}} - {{- $values = . -}} - {{- end -}} - {{ end -}} - - {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} - {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} - {{- end -}} - - {{- $primaryService := .Values.ytproxy.service.main -}} - {{- $defaultServiceName := "piped-backend" -}} - {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} - {{- $isStable := include "common.capabilities.ingress.isStable" . }} - --- -apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} -kind: Ingress -metadata: - name: {{ $ingressName }} - {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} - labels: {{- toYaml . | nindent 4 }} - {{- end }} - {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml) (include "backend.classes.ingress" $ | fromYaml)) }} - annotations: {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and $isStable $values.ingressClassName }} - ingressClassName: {{ $values.ingressClassName }} - {{- end }} - {{- if $values.tls }} - tls: - {{- range $values.tls }} - - hosts: - {{- range .hosts }} - - {{ tpl . $ | quote }} - {{- end }} - {{- if .secretName }} - secretName: {{ tpl .secretName $ | quote}} - {{- end }} - {{- end }} - {{- end }} - rules: - {{- range $values.hosts }} - - host: {{ tpl .host $ | quote }} - http: - paths: - {{- range .paths }} - {{- $service := $defaultServiceName -}} - {{- $port := $defaultServicePort.port -}} - {{- if .service -}} - {{- $service = default $service .service.name -}} - {{- $port = default $port .service.port -}} - {{- end }} - - path: {{ tpl .path $ | quote }} - {{- if $isStable }} - pathType: {{ default "Prefix" .pathType }} - {{- end }} - backend: - {{- if $isStable }} - service: - name: {{ $service }} - port: - number: {{ $port }} - {{- else }} - serviceName: {{ $service }} - servicePort: {{ $port }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} ---- -{{- if .Values.ingress.ytproxy.enabled }} - {{- $fullName := include "common.names.fullname" . -}} - {{- $ingressName := $fullName -}} - {{- $values := .Values.ingress.ytproxy -}} - - {{- if hasKey . "ObjectValues" -}} - {{- with .ObjectValues.ingress -}} - {{- $values = . -}} - {{- end -}} - {{ end -}} - - {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} - {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} - {{- end -}} - - {{- $primaryService := .Values.ytproxy.service.main -}} - {{- $defaultServiceName := "piped-ytproxy" -}} - {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} - {{- $isStable := include "common.capabilities.ingress.isStable" . }} - --- - apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} - kind: Ingress - metadata: - name: {{ $ingressName }} - {{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} - labels: {{- toYaml . | nindent 4 }} - {{- end }} - {{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml) (include "ytproxy.classes.ingress" $ | fromYaml)) }} - annotations: {{- toYaml . | nindent 4 }} - {{- end }} - spec: - {{- if and $isStable $values.ingressClassName }} - ingressClassName: {{ $values.ingressClassName }} - {{- end }} - {{- if $values.tls }} - tls: - {{- range $values.tls }} - - hosts: - {{- range .hosts }} - - {{ tpl . $ | quote }} - {{- end }} - {{- if .secretName }} - secretName: {{ tpl .secretName $ | quote}} - {{- end }} - {{- end }} - {{- end }} - rules: - {{- range $values.hosts }} - - host: {{ tpl .host $ | quote }} - http: - paths: - {{- range .paths }} - {{- $service := $defaultServiceName -}} - {{- $port := $defaultServicePort.port -}} - {{- if .service -}} - {{- $service = default $service .service.name -}} - {{- $port = default $port .service.port -}} - {{- end }} - - path: {{ tpl .path $ | quote }} - {{- if $isStable }} - pathType: {{ default "Prefix" .pathType }} - {{- end }} - backend: - {{- if $isStable }} - service: - name: {{ $service }} - port: - number: {{ $port }} - {{- else }} - serviceName: {{ $service }} - servicePort: {{ $port }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} \ No newline at end of file diff --git a/charts/apps/piped/templates/ytproxy/ingress.yaml b/charts/apps/piped/templates/ytproxy/ingress.yaml new file mode 100644 index 0000000..cd08fc0 --- /dev/null +++ b/charts/apps/piped/templates/ytproxy/ingress.yaml @@ -0,0 +1,76 @@ +--- +{{- if .Values.ingress.ytproxy.enabled }} + {{- $fullName := include "common.names.fullname" . -}} + {{- $ingressName := $fullName -}} + {{- $values := .Values.ingress.ytproxy -}} + + {{- if hasKey . "ObjectValues" -}} + {{- with .ObjectValues.ingress -}} + {{- $values = . -}} + {{- end -}} + {{ end -}} + + {{- if and (hasKey $values "nameOverride") $values.nameOverride -}} + {{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}} + {{- end -}} + + {{- $primaryService := .Values.ytproxy.service.main -}} + {{- $defaultServiceName := "piped-ytproxy" -}} + {{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}} + {{- $isStable := include "common.capabilities.ingress.isStable" . }} +--- +apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} +kind: Ingress +metadata: + name: {{ $ingressName }}-ytproxy +{{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }} + labels: {{- toYaml . | nindent 4 }} +{{- end }} +{{- with (merge ($values.annotations | default dict)) }} + annotations: {{- toYaml . | nindent 4 }} +{{- end }} +spec: +{{- if and $isStable $values.ingressClassName }} + ingressClassName: {{ $values.ingressClassName }} +{{- end }} +{{- if $values.tls }} + tls: + {{- range $values.tls }} + - hosts: + {{- range .hosts }} + - {{ tpl . $ | quote }} + {{- end }} + {{- if .secretName }} + secretName: {{ tpl .secretName $ | quote}} + {{- end }} + {{- end }} +{{- end }} + rules: +{{- range $values.hosts }} + - host: {{ tpl .host $ | quote }} + http: + paths: + {{- range .paths }} + {{- $service := $defaultServiceName -}} + {{- $port := $defaultServicePort.port -}} + {{- if .service -}} + {{- $service = default $service .service.name -}} + {{- $port = default $port .service.port -}} + {{- end }} + - path: {{ tpl .path $ | quote }} + {{- if $isStable }} + pathType: {{ default "Prefix" .pathType }} + {{- end }} + backend: + {{- if $isStable }} + service: + name: {{ $service }} + port: + number: {{ $port }} + {{- else }} + serviceName: {{ $service }} + servicePort: {{ $port }} + {{- end }} + {{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/apps/piped/values.yaml b/charts/apps/piped/values.yaml index d06e882..3017c5b 100644 --- a/charts/apps/piped/values.yaml +++ b/charts/apps/piped/values.yaml @@ -40,11 +40,13 @@ frontend: # -- image pull policy pullPolicy: IfNotPresent - # Using currently container default - #command: "/bin/tail" - #args: - # - -c -# - "sed -i s/pipedapi.kavin.rocks/BACKEND_HOSTNAME/g /usr/share/nginx/html/assets/*" + env: + BACKEND_HOSTNAME: pipedapi.example.org + + command: "/bin/ash" + args: + - -c + - "sed -i s/pipedapi.kavin.rocks/$BACKEND_HOSTNAME/g /usr/share/nginx/html/assets/* && /docker-entrypoint.sh && nginx -g 'daemon off;'" backend: enabled: true @@ -119,7 +121,7 @@ ingress: enabled: false primary: false hosts: - - host: chart-foo.local + - host: piped.example.com paths: - path: "/" tls: [] @@ -128,7 +130,7 @@ ingress: enabled: false primary: false hosts: - - host: be.chart-foo.local + - host: pipedapi.example.com paths: - path: "/" tls: []