Skip to content

Commit e25a5d3

Browse files
statping mvp
1 parent 4fbd99c commit e25a5d3

13 files changed

+541
-0
lines changed

itscontained/statping/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

itscontained/statping/Chart.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v2
2+
name: statping
3+
description: Status page for monitoring your websites and applications
4+
type: application
5+
version: 0.1.0
6+
appVersion: v0.90.65
7+
keywords:
8+
- statping
9+
- status
10+
- status-page
11+
home: https://charts.itscontained.io
12+
sources:
13+
- https://github.com/statping/statping
14+
maintainers:
15+
- name: Nicholas St. Germain
16+
17+
icon: https://github.com/statping/statping/blob/dev/frontend/src/assets/logo.png?raw=true
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "statping.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "statping.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "statping.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "statping.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
echo "Visit http://127.0.0.1:8080 to use your application"
20+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
21+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "statping.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "statping.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "statping.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "statping.labels" -}}
37+
helm.sh/chart: {{ include "statping.chart" . }}
38+
{{ include "statping.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "statping.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "statping.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "statping.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "statping.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "statping.fullname" . }}
5+
labels:
6+
{{- include "statping.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "statping.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "statping.selectorLabels" . | nindent 8 }}
22+
spec:
23+
{{- with .Values.imagePullSecrets }}
24+
imagePullSecrets:
25+
{{- toYaml . | nindent 8 }}
26+
{{- end }}
27+
serviceAccountName: {{ include "statping.serviceAccountName" . }}
28+
securityContext:
29+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
30+
containers:
31+
- name: {{ .Chart.Name }}
32+
securityContext:
33+
{{- toYaml .Values.securityContext | nindent 12 }}
34+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
35+
imagePullPolicy: {{ .Values.image.pullPolicy }}
36+
env:
37+
{{- if .Values.statping.name }}
38+
- name: NAME
39+
value: {{ .Values.statping.name | quote }}
40+
{{- end }}
41+
{{- if .Values.statping.description }}
42+
- name: DESCRIPTION
43+
value: {{ .Values.statping.description | quote }}
44+
{{- end }}
45+
{{- if .Values.statping.domain }}
46+
- name: DOMAIN
47+
value: {{ .Values.statping.domain | quote }}
48+
{{- end }}
49+
- name: ADMIN_USER
50+
valueFrom:
51+
secretKeyRef:
52+
{{- if .Values.statping.admin.existingSecret.enabled }}
53+
name: {{ .Values.statping.admin.existingSecret.name | quote }}
54+
key: {{ .Values.statping.admin.existingSecret.userKey | quote }}
55+
{{- else }}
56+
name: {{ include "statping.fullname" . }}
57+
key: admin-user
58+
{{- end }}
59+
- name: ADMIN_PASSWORD
60+
valueFrom:
61+
secretKeyRef:
62+
{{- if .Values.statping.admin.existingSecret.enabled }}
63+
name: {{ .Values.statping.admin.existingSecret.name | quote }}
64+
key: {{ .Values.statping.admin.existingSecret.passwordKey | quote }}
65+
{{- else }}
66+
name: {{ include "statping.fullname" . }}
67+
key: admin-password
68+
{{- end }}
69+
- name: ADMIN_EMAIL
70+
valueFrom:
71+
secretKeyRef:
72+
{{- if .Values.statping.admin.existingSecret.enabled }}
73+
name: {{ .Values.statping.admin.existingSecret.name | quote }}
74+
key: {{ .Values.statping.admin.existingSecret.emailKey | quote }}
75+
{{- else }}
76+
name: {{ include "statping.fullname" . }}
77+
key: admin-email
78+
{{- end }}
79+
{{- if eq .Values.postgres.type "kubedb" }}
80+
- name: DB_CONN
81+
value: postgres
82+
- name: DB_HOST
83+
value: postgres-{{ template "statping.fullname" . }}
84+
- name: DB_DATABASE
85+
value: statup
86+
- name: DB_USER
87+
valueFrom:
88+
secretKeyRef:
89+
name: postgres-{{ template "statping.fullname" . }}-auth
90+
key: POSTGRES_USER
91+
- name: DB_PASS
92+
valueFrom:
93+
secretKeyRef:
94+
name: postgres-{{ template "statping.fullname" . }}-auth
95+
key: POSTGRES_PASSWORD
96+
{{- end }}
97+
{{- with .Values.env }}
98+
{{- toYaml . | nindent 12 }}
99+
{{- end }}
100+
ports:
101+
- name: http
102+
containerPort: 8080
103+
protocol: TCP
104+
livenessProbe:
105+
httpGet:
106+
path: /
107+
port: http
108+
readinessProbe:
109+
httpGet:
110+
path: /
111+
port: http
112+
volumeMounts:
113+
- mountPath: /app
114+
name: config
115+
{{- if .Values.persistence.subPath }}
116+
subPath: {{ .Values.persistence.subPath }}
117+
{{- end }}
118+
{{- if .Values.additionalVolumeMounts }}
119+
{{- toYaml .Values.additionalVolumes | nindent 12 }}
120+
{{- end }}
121+
resources:
122+
{{- toYaml .Values.resources | nindent 12 }}
123+
volumes:
124+
- name: config
125+
{{- if .Values.persistence.enabled }}
126+
persistentVolumeClaim:
127+
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "statping.fullname" . }}{{- end }}
128+
{{- else }}
129+
emptyDir: {}
130+
{{- end }}
131+
{{- if .Values.additionalVolumes }}
132+
{{- toYaml .Values.additionalVolumes | nindent 8 }}
133+
{{- end }}
134+
{{- with .Values.nodeSelector }}
135+
nodeSelector:
136+
{{- toYaml . | nindent 8 }}
137+
{{- end }}
138+
{{- with .Values.affinity }}
139+
affinity:
140+
{{- toYaml . | nindent 8 }}
141+
{{- end }}
142+
{{- with .Values.tolerations }}
143+
tolerations:
144+
{{- toYaml . | nindent 8 }}
145+
{{- end }}
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{{- if .Values.autoscaling.enabled }}
2+
apiVersion: autoscaling/v2beta1
3+
kind: HorizontalPodAutoscaler
4+
metadata:
5+
name: {{ include "statping.fullname" . }}
6+
labels:
7+
{{- include "statping.labels" . | nindent 4 }}
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: {{ include "statping.fullname" . }}
13+
minReplicas: {{ .Values.autoscaling.minReplicas }}
14+
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
15+
metrics:
16+
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
17+
- type: Resource
18+
resource:
19+
name: cpu
20+
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
21+
{{- end }}
22+
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
23+
- type: Resource
24+
resource:
25+
name: memory
26+
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
27+
{{- end }}
28+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "statping.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
5+
apiVersion: networking.k8s.io/v1beta1
6+
{{- else -}}
7+
apiVersion: extensions/v1beta1
8+
{{- end }}
9+
kind: Ingress
10+
metadata:
11+
name: {{ $fullName }}
12+
labels:
13+
{{- include "statping.labels" . | nindent 4 }}
14+
{{- with .Values.ingress.annotations }}
15+
annotations:
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
spec:
19+
{{- if .Values.ingress.tls }}
20+
tls:
21+
{{- range .Values.ingress.tls }}
22+
- hosts:
23+
{{- range .hosts }}
24+
- {{ . | quote }}
25+
{{- end }}
26+
secretName: {{ .secretName }}
27+
{{- end }}
28+
{{- end }}
29+
rules:
30+
{{- range .Values.ingress.hosts }}
31+
- host: {{ .host | quote }}
32+
http:
33+
paths:
34+
{{- range .paths }}
35+
- path: {{ . }}
36+
backend:
37+
serviceName: {{ $fullName }}
38+
servicePort: {{ $svcPort }}
39+
{{- end }}
40+
{{- end }}
41+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if eq .Values.postgres.type "kubedb" }}
2+
apiVersion: kubedb.com/v1alpha1
3+
kind: Postgres
4+
metadata:
5+
name: postgres-{{ template "statping.fullname" . }}
6+
spec:
7+
version: {{ .Values.postgres.kubedb.version }}
8+
storageType: {{ .Values.postgres.kubedb.storageType }}
9+
{{- with .Values.postgres.kubedb.storage }}
10+
storage:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{- if not .Values.statping.admin.existingSecret.enabled }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ template "statping.fullname" . }}
6+
labels:
7+
{{- include "statping.labels" . | nindent 4 }}
8+
type: Opaque
9+
data:
10+
admin-user: {{ .Values.statping.admin.user | default "admin" }}
11+
admin-password: {{ randAlphaNum 16 | b64enc | quote }}
12+
admin-email: {{ .Values.statping.admin.email | default "[email protected]" }}
13+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "statping.fullname" . }}
5+
labels:
6+
{{- include "statping.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
selector:
15+
{{- include "statping.selectorLabels" . | nindent 4 }}

0 commit comments

Comments
 (0)