feat: add helm chart to deploy application
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
parent
ee7e26e880
commit
74080a9e26
23
chart/.helmignore
Normal file
23
chart/.helmignore
Normal file
@ -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/
|
||||
7
chart/Chart.yaml
Normal file
7
chart/Chart.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
apiVersion: v2
|
||||
name: argo-vault-demo
|
||||
description: A Helm chart for deploying a demo application that integrates with Argo and Vault.
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1.0.0"
|
||||
|
||||
54
chart/templates/application.yaml
Normal file
54
chart/templates/application.yaml
Normal file
@ -0,0 +1,54 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
|
||||
metadata:
|
||||
name: {{ .Values.application.name }}
|
||||
namespace: {{ .Values.common.namespace }}
|
||||
labels:
|
||||
app: {{ .Values.application.name }}
|
||||
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Values.application.name }}
|
||||
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.application.name }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Values.application.name }}
|
||||
image: {{ .Values.application.image }}:{{ .Values.application.tag | default "latest" }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.application.ports.containerPort }}
|
||||
name: {{ .Values.application.ports.name }}
|
||||
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: spring_profile
|
||||
- name: SPRING_DATASOURCE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_url
|
||||
- name: SPRING_DATASOURCE_DRIVER_CLASS_NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_driver_class
|
||||
|
||||
- name: SPRING_DATASOURCE_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_username
|
||||
|
||||
- name: SPRING_DATASOURCE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_password
|
||||
58
chart/templates/mysql-deploy.yaml
Normal file
58
chart/templates/mysql-deploy.yaml
Normal file
@ -0,0 +1,58 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
|
||||
metadata:
|
||||
name: {{ .Values.database.name }}
|
||||
namespace: {{ .Values.common.namespace }}
|
||||
labels:
|
||||
app: {{ .Values.database.name }}
|
||||
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Values.database.name }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Values.database.name }}
|
||||
image: {{ .Values.database.image }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.database.ports.containerPort }}
|
||||
name: {{ .Values.database.ports.name }}
|
||||
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_root_password
|
||||
- name: MYSQL_DATABASE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: default_database
|
||||
- name: MYSQL_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_username
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.common.secretName }}
|
||||
key: database_password
|
||||
|
||||
volumeMounts:
|
||||
- name: {{ .Values.database.volume.name }}
|
||||
mountPath: {{ .Values.database.volume.mountPath }}
|
||||
|
||||
volumes:
|
||||
{{- if .Values.database.persistence.enabled }}
|
||||
- name: {{ .Values.database.volume.name }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Values.database.persistence.existingClaim | default .Values.database.persistence.claimName }}
|
||||
{{- else }}
|
||||
- name: {{ .Values.database.volume.name }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
|
||||
15
chart/templates/mysql-pvc.yaml
Normal file
15
chart/templates/mysql-pvc.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
{{- if and .Values.database.persistence.enabled (not .Values.database.persistence.existingClaim) }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Values.database.persistence.claimName }}
|
||||
namespace: {{ .Values.common.namespace }}
|
||||
|
||||
spec:
|
||||
accessModes:
|
||||
{{ toYaml .Values.database.persistence.accessModes | nindent 4 }}
|
||||
storageClassName: {{ required "database.persistence.claimName 값을 설정해주세요." .Values.database.persistence.storageClassName }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.database.persistence.size }}
|
||||
{{- end }}
|
||||
18
chart/templates/secrets.yaml
Normal file
18
chart/templates/secrets.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
|
||||
metadata:
|
||||
name: {{ .Values.common.secretName }}
|
||||
|
||||
type: 0paque
|
||||
|
||||
stringData:
|
||||
spring_profile: "deploy"
|
||||
default_database: "<path:demo/data/application#db_default_database>"
|
||||
database_driver_class: "<path:demo/data/application#db_driver_class>"
|
||||
database_url: "<path:demo/data/application#db_url>"
|
||||
database_root_password: "<path:demo/data/application#db_root_password>"
|
||||
database_username: "<path:demo/data/application#db_username>"
|
||||
database_password: "<path:demo/data/application#db_password>"
|
||||
|
||||
|
||||
31
chart/templates/services.yaml
Normal file
31
chart/templates/services.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
metadata:
|
||||
name: {{ .Values.database.name }}-service
|
||||
labels:
|
||||
app: {{ .Values.database.name }}
|
||||
|
||||
spec:
|
||||
type: {{ .Values.database.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.database.service.port }}
|
||||
selector:
|
||||
app: {{ .Values.database.name }}
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
metadata:
|
||||
name: {{ .Values.application.name }}-service
|
||||
labels:
|
||||
app: {{ .Values.application.name }}
|
||||
|
||||
spec:
|
||||
type: {{ .Values.application.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.application.service.port }}
|
||||
selector:
|
||||
app: {{ .Values.application.name }}
|
||||
42
chart/values.yaml
Normal file
42
chart/values.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
common:
|
||||
namespace: argo-vault-demo
|
||||
secretName: argo-vault-demo-secret
|
||||
|
||||
database:
|
||||
image: mysql:8.4
|
||||
name: mysql
|
||||
ports:
|
||||
containerPort: 3306
|
||||
name: mysql
|
||||
persistence:
|
||||
# false로 설정 시 emptyDir를 사용합니다.
|
||||
enabled: false
|
||||
|
||||
# 기존의 PVC를 사용하려면 이 값에 PVC 이름을 입력하세요.
|
||||
existingClaim: ""
|
||||
|
||||
# 새로운 PVC를 생성하려면 아래 값을 설정하세요.
|
||||
claimName: ""
|
||||
storageClassName: ""
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 512Mi
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 3306
|
||||
|
||||
volume:
|
||||
name: mysql-data
|
||||
mountPath: /var/lib/mysql
|
||||
|
||||
application:
|
||||
name: argo-vault-demo
|
||||
image: argo-vault-demo
|
||||
tag: latest
|
||||
ports:
|
||||
containerPort: 8080
|
||||
name: application
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
Loading…
x
Reference in New Issue
Block a user