q-shift / qshift-templates

Backstage templates for the Qshift demo
Apache License 2.0
1 stars 3 forks source link

Name of the resources generated by the Helm chart is too long #31

Closed cmoulliard closed 4 months ago

cmoulliard commented 4 months ago

TODO

The name of the resources: deployment, service, route, etc generated by the Helm chart is too long:

Example: When we scaffold a project using as application name (= component_id): my-quarkus-app then the deployment name becomes: my-quarkus-app-deploy-quarkus-deploy

Chart name is: quarkus-deploy Chart Release name: my-quarkus-app-deploy

The following logic should be reviewed as currently it concatenates: <Chart Release name>-<Chart name> to produce a very long name OR we should use as chart name, the component_id

Remark: Apparently the argocd:create action create the chart release name using the Argocd App name which is in our case: my-quarkus-app-deploy or `-deploy

{{/*
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 "quarkus-template.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 }}
cmoulliard commented 4 months ago

Fixed.

Screenshot 2024-02-22 at 13 01 04 Screenshot 2024-02-22 at 13 00 50