From 5db0e49246d9cd964488af5acf8455fc963a7744 Mon Sep 17 00:00:00 2001 From: Rein-Vanbelleghem Date: Fri, 26 Apr 2024 21:01:09 +0200 Subject: [PATCH] hello --- charts/hello/Chart.yaml | 4 ++++ charts/hello/site.yaml | 1 + charts/hello/templates/_helpers.tpl | 16 +++++++++++++++ charts/hello/templates/configmap.yml | 10 +++++++++ charts/hello/templates/deployment.yaml | 28 ++++++++++++++++++++++++++ charts/hello/templates/service.yaml | 12 +++++++++++ charts/hello/values.yaml | 9 +++++++++ 7 files changed, 80 insertions(+) create mode 100644 charts/hello/Chart.yaml create mode 100644 charts/hello/site.yaml create mode 100644 charts/hello/templates/_helpers.tpl create mode 100644 charts/hello/templates/configmap.yml create mode 100644 charts/hello/templates/deployment.yaml create mode 100644 charts/hello/templates/service.yaml create mode 100644 charts/hello/values.yaml diff --git a/charts/hello/Chart.yaml b/charts/hello/Chart.yaml new file mode 100644 index 0000000..bd959b8 --- /dev/null +++ b/charts/hello/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v2 +name: hello +description: A Helm chart for Kubernetes to deploy a simple Nginx server displaying "Hello World" +version: 0.1.0 diff --git a/charts/hello/site.yaml b/charts/hello/site.yaml new file mode 100644 index 0000000..1b76057 --- /dev/null +++ b/charts/hello/site.yaml @@ -0,0 +1 @@ +imageUrl: "https://i.pinimg.com/originals/c4/a2/05/c4a2050a1cbbd8158e717f29185d9ab1.jpg" diff --git a/charts/hello/templates/_helpers.tpl b/charts/hello/templates/_helpers.tpl new file mode 100644 index 0000000..308975b --- /dev/null +++ b/charts/hello/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "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). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/charts/hello/templates/configmap.yml b/charts/hello/templates/configmap.yml new file mode 100644 index 0000000..01a7a60 --- /dev/null +++ b/charts/hello/templates/configmap.yml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "hello-nginx.fullname" . }}-config +data: + index.html: | + + Hello World +

Hello World

+ diff --git a/charts/hello/templates/deployment.yaml b/charts/hello/templates/deployment.yaml new file mode 100644 index 0000000..ab4e4f8 --- /dev/null +++ b/charts/hello/templates/deployment.yaml @@ -0,0 +1,28 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "hello-nginx.fullname" . }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "hello-nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "hello-nginx.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: nginx + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + ports: + - containerPort: 80 + volumeMounts: + - name: html + mountPath: /usr/share/nginx/html + volumes: + - name: html + configMap: + name: {{ include "hello-nginx.fullname" . }}-config diff --git a/charts/hello/templates/service.yaml b/charts/hello/templates/service.yaml new file mode 100644 index 0000000..900a8d9 --- /dev/null +++ b/charts/hello/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: { { include "hello-nginx.fullname" . } } +spec: + type: { { .Values.service.type } } + ports: + - port: { { .Values.service.port } } + targetPort: 80 + selector: + app.kubernetes.io/name: { { include "hello-nginx.name" . } } + app.kubernetes.io/instance: { { .Release.Name } } diff --git a/charts/hello/values.yaml b/charts/hello/values.yaml new file mode 100644 index 0000000..63421db --- /dev/null +++ b/charts/hello/values.yaml @@ -0,0 +1,9 @@ +replicaCount: 1 +image: + repository: nginx + pullPolicy: IfNotPresent + tag: stable + +service: + type: LoadBalancer + port: 80