-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add permissions-api database, migrations Database package along with migrations and migrate command giving permissions-api it's own database to store details into. Initial support is for Roles Get, Create, Update and Delete. Signed-off-by: Mike Mason <[email protected]> * implement role metadata database into query engine This integrates the new database which contains role metadata into the query engine as well as updates the http api to expose this new information. Signed-off-by: Mike Mason <[email protected]> * add logging and health check Signed-off-by: Mike Mason <[email protected]> * add support for updating of roles Signed-off-by: Mike Mason <[email protected]> * update method names to be more descriptive Updated CreateRole, UpdateRole and DeleteRole to CreateRoleTransaction, UpdateRoleTransaction and DeleteRoleTransaction to make it more clear that a transaction is being started. Additionally, the comments on these methods have been updated to include statements that Commit or Rollback must be called to ensure the database lifts all locks on rows which are affected. Previously, the method names made it appear as though the action was taken and completed. However this could lead to hung connections and rows. The new names make it clear that a new transaction is being started. The returning struct only has two methods Commit and Rollback in addition to the Record attribute resulting in a simple structure. Signed-off-by: Mike Mason <[email protected]> * add database changes to chart and support migrations Signed-off-by: Mike Mason <[email protected]> * implement review suggestions Signed-off-by: Mike Mason <[email protected]> * implement second round of review suggestions Signed-off-by: Mike Mason <[email protected]> * add missing rollback comments and ensure tests are checking results properly Signed-off-by: Mike Mason <[email protected]> * lock role record before updating or deleting Since we're working with multiple backends, this allows us to place a lock early and ensure a separate request doesn't conflict with an in-flight change. Signed-off-by: Mike Mason <[email protected]> * correct ListRoles to ensure it always lists roles from the database Signed-off-by: Mike Mason <[email protected]> --------- Signed-off-by: Mike Mason <[email protected]>
- Loading branch information
Showing
35 changed files
with
2,051 additions
and
48 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
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
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
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
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
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
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
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,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 | ||
{{- 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 }} |
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
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
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
Oops, something went wrong.