Skip to content

Commit

Permalink
feat: add helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
agrrh committed Dec 9, 2023
1 parent 8d7596a commit 1d2698c
Show file tree
Hide file tree
Showing 15 changed files with 670 additions and 0 deletions.
23 changes: 23 additions & 0 deletions deploy/helm/pagetron/.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/
11 changes: 11 additions & 0 deletions deploy/helm/pagetron/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

apiVersion: v2
name: pagetron
description: A Helm chart for Kubernetes

type: application

version: 0.1.0

appVersion: "v0.1.1"
61 changes: 61 additions & 0 deletions deploy/helm/pagetron/templates/backend.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- with $.Values.backend }}

---

apiVersion: apps/v1
kind: Deployment

metadata:
name: pagetron-backend
labels:
app: pagetron
component: backend

spec:
replicas: {{ .replicas }}
selector:
matchLabels:
app: pagetron
component: backend

template:
metadata:
labels:
app: pagetron
component: backend

spec:
containers:
- name: pagetron-backend

image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}

ports:
- name: http
containerPort: 3000
protocol: TCP

livenessProbe:
httpGet:
path: /
port: http

readinessProbe:
httpGet:
path: /
port: http

resources:
{{- toYaml .resources | nindent 12 }}

{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- end }}
26 changes: 26 additions & 0 deletions deploy/helm/pagetron/templates/backend.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- with $.Values.backend }}

---

apiVersion: v1
kind: Service

metadata:
name: pagetron-backend
labels:
app: pagetron
component: backend

spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: http
protocol: TCP

selector:
app: pagetron
component: backend

{{- end }}
61 changes: 61 additions & 0 deletions deploy/helm/pagetron/templates/blackbox.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- with $.Values.blackbox }}

---

apiVersion: apps/v1
kind: Deployment

metadata:
name: blackbox
labels:
app: pagetron
component: blackbox

spec:
replicas: {{ .replicas }}
selector:
matchLabels:
app: pagetron
component: blackbox

template:
metadata:
labels:
app: pagetron
component: blackbox

spec:
containers:
- name: blackbox

image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.pullPolicy }}

ports:
- name: http
containerPort: 9115
protocol: TCP

livenessProbe:
httpGet:
path: /
port: http

readinessProbe:
httpGet:
path: /
port: http

resources:
{{- toYaml .resources | nindent 12 }}

{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- end }}
26 changes: 26 additions & 0 deletions deploy/helm/pagetron/templates/blackbox.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- with $.Values.blackbox }}

---

apiVersion: v1
kind: Service

metadata:
name: blackbox
labels:
app: pagetron
component: blackbox

spec:
type: ClusterIP
ports:
- name: http
port: 9115
targetPort: http
protocol: TCP

selector:
app: pagetron
component: blackbox

{{- end }}
61 changes: 61 additions & 0 deletions deploy/helm/pagetron/templates/frontend.deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- with $.Values.frontend }}

---

apiVersion: apps/v1
kind: Deployment

metadata:
name: pagetron-frontend
labels:
app: pagetron
component: frontend

spec:
replicas: {{ .replicas }}
selector:
matchLabels:
app: pagetron
component: frontend

template:
metadata:
labels:
app: pagetron
component: frontend

spec:
containers:
- name: pagetron-frontend

image: "{{ .image.repository }}:{{ .image.tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ .image.pullPolicy }}

ports:
- name: http
containerPort: 80
protocol: TCP

livenessProbe:
httpGet:
path: /
port: http

readinessProbe:
httpGet:
path: /
port: http

resources:
{{- toYaml .resources | nindent 12 }}

{{- with .nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- end }}
26 changes: 26 additions & 0 deletions deploy/helm/pagetron/templates/frontend.service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- with $.Values.frontend }}

---

apiVersion: v1
kind: Service

metadata:
name: pagetron-frontend
labels:
app: pagetron
component: frontend

spec:
type: ClusterIP
ports:
- name: http
port: 80
targetPort: http
protocol: TCP

selector:
app: pagetron
component: frontend

{{- end }}
34 changes: 34 additions & 0 deletions deploy/helm/pagetron/templates/housekeeper.cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{- with $.Values.housekeeper }}

---

apiVersion: batch/v1
kind: CronJob

metadata:
name: pagetron-housekeeper
labels:
app: pagetron
component: housekeeper

spec:
schedule: {{ .schedule | quote }}
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: housekeeper
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: IfNotPresent
command: ["curl"]
args:
- --request
- POST
- --globoff
- --data-urlencode
- 'match[]={__name__!~"pagetron:.+"}'
- http://pagetron-prometheus:9090/api/v1/admin/tsdb/delete_series

{{- end }}
Loading

0 comments on commit 1d2698c

Please sign in to comment.