From a739fc12d462039d76c0c35fe2669b7030d130c2 Mon Sep 17 00:00:00 2001 From: celebrateyang Date: Mon, 30 Sep 2024 15:52:30 +0800 Subject: [PATCH] =?UTF-8?q?chart=E5=91=BD=E5=90=8D=E8=A7=84=E8=8C=83?= =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E4=B8=8B=E5=88=92=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cobalt-chart/Chart.yaml | 2 +- cobalt-chart/templates/NOTES.txt | 8 ++++---- cobalt-chart/templates/_helpers.tpl | 16 ++++++++-------- cobalt-chart/templates/deployment.yaml | 8 ++++---- cobalt-chart/templates/hpa.yaml | 6 +++--- cobalt-chart/templates/ingress.yaml | 4 ++-- cobalt-chart/templates/service.yaml | 6 +++--- .../templates/tests/test-connection.yaml | 6 +++--- cobalt-chart/values.yaml | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/cobalt-chart/Chart.yaml b/cobalt-chart/Chart.yaml index d2a7faaa..3ca996ed 100644 --- a/cobalt-chart/Chart.yaml +++ b/cobalt-chart/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: cobalt_chart +name: cobalt-chart description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. diff --git a/cobalt-chart/templates/NOTES.txt b/cobalt-chart/templates/NOTES.txt index d874c351..3d1c21d7 100644 --- a/cobalt-chart/templates/NOTES.txt +++ b/cobalt-chart/templates/NOTES.txt @@ -6,16 +6,16 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "cobalt_chart.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "cobalt-chart.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cobalt_chart.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cobalt_chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cobalt-chart.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cobalt-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "cobalt_chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "cobalt-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT diff --git a/cobalt-chart/templates/_helpers.tpl b/cobalt-chart/templates/_helpers.tpl index 66ecaa63..3246afda 100644 --- a/cobalt-chart/templates/_helpers.tpl +++ b/cobalt-chart/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "cobalt_chart.name" -}} +{{- define "cobalt-chart.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} @@ -10,7 +10,7 @@ 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 "cobalt_chart.fullname" -}} +{{- define "cobalt-chart.fullname" -}} {{- if .Values.fullnameOverride }} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} {{- else }} @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "cobalt_chart.chart" -}} +{{- define "cobalt-chart.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "cobalt_chart.labels" -}} -helm.sh/chart: {{ include "cobalt_chart.chart" . }} -{{ include "cobalt_chart.selectorLabels" . }} +{{- define "cobalt-chart.labels" -}} +helm.sh/chart: {{ include "cobalt-chart.chart" . }} +{{ include "cobalt-chart.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,7 +45,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "cobalt_chart.selectorLabels" -}} -app.kubernetes.io/name: {{ include "cobalt_chart.name" . }} +{{- define "cobalt-chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cobalt-chart.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} diff --git a/cobalt-chart/templates/deployment.yaml b/cobalt-chart/templates/deployment.yaml index b7090d29..3d30c705 100644 --- a/cobalt-chart/templates/deployment.yaml +++ b/cobalt-chart/templates/deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "cobalt_chart.fullname" . }} + name: {{ include "cobalt-chart.fullname" . }} labels: - {{- include "cobalt_chart.labels" . | nindent 4 }} + {{- include "cobalt-chart.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "cobalt_chart.selectorLabels" . | nindent 6 }} + {{- include "cobalt-chart.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} @@ -18,7 +18,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "cobalt_chart.labels" . | nindent 8 }} + {{- include "cobalt-chart.labels" . | nindent 8 }} {{- with .Values.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/cobalt-chart/templates/hpa.yaml b/cobalt-chart/templates/hpa.yaml index 526b7289..6fc6a7fa 100644 --- a/cobalt-chart/templates/hpa.yaml +++ b/cobalt-chart/templates/hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: - name: {{ include "cobalt_chart.fullname" . }} + name: {{ include "cobalt-chart.fullname" . }} labels: - {{- include "cobalt_chart.labels" . | nindent 4 }} + {{- include "cobalt-chart.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "cobalt_chart.fullname" . }} + name: {{ include "cobalt-chart.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: diff --git a/cobalt-chart/templates/ingress.yaml b/cobalt-chart/templates/ingress.yaml index d1836e3b..4f347868 100644 --- a/cobalt-chart/templates/ingress.yaml +++ b/cobalt-chart/templates/ingress.yaml @@ -1,5 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "cobalt_chart.fullname" . -}} +{{- $fullName := include "cobalt-chart.fullname" . -}} {{- $svcPort := .Values.service.port -}} {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} @@ -17,7 +17,7 @@ kind: Ingress metadata: name: {{ $fullName }} labels: - {{- include "cobalt_chart.labels" . | nindent 4 }} + {{- include "cobalt-chart.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/cobalt-chart/templates/service.yaml b/cobalt-chart/templates/service.yaml index ce2b9f0a..bcfe13d9 100644 --- a/cobalt-chart/templates/service.yaml +++ b/cobalt-chart/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "cobalt_chart.fullname" . }} + name: {{ include "cobalt-chart.fullname" . }} labels: - {{- include "cobalt_chart.labels" . | nindent 4 }} + {{- include "cobalt-chart.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "cobalt_chart.selectorLabels" . | nindent 4 }} + {{- include "cobalt-chart.selectorLabels" . | nindent 4 }} diff --git a/cobalt-chart/templates/tests/test-connection.yaml b/cobalt-chart/templates/tests/test-connection.yaml index 36fb91de..233ac5ed 100644 --- a/cobalt-chart/templates/tests/test-connection.yaml +++ b/cobalt-chart/templates/tests/test-connection.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "cobalt_chart.fullname" . }}-test-connection" + name: "{{ include "cobalt-chart.fullname" . }}-test-connection" labels: - {{- include "cobalt_chart.labels" . | nindent 4 }} + {{- include "cobalt-chart.labels" . | nindent 4 }} annotations: "helm.sh/hook": test spec: @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "cobalt_chart.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "cobalt-chart.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never diff --git a/cobalt-chart/values.yaml b/cobalt-chart/values.yaml index 39969495..d6478de7 100644 --- a/cobalt-chart/values.yaml +++ b/cobalt-chart/values.yaml @@ -1,4 +1,4 @@ -# Default values for cobalt_chart. +# Default values for cobalt-chart. # This is a YAML-formatted file. # Declare variables to be passed into your templates.