-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from KisCsaj68/feature/helm-chart-api
feat: helm chart for api
- Loading branch information
Showing
11 changed files
with
401 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: api | ||
description: A Helm chart for Kubernetes | ||
type: application | ||
version: 0.1.0 | ||
appVersion: "0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "api.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "api.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "api.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "api.labels" -}} | ||
helm.sh/chart: {{ include "api.chart" . }} | ||
{{ include "api.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "api.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "api.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "api.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "api.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "api.fullname" . }} | ||
data: | ||
application.properties: | | ||
# database connection details | ||
spring.datasource.driver-class-name = org.postgresql.Driver | ||
spring.datasource.url = jdbc:postgresql://{{ .Values.pg.host }}.{{ .Release.Namespace }}.svc:{{ .Values.pg.port }}/quokka | ||
spring.datasource.username = {{ .Values.pg.user }} | ||
spring.datasource.password = {{ .Values.pg.password }} | ||
# JPA details | ||
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQL94Dialect | ||
spring.jpa.show-sql = false | ||
spring.jpa.hibernate.ddl-auto = none | ||
spring.h2.console.enabled = true | ||
spring.h2.console.path = /h2-console | ||
spring.jpa.hibernate.naming.implicit-strategy = org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl | ||
spring.jpa.properties.hibernate.format_sql = true | ||
# asset cache address | ||
quokka.service.assetcache.address = http://{{ .Values.services.assetCache.host }}.{{ .Release.Namespace }}.svc:{{ .Values.services.assetCache.port }} | ||
quokka.service.assetcache.endpoint = {{ .Values.services.assetCache.endpoint }} | ||
#logging.level.org.springframework.security = DEBUG | ||
# oms address | ||
quokka.service.oms.address = http://{{ .Values.services.oms.host }}.{{ .Release.Namespace }}.svc:{{ .Values.services.oms.port }} | ||
quokka.service.oms.endpoint = {{ .Values.services.oms.endpoint }} | ||
# api auth address | ||
quokka.controller.auth.endpoint = {{ .Values.api.auth.endpoint }} | ||
# JWT | ||
application.jwt.secretKey = {{ .Values.api.auth.jwt.secretKey }} | ||
application.jwt.tokenPrefix = {{ .Values.api.auth.jwt.prefix }} | ||
application.jwt.tokenExpirationAfterDays = {{ .Values.api.auth.jwt.expirationDays }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "api.fullname" . }} | ||
labels: | ||
{{- include "api.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "api.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "api.labels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "api.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
command: ["java"] | ||
args: | ||
- "-jar" | ||
- "./api-0.0.1-SNAPSHOT-jar-with-dependencies.jar" | ||
- "-Dspring.config.location=/api/config/application.properties,/api/secret/config/application.secret.properties" | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
{{- toYaml .Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumeMounts: | ||
- name: app-config | ||
mountPath: /api/config | ||
- name: app-secret-config | ||
mountPath: /api/secret/config | ||
|
||
volumes: | ||
- name: app-config | ||
configMap: | ||
name: {{ include "api.fullname" . }} | ||
- name: app-secret-config | ||
secret: | ||
name: {{ include "api.fullname" . }} | ||
|
||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "api.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "api.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
ingressClassName: {{ .Values.ingress.className }} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
- host: {{ .Values.ingress.host | quote }} | ||
http: | ||
paths: | ||
- path: /api/v1 | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ include "api.fullname" . }} | ||
stringData: | ||
application.secret.properties: | | ||
# database connection details | ||
spring.datasource.password = {{ .Values.pg.password }} | ||
# JWT | ||
application.jwt.secretKey = {{ .Values.api.auth.jwt.secretKey }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "api.fullname" . }} | ||
labels: | ||
{{- include "api.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "api.selectorLabels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "api.serviceAccountName" . }} | ||
labels: | ||
{{- include "api.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }} | ||
{{- end }} |
Oops, something went wrong.