Skip to content
Snippets Groups Projects
Commit 1bca35d4 authored by Sean Fredrick Cruz's avatar Sean Fredrick Cruz
Browse files

Add task-app Helm chart as regular directory

parent 950c5930
No related branches found
No related tags found
No related merge requests found
Pipeline #67363 passed with stage
in 1 minute and 26 seconds
# 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/
apiVersion: v2
name: task-app
description: Task Management Application
# 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.0.0"
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-backend
labels:
app: backend
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.backend.replicaCount }}
selector:
matchLabels:
app: backend
release: {{ .Release.Name }}
template:
metadata:
labels:
app: backend
release: {{ .Release.Name }}
spec:
containers:
- name: backend
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}"
imagePullPolicy: {{ .Values.backend.image.pullPolicy | default "IfNotPresent" }}
ports:
- containerPort: 3000
env:
- name: NODE_ENV
value: {{ .Values.backend.env.NODE_ENV }}
- name: DB_HOST
value: {{ .Release.Name }}-database
- name: DB_PORT
value: "{{ .Values.database.service.port }}"
- name: DB_NAME
value: {{ .Values.backend.env.DB_NAME }}
- name: DB_USER
value: {{ .Values.backend.env.DB_USER }}
- name: DB_PASSWORD
value: {{ .Values.backend.env.DB_PASSWORD }}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-backend
labels:
app: backend
release: {{ .Release.Name }}
spec:
type: {{ .Values.backend.service.type }}
ports:
- port: {{ .Values.backend.service.port }}
targetPort: 3000
protocol: TCP
name: http
selector:
app: backend
release: {{ .Release.Name }}
\ No newline at end of file
{{- if .Values.database.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-database
labels:
app: database
release: {{ .Release.Name }}
spec:
replicas: 1 # Database typically has only one replica
selector:
matchLabels:
app: database
release: {{ .Release.Name }}
template:
metadata:
labels:
app: database
release: {{ .Release.Name }}
spec:
containers:
- name: database
image: "{{ .Values.database.image.repository }}:{{ .Values.database.image.tag }}"
ports:
- containerPort: 5432
env:
- name: POSTGRES_DB
value: {{ .Values.database.env.POSTGRES_DB }}
- name: POSTGRES_USER
value: {{ .Values.database.env.POSTGRES_USER }}
- name: POSTGRES_PASSWORD
value: {{ .Values.database.env.POSTGRES_PASSWORD }}
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
- name: init-script
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: data
{{- if .Values.database.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Release.Name }}-database-pvc
- name: init-script
configMap:
name: {{ .Release.Name }}-db-init
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-db-init
labels:
app: database
release: {{ .Release.Name }}
data:
init.sql: |
CREATE TABLE IF NOT EXISTS tasks (
id SERIAL PRIMARY KEY,
title VARCHAR(255) NOT NULL,
description TEXT,
status VARCHAR(50) DEFAULT 'Todo',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Add some initial tasks
INSERT INTO tasks (title, description, status) VALUES
('Set up database', 'Configure PostgreSQL', 'Done'),
('Write API endpoints', 'Create REST API with Express', 'Todo'),
('Complete frontend', 'Implement React components', 'In Progress');
\ No newline at end of file
{{- if and .Values.database.enabled .Values.database.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Release.Name }}-database-pvc
labels:
app: database
release: {{ .Release.Name }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.database.persistence.size }}
{{- end }}
\ No newline at end of file
{{- if .Values.database.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-database
labels:
app: database
release: {{ .Release.Name }}
spec:
type: ClusterIP
ports:
- port: {{ .Values.database.service.port }}
targetPort: 5432
protocol: TCP
name: postgresql
selector:
app: database
release: {{ .Release.Name }}
{{- end }}
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-frontend
labels:
app: frontend
release: {{ .Release.Name }}
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
app: frontend
release: {{ .Release.Name }}
template:
metadata:
labels:
app: frontend
release: {{ .Release.Name }}
spec:
containers:
- name: frontend
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy | default "IfNotPresent" }}
ports:
- containerPort: 3000
env:
- name: REACT_APP_API_URL
value: "http://localhost:3001/api"
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-frontend
labels:
app: frontend
release: {{ .Release.Name }}
spec:
type: {{ .Values.frontend.service.type }}
ports:
- port: {{ .Values.frontend.service.port }}
targetPort: 3000
protocol: TCP
name: http
selector:
app: frontend
release: {{ .Release.Name }}
\ No newline at end of file
# Global settings
global:
environment: development
# Frontend configuration
frontend:
replicaCount: 1
image:
repository: frontend
tag: latest
pullPolicy: Never
service:
type: ClusterIP
port: 3000 # Using React's dev server port
# Backend configuration
backend:
replicaCount: 1
image:
repository: backend
tag: latest
pullPolicy: Never
service:
type: ClusterIP
port: 3000
env:
NODE_ENV: development
DB_HOST: database
DB_PORT: 5432
DB_NAME: taskdb
DB_USER: postgres
DB_PASSWORD: postgres
# Database configuration
database:
enabled: true
image:
repository: postgres
tag: "13-alpine"
service:
port: 5432
persistence:
enabled: true
size: 1Gi
env:
POSTGRES_DB: taskdb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment