Closed stoneshi-yunify closed 8 months ago
ksbuilder lint 貌似指出我的 helps.tpl 有问题,但是helm lint 并没有问题。这个扩展组件我安装使用也没有问题。
# stone @ stonedeMac-mini in /tmp [14:06:26] $ ksbuilder lint storage-utils --with-subcharts WARNING: extension storage-utils has no images error executing command: template: storage-utils/charts/backend/templates/tests/test-connection.yaml:4:12: executing "storage-utils/charts/backend/templates/tests/test-connection.yaml" at <include "backend.fullname" .>: error calling include: template: storage-utils/charts/backend/templates/helps.tpl:18:30: executing "backend.fullname" at <.Release.Name>: nil pointer evaluating interface {}.Name # stone @ stonedeMac-mini in /tmp [14:06:43] C:1 $ helm lint storage-utils --with-subcharts WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /Users/stone/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /Users/stone/.kube/config ==> Linting storage-utils [WARNING] templates/: directory not found ==> Linting storage-utils/charts/backend ==> Linting storage-utils/charts/frontend 3 chart(s) linted, 0 chart(s) failed # stone @ stonedeMac-mini in /tmp [14:07:19] $ cat storage-utils/charts/backend/templates/tests/test-connection.yaml apiVersion: v1 kind: Pod metadata: name: "{{ include "backend.fullname" . }}-test-connection" labels: {{- include "backend.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: containers: - name: wget image: busybox command: ['wget'] args: ['{{ include "backend.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never # stone @ stonedeMac-mini in /tmp [14:09:27] $ cat storage-utils/charts/backend/templates/helps.tpl {{/* Expand the name of the chart. */}} {{- define "backend.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 "backend.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 "backend.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} {{- define "backend.labels" -}} helm.sh/chart: {{ include "backend.chart" . }} {{ include "backend.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{/* Selector labels */}} {{- define "backend.selectorLabels" -}} app.kubernetes.io/name: {{ include "backend.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} # stone @ stonedeMac-mini in /tmp [14:09:53] $ ksbuilder -v ksbuilder version 0.3.7 # stone @ stonedeMac-mini in /tmp [14:11:02] C:1 $ helm version WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /Users/stone/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /Users/stone/.kube/config version.BuildInfo{Version:"v3.12.3", GitCommit:"3a31588ad33fe3b89af5a2a54ee1d25bfe6eaa5e", GitTreeState:"clean", GoVersion:"go1.21.1"}
/cc @iawia002
cc @littleBlackHouse
另外,我的values.yaml 不支持 global.imageRegistry, lint也没报告
fixed
ksbuilder lint 貌似指出我的 helps.tpl 有问题,但是helm lint 并没有问题。这个扩展组件我安装使用也没有问题。