Skip to content

Commit

Permalink
Create game 2048 chart (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
devpro committed Feb 13, 2024
1 parent 52d4530 commit ae287cc
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/game-2048/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
10 changes: 10 additions & 0 deletions charts/game-2048/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions charts/game-2048/README.md
Original file line number Diff line number Diff line change
@@ -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
```
Empty file.
Empty file.
31 changes: 31 additions & 0 deletions charts/game-2048/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

32 changes: 32 additions & 0 deletions charts/game-2048/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
18 changes: 18 additions & 0 deletions charts/game-2048/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
19 changes: 19 additions & 0 deletions charts/game-2048/values.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ae287cc

Please sign in to comment.