From e6c1b171db673de0da4288a82d87ad9d54a83dfb Mon Sep 17 00:00:00 2001 From: WrenIX Date: Sun, 27 Aug 2023 10:39:03 +0200 Subject: [PATCH] fix(miniserve): rename from web-static --- {web-static => miniserve}/.helmignore | 0 {web-static => miniserve}/Chart.yaml | 4 ++-- {web-static => miniserve}/templates/NOTES.txt | 8 ++++---- .../templates/_helpers.tpl | 20 +++++++++---------- .../templates/configmap.yaml | 4 ++-- .../templates/deployment.yaml | 14 ++++++------- {web-static => miniserve}/templates/hpa.yaml | 6 +++--- .../templates/ingress.yaml | 4 ++-- {web-static => miniserve}/templates/pvc.yaml | 10 +++++----- .../templates/service.yaml | 6 +++--- .../templates/serviceaccount.yaml | 4 ++-- .../templates/tests/test-connection.yaml | 15 ++++++++++++++ {web-static => miniserve}/values.yaml | 0 .../templates/tests/test-connection.yaml | 15 -------------- 14 files changed, 55 insertions(+), 55 deletions(-) rename {web-static => miniserve}/.helmignore (100%) rename {web-static => miniserve}/Chart.yaml (75%) rename {web-static => miniserve}/templates/NOTES.txt (76%) rename {web-static => miniserve}/templates/_helpers.tpl (74%) rename {web-static => miniserve}/templates/configmap.yaml (95%) rename {web-static => miniserve}/templates/deployment.yaml (85%) rename {web-static => miniserve}/templates/hpa.yaml (84%) rename {web-static => miniserve}/templates/ingress.yaml (94%) rename {web-static => miniserve}/templates/pvc.yaml (82%) rename {web-static => miniserve}/templates/service.yaml (56%) rename {web-static => miniserve}/templates/serviceaccount.yaml (66%) create mode 100644 miniserve/templates/tests/test-connection.yaml rename {web-static => miniserve}/values.yaml (100%) delete mode 100644 web-static/templates/tests/test-connection.yaml diff --git a/web-static/.helmignore b/miniserve/.helmignore similarity index 100% rename from web-static/.helmignore rename to miniserve/.helmignore diff --git a/web-static/Chart.yaml b/miniserve/Chart.yaml similarity index 75% rename from web-static/Chart.yaml rename to miniserve/Chart.yaml index ca1a6fd..6113492 100644 --- a/web-static/Chart.yaml +++ b/miniserve/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 -name: web-static +name: miniserve description: A Helm chart for Kubernetes type: application -version: 0.2.0 +version: 0.3.0 appVersion: "0.24.0" diff --git a/web-static/templates/NOTES.txt b/miniserve/templates/NOTES.txt similarity index 76% rename from web-static/templates/NOTES.txt rename to miniserve/templates/NOTES.txt index 65f0cd9..9cd5386 100644 --- a/web-static/templates/NOTES.txt +++ b/miniserve/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 "web-static.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "miniserve.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 "web-static.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "web-static.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 "miniserve.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "miniserve.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 "web-static.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 "miniserve.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/web-static/templates/_helpers.tpl b/miniserve/templates/_helpers.tpl similarity index 74% rename from web-static/templates/_helpers.tpl rename to miniserve/templates/_helpers.tpl index d27fb73..975f411 100644 --- a/web-static/templates/_helpers.tpl +++ b/miniserve/templates/_helpers.tpl @@ -1,7 +1,7 @@ {{/* Expand the name of the chart. */}} -{{- define "web-static.name" -}} +{{- define "miniserve.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 "web-static.fullname" -}} +{{- define "miniserve.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 "web-static.chart" -}} +{{- define "miniserve.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "web-static.labels" -}} -helm.sh/chart: {{ include "web-static.chart" . }} -{{ include "web-static.selectorLabels" . }} +{{- define "miniserve.labels" -}} +helm.sh/chart: {{ include "miniserve.chart" . }} +{{ include "miniserve.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "web-static.selectorLabels" -}} -app.kubernetes.io/name: {{ include "web-static.name" . }} +{{- define "miniserve.selectorLabels" -}} +app.kubernetes.io/name: {{ include "miniserve.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Create the name of the service account to use */}} -{{- define "web-static.serviceAccountName" -}} +{{- define "miniserve.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "web-static.fullname" .) .Values.serviceAccount.name }} +{{- default (include "miniserve.fullname" .) .Values.serviceAccount.name }} {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} diff --git a/web-static/templates/configmap.yaml b/miniserve/templates/configmap.yaml similarity index 95% rename from web-static/templates/configmap.yaml rename to miniserve/templates/configmap.yaml index 0091087..832695b 100644 --- a/web-static/templates/configmap.yaml +++ b/miniserve/templates/configmap.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "web-static.fullname" . }} + name: {{ include "miniserve.fullname" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} annotations: hash-config: "{{ toYaml .Values.data | sha256sum | trunc 32 }}" data: diff --git a/web-static/templates/deployment.yaml b/miniserve/templates/deployment.yaml similarity index 85% rename from web-static/templates/deployment.yaml rename to miniserve/templates/deployment.yaml index 10ce65d..aa37774 100644 --- a/web-static/templates/deployment.yaml +++ b/miniserve/templates/deployment.yaml @@ -1,16 +1,16 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "web-static.fullname" . }} + name: {{ include "miniserve.fullname" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} selector: matchLabels: - {{- include "web-static.selectorLabels" . | nindent 6 }} + {{- include "miniserve.selectorLabels" . | nindent 6 }} template: metadata: annotations: @@ -19,13 +19,13 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- include "web-static.selectorLabels" . | nindent 8 }} + {{- include "miniserve.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "web-static.serviceAccountName" . }} + serviceAccountName: {{ include "miniserve.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: @@ -36,7 +36,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} envFrom: - configMapRef: - name: {{ include "web-static.fullname" . }} + name: {{ include "miniserve.fullname" . }} {{- with .Values.data.args }} args: {{- toYaml . | nindent 12 }} @@ -78,7 +78,7 @@ spec: path: {{ .Values.persistence.hostPath }} {{- else }} persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "web-static.fullname" . }}{{- end }} + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "miniserve.fullname" . }}{{- end }} {{- end }} {{- else }} emptyDir: {} diff --git a/web-static/templates/hpa.yaml b/miniserve/templates/hpa.yaml similarity index 84% rename from web-static/templates/hpa.yaml rename to miniserve/templates/hpa.yaml index 85a24b2..6d7cf5f 100644 --- a/web-static/templates/hpa.yaml +++ b/miniserve/templates/hpa.yaml @@ -2,14 +2,14 @@ apiVersion: autoscaling/v2beta1 kind: HorizontalPodAutoscaler metadata: - name: {{ include "web-static.fullname" . }} + name: {{ include "miniserve.fullname" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment - name: {{ include "web-static.fullname" . }} + name: {{ include "miniserve.fullname" . }} minReplicas: {{ .Values.autoscaling.minReplicas }} maxReplicas: {{ .Values.autoscaling.maxReplicas }} metrics: diff --git a/web-static/templates/ingress.yaml b/miniserve/templates/ingress.yaml similarity index 94% rename from web-static/templates/ingress.yaml rename to miniserve/templates/ingress.yaml index 4f1e532..f97df4c 100644 --- a/web-static/templates/ingress.yaml +++ b/miniserve/templates/ingress.yaml @@ -1,5 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "web-static.fullname" . -}} +{{- $fullName := include "miniserve.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 "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/web-static/templates/pvc.yaml b/miniserve/templates/pvc.yaml similarity index 82% rename from web-static/templates/pvc.yaml rename to miniserve/templates/pvc.yaml index af3dd02..1df3e36 100644 --- a/web-static/templates/pvc.yaml +++ b/miniserve/templates/pvc.yaml @@ -4,9 +4,9 @@ apiVersion: v1 kind: PersistentVolume metadata: - name: {{ .Release.Namespace }}-{{ template "web-static.fullname" . }} + name: {{ .Release.Namespace }}-{{ template "miniserve.fullname" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} {{- if .Values.persistence.annotations }} annotations: {{ toYaml .Values.persistence.annotations | indent 4 }} @@ -24,9 +24,9 @@ spec: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ template "web-static.fullname" . }} + name: {{ template "miniserve.fullname" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} {{- if .Values.persistence.annotations }} annotations: {{ toYaml .Values.persistence.annotations | indent 4 }} @@ -45,6 +45,6 @@ spec: {{- end }} {{- end }} {{- if .Values.persistence.hostPath }} - volumeName: {{ template "web-static.fullname" . }} + volumeName: {{ template "miniserve.fullname" . }} {{- end }} {{- end -}} \ No newline at end of file diff --git a/web-static/templates/service.yaml b/miniserve/templates/service.yaml similarity index 56% rename from web-static/templates/service.yaml rename to miniserve/templates/service.yaml index 26a8137..5754ab4 100644 --- a/web-static/templates/service.yaml +++ b/miniserve/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "web-static.fullname" . }} + name: {{ include "miniserve.fullname" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -12,4 +12,4 @@ spec: protocol: TCP name: http selector: - {{- include "web-static.selectorLabels" . | nindent 4 }} + {{- include "miniserve.selectorLabels" . | nindent 4 }} diff --git a/web-static/templates/serviceaccount.yaml b/miniserve/templates/serviceaccount.yaml similarity index 66% rename from web-static/templates/serviceaccount.yaml rename to miniserve/templates/serviceaccount.yaml index 9b7df01..dfa4d0a 100644 --- a/web-static/templates/serviceaccount.yaml +++ b/miniserve/templates/serviceaccount.yaml @@ -2,9 +2,9 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "web-static.serviceAccountName" . }} + name: {{ include "miniserve.serviceAccountName" . }} labels: - {{- include "web-static.labels" . | nindent 4 }} + {{- include "miniserve.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/miniserve/templates/tests/test-connection.yaml b/miniserve/templates/tests/test-connection.yaml new file mode 100644 index 0000000..e2bb60e --- /dev/null +++ b/miniserve/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "miniserve.fullname" . }}-test-connection" + labels: + {{- include "miniserve.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "miniserve.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/web-static/values.yaml b/miniserve/values.yaml similarity index 100% rename from web-static/values.yaml rename to miniserve/values.yaml diff --git a/web-static/templates/tests/test-connection.yaml b/web-static/templates/tests/test-connection.yaml deleted file mode 100644 index e4e679b..0000000 --- a/web-static/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "web-static.fullname" . }}-test-connection" - labels: - {{- include "web-static.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "web-static.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never