Skip to content

Commit

Permalink
feat: Provide configuration backup with Persistent Volume (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
LDL-GH authored Jul 11, 2022
1 parent e380932 commit 712eda6
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helm-charts/azure-api-management-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ their default values.
| `image.tag` | Tag of image to use | N/A, defaults to app version of Helm chart |
| `image.pullPolicy` | Policy to pull image | `IfNotPresent` |
| `gateway.configuration.uri` | Endpoint in Azure API Management to which every self-hosted agent has to connect | |
| `gateway.configuration.backup.enabled` | If enabled will store a backup copy of the latests downloaded configuration on a storage volume | `false` |
| `gateway.configuration.backup.persistentVolumeClaim.existingName` | Use an existing Persistent Volume Claim (PVC) instead of creating one. *.persistentVolumeClaim.create needs to be false | `""` |
| `gateway.configuration.backup.persistentVolumeClaim.create` | Create a Persistent Volume Claim (PVC) with values specified in *.backup.persistentVolumeClaim.\* | `true` |
| `gateway.configuration.backup.persistentVolumeClaim.storageClassName` | storageClassName to be set on the Persistent Volume Claim (PVC). `null` means no storageClassName specified and will use the platform default, `""` means no storageClassName specified and none will be used. | `null` |
| `gateway.configuration.backup.persistentVolumeClaim.accessMode` | Access mode for the Persistent Volume Claim (PVC) pod | `ReadWriteMany` |
| `gateway.configuration.backup.persistentVolumeClaim.size` | Size of the Persistent Volume Claim (PVC) to be created | `50Mi` |
| `gateway.auth.key` | Authentication key to authenticate with to Azure API Management service. Typically starts with `GatewayKey` | |
| `secret.createSecret` | Indication whether or not a Kubernetes secret should be created to store the authentication token. | `true` |
| `secret.existingSecretName` | Name of the existing secret to be used by the gateway. Requires `secret.createSecret` to be false. | |
Expand Down Expand Up @@ -122,6 +128,7 @@ their default values.
| `securityContext` | Privilege and access control settings for the container | `{}` |
| `podSecurityContext` | Privilege and access control settings for the pod | `{}` |


Specify each parameter using the `--set key=value[,key=value]` argument to
`helm install`.

Expand Down
15 changes: 15 additions & 0 deletions helm-charts/azure-api-management-gateway/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ spec:
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.gateway.configuration.backup.enabled }}
volumeMounts:
- mountPath: /apim/config
name: {{ include "azure-api-management-gateway.fullname" . }}
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
Expand Down Expand Up @@ -111,3 +116,13 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.gateway.configuration.backup.enabled }}
volumes:
- name: {{ include "azure-api-management-gateway.fullname" . }}
persistentVolumeClaim:
{{ if .Values.gateway.configuration.backup.persistentVolumeClaim.create -}}
claimName: {{ include "azure-api-management-gateway.fullname" . }}
{{ else -}}
claimName: {{ .Values.gateway.configuration.backup.persistentVolumeClaim.existingName }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if and .Values.gateway.configuration.backup.enabled .Values.gateway.configuration.backup.persistentVolumeClaim.create -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "azure-api-management-gateway.fullname" . }}
labels:
{{- include "azure-api-management-gateway.labels" . | nindent 4 }}
spec:
{{- if ne .Values.gateway.configuration.backup.persistentVolumeClaim.storageClassName nil }}
storageClassName: {{ .Values.gateway.configuration.backup.persistentVolumeClaim.storageClassName | quote }}
{{- end }}
accessModes:
- {{ .Values.gateway.configuration.backup.persistentVolumeClaim.accessMode }}
resources:
requests:
storage: {{ .Values.gateway.configuration.backup.persistentVolumeClaim.size }}
{{- end }}
8 changes: 8 additions & 0 deletions helm-charts/azure-api-management-gateway/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ fullnameOverride: ""
gateway:
configuration:
uri:
backup:
enabled: false
persistentVolumeClaim:
existingName: ""
create: true
storageClassName: null
accessMode: ReadWriteMany
size: 50Mi
auth:
# When an existing secret is configured, the value specified here will not be used
key:
Expand Down

0 comments on commit 712eda6

Please sign in to comment.