mirror of
https://github.com/ClaperCo/Claper.git
synced 2026-05-18 05:05:39 +02:00
Add charts templates for k8s config
Add in prod config libcluster:
config :libcluster,
topologies: [
default: [
strategy: Cluster.Strategy.Kubernetes,
config: [
mode: :dns,
kubernetes_node_basename: "claper",
kubernetes_selector: "app=claper",
kubernetes_namespace: "default",
polling_interval: 10_000
]
]
]
This commit is contained in:
5
charts/claper/Chart.yaml
Normal file
5
charts/claper/Chart.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
appVersion: 1.0.0
|
||||||
|
description: Claper app
|
||||||
|
name: claper
|
||||||
|
version: 1.0.0
|
||||||
31
charts/claper/templates/_env.yaml
Normal file
31
charts/claper/templates/_env.yaml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{{- define "env" -}}
|
||||||
|
- name: SECRET_KEY_BASE
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: claper-secret
|
||||||
|
key: secret-key-base
|
||||||
|
- name: POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.podIP
|
||||||
|
- name: NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: ENDPOINT_HOST
|
||||||
|
value: claper.co
|
||||||
|
- name: DATABASE_URL
|
||||||
|
value: postgresql://claper:claper@10.0.0.6:6432/claper
|
||||||
|
- name: AWS_ACCESS_KEY_ID
|
||||||
|
value: XXX
|
||||||
|
- name: AWS_PRES_BUCKET
|
||||||
|
value: XXX
|
||||||
|
- name: POOL_SIZE
|
||||||
|
value: "20"
|
||||||
|
- name: AWS_REGION
|
||||||
|
value: eu-west-3
|
||||||
|
- name: AWS_SECRET_ACCESS_KEY
|
||||||
|
value: XXX
|
||||||
|
- name: PRESENTATION_STORAGE
|
||||||
|
value: s3
|
||||||
|
{{- end -}}
|
||||||
18
charts/claper/templates/autoscaling.yaml
Normal file
18
charts/claper/templates/autoscaling.yaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
apiVersion: autoscaling/v2beta2
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: claper-hpa
|
||||||
|
spec:
|
||||||
|
maxReplicas: 5
|
||||||
|
minReplicas: 1
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: claper-app
|
||||||
|
metrics:
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: cpu
|
||||||
|
target:
|
||||||
|
type: Utilization
|
||||||
|
averageUtilization: 50
|
||||||
37
charts/claper/templates/deployment.yaml
Normal file
37
charts/claper/templates/deployment.yaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: claper-app
|
||||||
|
labels:
|
||||||
|
app: claper
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: claper
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: claper
|
||||||
|
spec:
|
||||||
|
serviceAccountName: sa-claper
|
||||||
|
containers:
|
||||||
|
- name: claper
|
||||||
|
image: ghcr.io/claperco/claper:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "300m"
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 4000
|
||||||
|
initialDelaySeconds: 60
|
||||||
|
periodSeconds: 20
|
||||||
|
ports:
|
||||||
|
- containerPort: 4000
|
||||||
|
- name: epmd
|
||||||
|
containerPort: 4369
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
{{ include "env" . | indent 10 }}
|
||||||
13
charts/claper/templates/headless.yaml
Normal file
13
charts/claper/templates/headless.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: claper-svc-headless
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 4369
|
||||||
|
targetPort: epmd
|
||||||
|
protocol: TCP
|
||||||
|
name: epmd
|
||||||
|
selector:
|
||||||
|
app: claper
|
||||||
|
clusterIP: None
|
||||||
23
charts/claper/templates/ingress.yaml
Normal file
23
charts/claper/templates/ingress.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: claper-ingress
|
||||||
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: nginx
|
||||||
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
|
spec:
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- claper.co
|
||||||
|
secretName: claper-tls
|
||||||
|
rules:
|
||||||
|
- host: claper.co
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- pathType: Prefix
|
||||||
|
path: "/"
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: claper-svc
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
29
charts/claper/templates/rbac.yaml
Normal file
29
charts/claper/templates/rbac.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: sa-claper
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: Role
|
||||||
|
metadata:
|
||||||
|
name: role-claper
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- endpoints
|
||||||
|
verbs:
|
||||||
|
- list
|
||||||
|
- get
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: RoleBinding
|
||||||
|
metadata:
|
||||||
|
name: rb-claper
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Role
|
||||||
|
name: role-claper
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: sa-claper
|
||||||
17
charts/claper/templates/service.yaml
Normal file
17
charts/claper/templates/service.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: claper-svc
|
||||||
|
labels:
|
||||||
|
app: claper
|
||||||
|
spec:
|
||||||
|
type: ClusterIP
|
||||||
|
ports:
|
||||||
|
- name: cowboy
|
||||||
|
port: 80
|
||||||
|
targetPort: 4000
|
||||||
|
- port: 4369
|
||||||
|
name: epmd
|
||||||
|
targetPort: 4369
|
||||||
|
selector:
|
||||||
|
app: claper
|
||||||
Reference in New Issue
Block a user