From ae287cc7aa297e0d67922a661f196743031e45a5 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Tue, 13 Feb 2024 15:48:11 +0100 Subject: [PATCH] Create game 2048 chart (#34) --- charts/game-2048/.helmignore | 23 ++++++++++++++++ charts/game-2048/Chart.yaml | 10 +++++++ charts/game-2048/README.md | 25 +++++++++++++++++ charts/game-2048/templates/NOTES.txt | 0 charts/game-2048/templates/_helpers.tpl | 0 charts/game-2048/templates/deployment.yaml | 31 +++++++++++++++++++++ charts/game-2048/templates/ingress.yaml | 32 ++++++++++++++++++++++ charts/game-2048/templates/service.yaml | 18 ++++++++++++ charts/game-2048/values.yaml | 19 +++++++++++++ 9 files changed, 158 insertions(+) create mode 100644 charts/game-2048/.helmignore create mode 100644 charts/game-2048/Chart.yaml create mode 100644 charts/game-2048/README.md create mode 100644 charts/game-2048/templates/NOTES.txt create mode 100644 charts/game-2048/templates/_helpers.tpl create mode 100644 charts/game-2048/templates/deployment.yaml create mode 100644 charts/game-2048/templates/ingress.yaml create mode 100644 charts/game-2048/templates/service.yaml create mode 100644 charts/game-2048/values.yaml diff --git a/charts/game-2048/.helmignore b/charts/game-2048/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/game-2048/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/game-2048/Chart.yaml b/charts/game-2048/Chart.yaml new file mode 100644 index 0000000..8b6fdac --- /dev/null +++ b/charts/game-2048/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v2 +name: game-2048 +description: Helm chart for Game 2048 +type: application +version: 0.1.0 +appVersion: "1.0.0" +maintainers: + - name: devpro + email: bertrand@devpro.fr +home: https://github.com/devpro/helm-charts/tree/main/charts/game-2048 diff --git a/charts/game-2048/README.md b/charts/game-2048/README.md new file mode 100644 index 0000000..b611b29 --- /dev/null +++ b/charts/game-2048/README.md @@ -0,0 +1,25 @@ +# Helm chart for game 2048 + +This Helm chart will install Game 2048 on a Kubernetes cluster. + +## Usage + +[Helm](https://helm.sh) must be installed to use the chart from the command line. Here is the flow to have the application running in your Kubernetes cluster: + +```bash +# adds the repo (if not already done) +helm repo add devpro https://devpro.github.io/helm-charts + +# retrieves recent information from added repos +helm repo update + +# installs the chart (this command can be ran multiple times) +helm upgrade --install game-2048 devpro/game-2048 --create-namespace --namespace sample-apps +``` + +Once done, uninstall the chart and clean-up the cluster: + +```bash +helm delete game-2048 +kubectl delete ns sample-apps +``` diff --git a/charts/game-2048/templates/NOTES.txt b/charts/game-2048/templates/NOTES.txt new file mode 100644 index 0000000..e69de29 diff --git a/charts/game-2048/templates/_helpers.tpl b/charts/game-2048/templates/_helpers.tpl new file mode 100644 index 0000000..e69de29 diff --git a/charts/game-2048/templates/deployment.yaml b/charts/game-2048/templates/deployment.yaml new file mode 100644 index 0000000..027d130 --- /dev/null +++ b/charts/game-2048/templates/deployment.yaml @@ -0,0 +1,31 @@ +{{- $name := $.Values.name -}} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $name }} + labels: + app: {{ $name }} + app.kubernetes.io/name: {{ $name }} +spec: + replicas: {{ $.Values.replicaCount }} + selector: + matchLabels: + app: {{ $name }} + app.kubernetes.io/name: {{ $name }} + template: + metadata: + labels: + app: {{ $name }} + app.kubernetes.io/name: {{ $name }} + spec: + containers: + - name: webapp + image: "{{ $.Values.image }}:{{ $.Values.tag }}" + imagePullPolicy: Always + ports: + - name: http + containerPort: 80 + resources: + {{- toYaml .Values.resources | nindent 12 }} + diff --git a/charts/game-2048/templates/ingress.yaml b/charts/game-2048/templates/ingress.yaml new file mode 100644 index 0000000..47b485d --- /dev/null +++ b/charts/game-2048/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if $.Values.ingress.enabled -}} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $.Values.name }}-ing + {{- with $.Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if $.Values.ingress.className }} + ingressClassName: {{ $.Values.ingress.className }} + {{- end }} + rules: + - host: {{ $.Values.ingress.host }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ $.Values.name }}-svc + port: + number: 80 + {{- if $.Values.ingress.tls }} + tls: + - hosts: + - {{ $.Values.ingress.host | quote }} + secretName: {{ $.Values.ingress.tls.secretName }} + {{- end }} +{{- end }} diff --git a/charts/game-2048/templates/service.yaml b/charts/game-2048/templates/service.yaml new file mode 100644 index 0000000..2086198 --- /dev/null +++ b/charts/game-2048/templates/service.yaml @@ -0,0 +1,18 @@ +{{- $name := $.Values.name -}} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ $name }}-svc + labels: + app: {{ $name }} + app.kubernetes.io/name: {{ $name }} +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + selector: + app: {{ $name }} + app.kubernetes.io/name: {{ $name }} diff --git a/charts/game-2048/values.yaml b/charts/game-2048/values.yaml new file mode 100644 index 0000000..2f33d06 --- /dev/null +++ b/charts/game-2048/values.yaml @@ -0,0 +1,19 @@ +name: game-2048 +image: alexwhen/docker-2048 +tag: latest +replicaCount: 1 +ingress: + enabled: false + className: "nginx" + host: "game-2048.dummy" + annotations: {} + # cert-manager.io/cluster-issuer: letsencrypt-prod + tls: + secretName: "game-2048-tls" +resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 64Mi