-
Notifications
You must be signed in to change notification settings - Fork 12
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
add named role support #202
Changes from all commits
351eb6a
aeedd0d
80a9f63
84d2e1e
7da3e83
28f33d7
cadcf2f
15c1247
97ab799
1c56883
f2d105f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{{- if has .Values.config.crdb.migrateHook (list "pre-sync" "manual") }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
{{- if eq .Values.config.crdb.migrateHook "manual" }} | ||
name: {{ include "common.names.name" . }}-migrate-database | ||
{{- else }} | ||
generateName: migrate-database- | ||
annotations: | ||
argocd.argoproj.io/hook: PreSync | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general I think it's good to not assume any user of this is using Argo specifically. |
||
{{- end }} | ||
spec: | ||
revisionHistoryLimit: 3 | ||
selector: | ||
matchLabels: | ||
service: migrate-database | ||
{{- include "common.labels.matchLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: | ||
service: migrate-database | ||
{{- include "common.labels.standard" . | nindent 8 }} | ||
spec: | ||
restartPolicy: OnFailure | ||
terminationGracePeriodSeconds: 30 | ||
{{- with .Values.deployment.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.deployment.podSecurityContext }} | ||
securityContext: | ||
{{- toYaml .Values.deployment.podSecurityContext | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: {{ include "common.names.name" . }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
args: | ||
- migrate | ||
- up | ||
- --config | ||
- /config/config.yaml | ||
{{- with .Values.config.crdb.uriSecretName }} | ||
env: | ||
- name: PERMISSIONSAPI_CRDB_URI | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ . }} | ||
key: uri | ||
{{- end }} | ||
{{- with .Values.deployment.resources }} | ||
resources: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumeMounts: {{ include "permapi.server.volumeMounts" . | nindent 12 }} | ||
{{- with .Values.deployment.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.deployment.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.deployment.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
volumes: {{ include "permapi.server.volumes" . | nindent 8 }} | ||
{{- end }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,39 @@ config: | |
# policyConfigMapName is the name of the Config Map containing the policy file configuration | ||
policyConfigMapName: "" | ||
|
||
crdb: | ||
# migrateHook sets when to run database migrations. one of: pre-sync, init, manual | ||
# - pre-sync: hook runs as a job before any other changes are synced. | ||
# - init: is run as an init container to the server deployment and may run multiple times if replica count is high. | ||
# - manual: a migrate-database job will be available to triggered manually | ||
migrateHook: "init" | ||
Comment on lines
+50
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment re: Argo. I do like the concept, though! |
||
# name is the database name | ||
name: "" | ||
# host is the database host | ||
host: "" | ||
# user is the auth username to the database | ||
user: "" | ||
# password is the auth password to the database | ||
password: "" | ||
Comment on lines
+61
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like something we shouldn't even let users set manually, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually like to expose all available configuration options, which this is an option that can be set in the crdbx config which is why I added it here. |
||
# params is the connection parameters to the database | ||
params: "" | ||
# uri is the raw uri connection string | ||
uri: "" | ||
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here re: sensitive data. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re same as above |
||
# uriSecretName if set retrieves the `uri` from the provided secret name | ||
uriSecretName: "" | ||
# caSecretName if defined mounts database certificates from the provided secret | ||
# secrets are mounted at `caMountPath` | ||
caSecretName: "" | ||
# caMountPath is the path the caSecretName is mounted at | ||
caMountPath: /etc/ssl/crdb/ | ||
connections: | ||
# max_open is the maximum number of open connections to the database | ||
max_open: 0 | ||
# max_idle is the maximum number of connections in the idle connection | ||
max_idle: 0 | ||
# max_lifetime is the maximum amount of time a connection may be idle | ||
max_lifetime: 0 | ||
|
||
events: | ||
# zedTokenBucket is the NATS bucket to use for caching ZedTokens | ||
zedTokenBucket: "" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we anticipate needing or wanting to support these three kinds of migration workflows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manual is perhaps not needed. but pre-sync and init are useful.
pre-sync can't be used during the initial deployment as it will rely on configs and secrets that have to be synced first, and therefore won't be available. so you must use the init method. but after using the init method, you can switch to the pre-sync method which will ensure migrations only execute once per sync.
if having these options is not preferred we could get rid of it and just use init containers.