tools/stx/stx-build-tools-chart/stx-builder/dependency_chart/stx-builder-files-http/templates/_helpers.tpl
Davlet Panech 16dd9d0a78 Add new pod for accessing local files over HTTP
After this change we can access any files under
/localdist/{designer,loadbuild} using an environment variable for the
URL:

  curl $BUILDER_FILES_URL/localdisk/designer/some/file

This change is required by docker build scripts in starlingx/root
for projects that use Loci and have MIRROR_LOCAL set to "yes".

This change requires one to restart the environment (stx-init-env).

CHANGES
=======

* New k8s deployment "stx-builder-files-http". Includes a single pod
  based on the open source "nginx" image. Serves all files under
  /localdisk/{designer,loadbuild} on port 8088.

* k8s.py: fixed problem with distinguishing a pod name that is a prefix
  of another pod name, eg "builder" vs "builder-files-http"

TESTS
=====

* Re-build & re-deploy the helm chart using "stx-init-env"
* Create a dummy docker image recipe that uses Loci and MIRROR_LOCAL and
  make sure it does not fail when cloning

Story: 2010294
Task: 47307

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: I04e5c6237930fb75a8acbfd65a6479bc06fa6194
2023-02-07 15:50:49 -05:00

64 lines
1.9 KiB
Smarty

{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "stx-builder-files-http.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "stx-builder-files-http.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "stx-builder-files-http.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "stx-builder-files-http.labels" -}}
helm.sh/chart: {{ include "stx-builder-files-http.chart" . }}
{{ include "stx-builder-files-http.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "stx-builder-files-http.selectorLabels" -}}
app.kubernetes.io/name: {{ include "stx-builder-files-http.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "stx-builder-files-http.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "stx-builder-files-http.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}