Skip to content

Commit

Permalink
Add configmap to api-server
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiimk committed Oct 30, 2023
1 parent c938a20 commit af522b1
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 35 deletions.
4 changes: 2 additions & 2 deletions charts/kamu-api-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: kamu-api-server
description: API server component of the Kamu Compute Node
type: application
version: 0.9.2
appVersion: "0.9.0"
version: 0.10.0
appVersion: "0.10.0"
home: https://kamu.dev
icon: https://www.kamu.dev/images/kamu_logo_icon_bg_square.png
sources:
Expand Down
16 changes: 16 additions & 0 deletions charts/kamu-api-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,19 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}


{{/*
Renders the content of the configmap
*/}}
{{- define "kamu-api-server.config.yaml" -}}
{{- $root := . -}}
config.yaml: | {{ .Values.app.config | toYaml | nindent 2 }}
{{- end -}}

{{/*
Computes a short hash of the configmap content to re-create it and trigger the re-deploy upon any change
*/}}
{{- define "kamu-api-server.config.sha" -}}
{{ include "kamu-api-server.config.yaml" . | toJson | sha256sum | trunc 10 }}
{{- end -}}
8 changes: 8 additions & 0 deletions charts/kamu-api-server/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "kamu-api-server.fullname" . }}-{{ template "kamu-api-server.config.sha" . }}
labels:
{{- include "kamu-api-server.labels" . | nindent 4 }}
data:
{{- include "kamu-api-server.config.yaml" . | nindent 2 }}
17 changes: 13 additions & 4 deletions charts/kamu-api-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,23 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "/opt/kamu/kamu-api-server"
- {{ printf "--repo-url=%s" .Values.app.config.datasetRepositoryUrl | quote }}
- "--config=/opt/kamu/config.yaml"
- {{ printf "--repo-url=%s" .Values.app.datasetRepositoryUrl | quote }}
- "run"
- "--address=0.0.0.0"
- "--http-port=80"
- "--flightsql-port=50050"
env:
- name: KAMU_AUTH_GITHUB_CLIENT_ID
value: {{ .Values.app.config.authGithubClientId | quote }}
value: {{ .Values.app.authGithubClientId | quote }}
- name: KAMU_AUTH_GITHUB_CLIENT_SECRET
value: {{ .Values.app.config.authGithubClientSecret | quote }}
value: {{ .Values.app.authGithubClientSecret | quote }}
- name: KAMU_JWT_SECRET
value: {{ .Values.app.config.jwtSecret | quote }}
value: {{ .Values.app.jwtSecret | quote }}
volumeMounts:
- name: configs
subPath: config.yaml
mountPath: /opt/kamu/config.yaml
ports:
- name: http
containerPort: 80
Expand All @@ -66,6 +71,10 @@ spec:
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: configs
configMap:
name: {{ include "kamu-api-server.fullname" . }}-{{ template "kamu-api-server.config.sha" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
42 changes: 20 additions & 22 deletions charts/kamu-api-server/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,30 @@
"app": {
"type": "object",
"required": [
"config"
"config",
"datasetRepositoryUrl",
"authGithubClientId",
"authGithubClientSecret",
"jwtSecret"
],
"properties": {
"config": {
"type": "object",
"required": [
"datasetRepositoryUrl",
"authGithubClientId",
"authGithubClientSecret",
"jwtSecret"
],
"properties": {
"datasetRepositoryUrl": {
"type": "string",
"format": "uri"
},
"authGithubClientId": {
"type": "string"
},
"authGithubClientSecret": {
"type": "string"
},
"jwtSecret": {
"type": "string"
}
}
"required": [],
"properties": {}
},
"datasetRepositoryUrl": {
"type": "string",
"format": "uri"
},
"authGithubClientId": {
"type": "string"
},
"authGithubClientSecret": {
"type": "string"
},
"jwtSecret": {
"type": "string"
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions charts/kamu-api-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
###############################################################################

app:
config:
# URL of the storage bucket for datasets (S3 or Minio)
# Example: https://api.kamu.dev/graphql
datasetRepositoryUrl: ""
authGithubClientId: ""
authGithubClientSecret: ""
jwtSecret: ""
# TODO: generate schema for config from DTOs
config: {}
# TODO: Move into config file
# URL of the storage bucket for datasets (S3 or Minio)
# Example: https://api.kamu.dev/graphql
datasetRepositoryUrl: ""
# TODO: Move into secrets
authGithubClientId: ""
authGithubClientSecret: ""
jwtSecret: ""

###############################################################################
# Pod
Expand Down

0 comments on commit af522b1

Please sign in to comment.