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

Various chart improvements #33

Merged
merged 1 commit into from
Mar 5, 2022
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
9 changes: 9 additions & 0 deletions helm/featurehub/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.0.5
- name: nats
repository: https://nats-io.github.io/k8s/helm/charts/
version: 0.13.1
digest: sha256:ba62bc3579a52f4b375a9ccbacef334129259516b2ff34de591347663af5e610
generated: "2022-02-28T15:29:12.110834078Z"
12 changes: 11 additions & 1 deletion helm/featurehub/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ description: FeatureHub Release

type: application

version: 1.5.6
version: 2.0.0

appVersion: "1.5.6"

dependencies:
- name: postgresql
version: 11.0.5
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: nats
version: 0.13.1
repository: https://nats-io.github.io/k8s/helm/charts/
condition: nats.enabled
33 changes: 26 additions & 7 deletions helm/featurehub/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "featurehub.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 "featurehub.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.
Expand Down Expand Up @@ -41,13 +62,13 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}


{{- define "featurehub.managementRepository.name" -}}
{{- default (.Values.managementRepository.name) "management-repository" }}
{{- printf "%s-%s" (include "featurehub.fullname" .) "management-repository" }}
{{- end }}
{{- define "featurehub.edge.name" -}}
{{- default (.Values.managementRepository.name) "edge" }}
{{- printf "%s-%s" (include "featurehub.fullname" .) "edge" }}
{{- end }}
{{- define "featurehub.dacha.name" -}}
{{- default (.Values.managementRepository.name) "dacha" }}
{{- printf "%s-%s" (include "featurehub.fullname" .) "dacha" }}
{{- end }}

{{/*
Expand All @@ -57,19 +78,17 @@ Selector labels
app.kubernetes.io/name: {{ include "featurehub.managementRepository.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "featurehub.edge.selectorLabels" -}}
app.kubernetes.io/name: {{ include "featurehub.edge.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "featurehub.dacha.selectorLabels" -}}
app.kubernetes.io/name: {{ include "featurehub.dacha.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "featurehub.fullname" -}}
{{- default (.Chart.Name) .Values.fullnameOverride }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
Expand Down
2 changes: 1 addition & 1 deletion helm/featurehub/templates/api-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
name: {{ include "featurehub.fullname" . }}-app-config
data:
application.properties: |-
db.url={{ .Values.db.url }}
Expand Down
11 changes: 8 additions & 3 deletions helm/featurehub/templates/common-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: common-config
name: {{ include "featurehub.fullname" . }}-common-config
data:
common.properties: |-
nats.urls={{ .Values.nats.serverUrls }}
{{- if typeIs "[]string" .Values.nats.urls }}
nats.urls={{ .Values.nats.urls | join "," }}
{{- else if typeIs "string" .Values.nats.urls }}
nats.urls={{ .Values.nats.urls }}
{{- else }}
{{- required "A list or string for .Values.nats.urls is required." }}
{{- end }}
jersey.cors.headers=X-Requested-With,Authorization,Content-type,Accept-Version,Content-MD5,CSRF-Token,x-ijt,cache-control,baggage
jersey.logging.exclude-entirely-uris=/health/liveness,/health/readiness,/metrics
log4j2.xml: |-
Expand Down Expand Up @@ -43,4 +49,3 @@ data:
</AsyncRoot>
</Loggers>
</Configuration>

4 changes: 3 additions & 1 deletion helm/featurehub/templates/dacha-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{{- if .Values.dacha.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: dacha-config
name: {{ include "featurehub.fullname" . }}-dacha-config
data:
application.properties: |-
cache.pool-size={{ default 10 .Values.dacha.cacheThreadPoolSize }}
server.port=8600
{{- end }}
20 changes: 12 additions & 8 deletions helm/featurehub/templates/dacha-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{{- if .Values.dacha.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "featurehub.dacha.name" . }}
labels:
{{- include "featurehub.dacha.labels" . | nindent 4 }}
{{- include "featurehub.dacha.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.dacha.replicaCount }}
selector:
matchLabels:
{{- include "featurehub.dacha.selectorLabels" . | nindent 6 }}
{{- include "featurehub.dacha.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/common-config: {{ include (print $.Template.BasePath "/common-config.yaml") . | sha256sum }}
checksum/dacha-config: {{ include (print $.Template.BasePath "/dacha-config.yaml") . | sha256sum }}
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value}}
{{- end }}
labels:
{{- include "featurehub.dacha.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "featurehub.serviceAccountName" . }}
securityContext:
Expand Down Expand Up @@ -62,10 +65,10 @@ spec:
volumes:
- name: app-config
configMap:
name: dacha-config
name: {{ include "featurehub.fullname" . }}-dacha-config
- name: common-config
configMap:
name: common-config
name: {{ include "featurehub.fullname" . }}-common-config
{{- with .Values.dacha.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -78,3 +81,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions helm/featurehub/templates/dacha-service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.dacha.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -13,3 +14,4 @@ spec:
name: http
selector:
{{- include "featurehub.dacha.selectorLabels" . | nindent 4 }}
{{- end }}
5 changes: 3 additions & 2 deletions helm/featurehub/templates/edge-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{- if .Values.edge.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: edge-config
name: {{ include "featurehub.fullname" . }}-edge-config
data:
application.properties: |-
server.port=8553
Expand All @@ -11,4 +12,4 @@ data:
server.gracePeriodInSeconds={{ default 10 .Values.edge.shutdownGracePeriodInSeconds }}
dacha.url.default=http://dacha
monitor.port=8701

{{- end }}
14 changes: 9 additions & 5 deletions helm/featurehub/templates/edge-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.edge.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -11,10 +12,12 @@ spec:
{{- include "featurehub.edge.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/common-config: {{ include (print $.Template.BasePath "/common-config.yaml") . | sha256sum }}
checksum/api-config: {{ include (print $.Template.BasePath "/api-config.yaml") . | sha256sum }}
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value}}
{{- end }}
labels:
{{- include "featurehub.edge.selectorLabels" . | nindent 8 }}
spec:
Expand Down Expand Up @@ -65,10 +68,10 @@ spec:
volumes:
- name: app-config
configMap:
name: edge-config
name: {{ include "featurehub.fullname" . }}-edge-config
- name: common-config
configMap:
name: common-config
name: {{ include "featurehub.fullname" . }}-common-config
{{- with .Values.edge.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand All @@ -81,3 +84,4 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions helm/featurehub/templates/edge-service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.edge.enabled }}
apiVersion: v1
kind: Service
metadata:
Expand All @@ -13,3 +14,4 @@ spec:
name: http
selector:
{{- include "featurehub.edge.selectorLabels" . | nindent 4 }}
{{- end }}
4 changes: 2 additions & 2 deletions helm/featurehub/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: featurehub
name: {{ include "featurehub.fullname" . }}-ingress
labels:
{{- with .Values.ingress.annotations }}
annotations:
Expand Down Expand Up @@ -36,7 +36,7 @@ spec:
pathType: Prefix
backend:
service:
name: {{ include "featurehub.edge.name" . }}
name: {{ .Values.ingress.edgeServiceNameOverride | default (include "featurehub.edge.name" .) }}
port:
name: http
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ spec:
{{- include "featurehub.managementRepository.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
checksum/common-config: {{ include (print $.Template.BasePath "/common-config.yaml") . | sha256sum }}
checksum/api-config: {{ include (print $.Template.BasePath "/api-config.yaml") . | sha256sum }}
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value}}
{{- end }}
labels:
{{- include "featurehub.managementRepository.selectorLabels" . | nindent 8 }}
spec:
Expand All @@ -36,7 +38,7 @@ spec:
valueFrom:
secretKeyRef:
key: db.password
name: password-secret
name: {{ include "featurehub.managementRepository.name" . }}-password-secret
ports:
- name: http
containerPort: 8085
Expand Down Expand Up @@ -71,10 +73,10 @@ spec:
volumes:
- name: app-config
configMap:
name: app-config
name: {{ include "featurehub.fullname" . }}-app-config
- name: common-config
configMap:
name: common-config
name: {{ include "featurehub.fullname" . }}-common-config
{{- with .Values.managementRepository.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: password-secret
name: {{ include "featurehub.managementRepository.name" . }}-password-secret
# this should be mounted differently in your normal k8s mechanism, you will mount it
# from Cloud SQL or AWS RDS or similar
stringData:
Expand Down
11 changes: 0 additions & 11 deletions helm/featurehub/templates/nats-config.yaml

This file was deleted.

Loading