Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(helm): add helm chart #2

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: negar
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
13 changes: 13 additions & 0 deletions templates/configmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: db-configs
labels:
app: postgres
data:
POSTGRES_DB: "postgres"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
HOST: "postgres"
PORT: "{{ .Values.postgres.port }}"
POSTGRES_CONNECTION_STRING: "Host=postgres;Database=postgres;Username=postgres;Password=postgres;"
55 changes: 55 additions & 0 deletions templates/deployment-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
spec:
replicas: {{ .Values.backend.replicaCount }}
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
spec:
imagePullSecrets:
- name: {{ .Values.abrimentImagePullSecret.name }}
initContainers:
- name: migrate
image: {{ .Values.backend.repository }}:{{ .Values.backend.tag }}
imagePullPolicy: {{ .Values.backend.pullPolicy }}
env:
- name: CONNECTION_STRING
valueFrom:
configMapKeyRef:
name: db-configs
key: POSTGRES_CONNECTION_STRING
command: ["dotnet", "./RelationAnalysis.Migrations.dll"]
ports:
- containerPort: {{ .Values.backend.port }}
resources:
requests:
memory: {{ .Values.backend.resources.requests.memory }}
cpu: {{ .Values.backend.resources.requests.cpu }}
limits:
memory: {{ .Values.backend.resources.limits.memory }}
cpu: {{ .Values.backend.resources.limits.cpu }}
containers:
- name: backend
image: {{ .Values.backend.repository }}:{{ .Values.backend.tag }}
imagePullPolicy: {{ .Values.backend.pullPolicy }}
env:
- name: CONNECTION_STRING
valueFrom:
configMapKeyRef:
name: db-configs
key: POSTGRES_CONNECTION_STRING
ports:
- containerPort: {{ .Values.backend.port }}
resources:
requests:
memory: {{ .Values.backend.resources.requests.memory }}
cpu: {{ .Values.backend.resources.requests.cpu }}
limits:
memory: {{ .Values.backend.resources.limits.memory }}
cpu: {{ .Values.backend.resources.limits.cpu }}
29 changes: 29 additions & 0 deletions templates/deployment-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
imagePullSecrets:
- name: {{ .Values.abrimentImagePullSecret.name }}
containers:
- name: frontend
image: {{ .Values.frontend.repository }}:{{ .Values.frontend.tag }}
imagePullPolicy: {{ .Values.frontend.pullPolicy }}
ports:
- containerPort: {{ .Values.frontend.port }}
resources:
requests:
memory: {{ .Values.frontend.resources.requests.memory }}
cpu: {{ .Values.frontend.resources.requests.cpu }}
limits:
memory: {{ .Values.frontend.resources.limits.memory }}
cpu: {{ .Values.frontend.resources.limits.cpu }}
60 changes: 60 additions & 0 deletions templates/deployment-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
spec:
replicas: {{ .Values.postgres.replicaCount }}
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: {{ .Values.postgres.repository }}:{{ .Values.postgres.tag }}
imagePullPolicy: {{ .Values.postgres.pullPolicy }}
ports:
- containerPort: {{ .Values.postgres.port }}
env:
- name: POSTGRES_USER
valueFrom:
configMapKeyRef:
name: db-configs
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
configMapKeyRef:
name: db-configs
key: POSTGRES_PASSWORD
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: db-configs
key: POSTGRES_DB
- name: HOST
valueFrom:
configMapKeyRef:
name: db-configs
key: HOST
- name: PORT
valueFrom:
configMapKeyRef:
name: db-configs
key: PORT
volumeMounts:
- mountPath: /var/lib/postgres/data
name: db-data
resources:
requests:
memory: {{ .Values.postgres.resources.requests.memory }}
cpu: {{ .Values.postgres.resources.requests.cpu }}
limits:
memory: {{ .Values.postgres.resources.limits.memory }}
cpu: {{ .Values.postgres.resources.limits.cpu }}
volumes:
- name: db-data
persistentVolumeClaim:
claimName: db-persistent-pvc
27 changes: 27 additions & 0 deletions templates/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
namespace: 0b12e0d24d4541c097bbaab164438125-negar
labels:
app: nginxn
spec:
ingressClassName: my-ingress
rules:
- host: noice.abriment.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: back-service
port:
number: {{ .Values.backend.service.port }}
- path: /
pathType: Prefix
backend:
service:
name: front-service
port:
number: {{ .Values.frontend.service.port }}
10 changes: 10 additions & 0 deletions templates/pvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#apiVersion: v1
#kind: PersistentVolumeClaim
#metadata:
# name: db-persistent-pvc
#spec:
# accessModes:
# - ReadWriteOnce
# resources:
# requests:
# storage: {{ .Values.postgres.pvc.storage }}
11 changes: 11 additions & 0 deletions templates/service-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: back-service
spec:
type: {{ .Values.backend.service.type }}
selector:
app: backend
ports:
- port: {{ .Values.backend.port }}
targetPort: {{ .Values.backend.service.port }}
11 changes: 11 additions & 0 deletions templates/service-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: front-service
spec:
type: {{ .Values.frontend.service.type }}
selector:
app: frontend
ports:
- port: {{ .Values.frontend.service.port }}
targetPort: {{ .Values.frontend.port }}
11 changes: 11 additions & 0 deletions templates/service-postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
type: {{ .Values.postgres.service.type }}
ports:
- port: {{ .Values.postgres.port }}
targetPort: {{ .Values.postgres.service.port }}
selector:
app: postgres
68 changes: 68 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
backend:
#repository: registry.abriment.com/mhch/negar-backend
repository: docker.arvancloud.ir/mhchah/imagebuilder
#repository: negar-backend
pullPolicy: IfNotPresent
#pullPolicy: Always
tag: v0.0.3
replicaCount: 1
port: 80

service:
type: ClusterIP
port: 80

resources:
requests:
memory: "3000Mi"
cpu: "2000m"
limits:
memory: "3000Mi"
cpu: "2000m"

postgres:
repository: postgres
tag: "16.3"
pullPolicy: IfNotPresent
replicaCount: 1
port: 5432

service:
type: ClusterIP
port: 5432

resources:
requests:
memory: "3000Mi"
cpu: "2000m"
limits:
memory: "3000Mi"
cpu: "2000m"
pvc:
storage: "3Gi"

frontend:
# repository: docker.arvancloud.ir/mhchah/negar-frontend
#repository: negar-frontend
repository: docker.arvancloud.ir/mhchah/imagebuilder
pullPolicy: IfNotPresent
# tag: v0.11.3
tag: v0.0.8
replicaCount: 1
port: 80

service:
type: ClusterIP
port: 80

resources:
requests:
memory: "3000Mi"
cpu: "2000m"
limits:
memory: "3000Mi"
cpu: "2000m"

abrimentImagePullSecret:
name: negar-abrsecret

Loading