Skip to content

Commit

Permalink
add in db migrateOnInit
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Siwiec <[email protected]>
  • Loading branch information
rizzza committed Nov 2, 2023
1 parent f3047c4 commit 973420a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 10 deletions.
16 changes: 16 additions & 0 deletions chart/location-api/templates/api-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ data:
LOCATIONAPI_OIDC_JWKS_REMOTE_TIMEOUT: "{{ .Values.api.oidc.jwksRemoteTimeout }}"
LOCATIONAPI_SERVER_LISTEN: ":{{ .Values.api.listenPort }}"
LOCATIONAPI_SERVER_SHUTDOWN_GRACE_PERIOD: "{{ .Values.api.shutdownGracePeriod }}"
METADATAAPI_PERMISSIONS_URL: "{{ .Values.api.permissions.url }}"
{{- if .Values.api.tracing.enabled }}
METADATAAPI_TRACING_ENABLED: "{{ .Values.api.tracing.enabled }}"
METADATAAPI_TRACING_PROVIDER: "{{ .Values.api.tracing.provider }}"
METADATAAPI_TRACING_ENVIRONMENT: "{{ .Values.api.tracing.environment }}"
{{- if eq .Values.api.tracing.provider "jaeger" }}
METADATAAPI_TRACING_JAEGER_ENDPOINT: "{{ .Values.api.tracing.jaeger.endpoint }}"
METADATAAPI_TRACING_JAEGER_USER: "{{ .Values.api.tracing.jaeger.user }}"
METADATA_TRACING_JAEGER_PASSWORD: "{{ .Values.api.tracing.jaeger.password }}"
{{- end }}
{{- if eq .Values.api.tracing.provider "otlpgrpc" }}
METADATAAPI_TRACING_OTLP_ENDPOINT: "{{ .Values.api.tracing.otlp.endpoint }}"
METADATAAPI_TRACING_OTLP_INSECURE: "{{ .Values.api.tracing.otlp.insecure }}"
METADATA_TRACING_OTLP_CERTIFICATE: "{{ .Values.api.tracing.otlp.certificate }}"
{{- end }}
{{- end }}
{{- with .Values.api.trustedProxies }}
LOCATIONAPI_SERVER_TRUSTED_PROXIES: "{{ join " " . }}"
{{- end }}
29 changes: 29 additions & 0 deletions chart/location-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,35 @@ spec:
securityContext:
{{- toYaml .Values.api.podSecurityContext | nindent 8 }}
{{- end }}
{{- if .Values.api.migrateOnInit }}
initContainers:
- name: {{ .Chart.Name }}-migrate
{{- if .Values.api.extraEnvVars }}
env:
{{- range .Values.api.extraEnvVars }}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
{{- end }}
envFrom:
{{- if .Values.api.db.uriSecret }}
- secretRef:
name: {{ .Values.api.db.uriSecret }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- migrate
- up
volumeMounts:
{{- if .Values.api.db.certSecret }}
- name: dbcerts
mountPath: "/dbcerts"
readOnly: true
{{- end }}
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
env:
Expand Down
35 changes: 25 additions & 10 deletions chart/location-api/values.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
image:
repository: ghcr.io/infratographer/location-api
pullPolicy: IfNotPresent
tag: "v0.1.0"
tag: "main-latest"

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}

service:
Expand Down Expand Up @@ -64,6 +55,7 @@ api:
db:
uriSecret: ""
certSecret: ""
migrateOnInit: true

oidc:
enabled: false
Expand All @@ -72,6 +64,29 @@ api:
jwks:
remoteTimeout: 1m

permissions:
url: ""

tracing:
# enabled is true if OpenTelemetry tracing should be enabled for permissions-api
enabled: false
# environment is the OpenTelemetry tracing environment to use
environment: ""
# provider is the OpenTelemetry tracing provider to use
provider: stdout
jaeger:
# endpoint is the Jaeger collector to send traces to
endpoint: ""
# user is the user to use when authenticating against the Jaeger deployment
user: ""
# password is the password to use when authenticating against the Jaeger deployment
password: ""
otlp:
# endpoint is the OpenTelemetry Protocol (OTLP) collector endpoint to send traces to
endpoint: ""
# insecure is true if TLS should not be required when sending traces
insecure: false

shutdownGracePeriod: 5s
trustedProxies: []
# - "1.2.3.4"
Expand Down

0 comments on commit 973420a

Please sign in to comment.