fix(miniserve): rename from web-static

This commit is contained in:
WrenIX 2023-08-27 10:39:03 +02:00
parent 687f5aaf42
commit e6c1b171db
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
14 changed files with 55 additions and 55 deletions

View file

@ -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"

View file

@ -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

View file

@ -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 }}

View file

@ -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:

View file

@ -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: {}

View file

@ -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:

View file

@ -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 }}

View file

@ -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 -}}

View file

@ -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 }}

View file

@ -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 }}

View file

@ -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

View file

@ -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