-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* basic kb chart * cleaned up ingress.yaml * added values-test.yaml to template each file
- Loading branch information
Showing
9 changed files
with
411 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,6 @@ | ||
apiVersion: v2 | ||
name: knowledge-base | ||
description: Knowledge Base frontend and API/backend | ||
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,51 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "knowledge-base.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 "knowledge-base.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 "knowledge-base.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "knowledge-base.labels" -}} | ||
helm.sh/chart: {{ include "knowledge-base.chart" . }} | ||
{{ include "knowledge-base.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "knowledge-base.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "knowledge-base.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- 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,24 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "knowledge-base.fullname" . }} | ||
labels: | ||
{{- include "knowledge-base.labels" . | nindent 4 }} | ||
data: | ||
application.yml: |- | ||
sophora: | ||
client: | ||
server-connection: | ||
urls: | ||
{{- range .Values.api.sophora.connection.urls }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
tool-info: | ||
name: "knowledge-base-backend" | ||
server: | ||
port: 8181 | ||
spring: | ||
groovy: | ||
template: | ||
check-template-location: false |
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,76 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: "{{ include "knowledge-base.fullname" . }}-api" | ||
labels: | ||
{{- include "knowledge-base.labels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
{{- include "knowledge-base.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
"cluster-autoscaler.kubernetes.io/safe-to-evict": "true" | ||
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }} | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "knowledge-base.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
restartPolicy: Always | ||
containers: | ||
- name: "{{ .Chart.Name }}-api" | ||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.api.image.pullPolicy }} | ||
volumeMounts: | ||
- name: config | ||
mountPath: "/workspace/application.yml" | ||
subPath: "application.yml" | ||
env: | ||
- name: sophora.client.server-connection.username | ||
valueFrom: | ||
secretKeyRef: | ||
key: {{ .Values.api.sophora.authentication.secret.usernameKey }} | ||
name: {{ required "A valid secret name must be provided in .Values.api.sophora.authentication.secret.name" .Values.api.sophora.authentication.secret.name | quote }} | ||
- name: sophora.client.server-connection.password | ||
valueFrom: | ||
secretKeyRef: | ||
key: {{ .Values.api.sophora.authentication.secret.passwordKey }} | ||
name: {{ required "A valid secret name must be provided in .Values.api.sophora.authentication.secret.name" .Values.api.sophora.authentication.secret.name | quote }} | ||
ports: | ||
- name: http | ||
containerPort: 8181 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
resources: | ||
{{- toYaml .Values.api.container.resources | nindent 12 }} | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: {{ include "knowledge-base.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,63 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: "{{ include "knowledge-base.fullname" . }}-frontend" | ||
labels: | ||
{{- include "knowledge-base.labels" . | nindent 4 }} | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
{{- include "knowledge-base.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
"cluster-autoscaler.kubernetes.io/safe-to-evict": "true" | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "knowledge-base.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
restartPolicy: Always | ||
containers: | ||
- name: "{{ .Chart.Name }}-frontend" | ||
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} | ||
env: | ||
- name: API_ADDRESS | ||
value: {{ .Values.frontend.apiBaseAddress }} | ||
ports: | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
resources: | ||
{{- toYaml .Values.frontend.container.resources | nindent 12 }} | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: {{ include "knowledge-base.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,41 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "knowledge-base.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "knowledge-base.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.ingressClassName }} | ||
ingressClassName: {{ .Values.ingress.ingressClassName }} | ||
{{- end -}} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- 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,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "knowledge-base.fullname" . }} | ||
labels: | ||
{{- include "knowledge-base.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "knowledge-base.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,68 @@ | ||
frontend: | ||
image: | ||
repository: docker.subshell.com/labday/knowledge-base/kb-frontend | ||
pullPolicy: Always | ||
tag: "1.0.0" | ||
container: | ||
resources: | ||
requests: | ||
cpu: 999m | ||
memory: 123Mi | ||
limits: | ||
cpu: 888m | ||
memory: 4321Mi | ||
apiBaseAddress: "test-api.address" | ||
|
||
api: | ||
image: | ||
repository: docker.subshell.com/labday/knowledge-base/kb-api | ||
pullPolicy: Always | ||
tag: "1.0.0" | ||
container: | ||
resources: | ||
requests: | ||
cpu: 222m | ||
memory: 42Mi | ||
limits: | ||
cpu: 333m | ||
memory: 1337Mi | ||
sophora: | ||
connection: | ||
urls: | ||
- "http://sophora-server1" | ||
- "http://sophora-server2" | ||
authentication: | ||
secret: | ||
name: "knowledge-base-sophora-credentials" | ||
usernameKey: "sophora-user" | ||
passwordKey: "sophora-password" | ||
|
||
imagePullSecrets: [] | ||
nameOverride: "testNameOverride" | ||
fullnameOverride: "fullTestNameOverride" | ||
|
||
podAnnotations: | ||
my/test/annotation: "foo" | ||
my/other/annotation: "bar" | ||
|
||
service: | ||
type: ClusterIP | ||
port: 80 | ||
|
||
ingress: | ||
enabled: true | ||
annotations: | ||
kubernetes.io/ingress.class: nginx | ||
# kubernetes.io/tls-acme: "true" | ||
hosts: | ||
- host: frontend.knowledge-base.test | ||
tls: [] | ||
# - secretName: chart-example-tls | ||
# hosts: | ||
# - chart-example.local | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |
Oops, something went wrong.