Skip to content

Commit

Permalink
OPSEXP-1862: add support for license (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz authored Aug 3, 2023
1 parent 5635807 commit b1055da
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/alfresco-repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: alfresco-repository
description: Alfresco content repository Helm chart
type: application
version: 0.1.0-alpha.1
version: 0.1.0-alpha.2
appVersion: 23.1.0-A21
dependencies:
- name: alfresco-common
Expand Down
4 changes: 2 additions & 2 deletions charts/alfresco-repository/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# alfresco-repository

![Version: 0.1.0-alpha.1](https://img.shields.io/badge/Version-0.1.0--alpha.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.1.0-A21](https://img.shields.io/badge/AppVersion-23.1.0--A21-informational?style=flat-square)
![Version: 0.1.0-alpha.2](https://img.shields.io/badge/Version-0.1.0--alpha.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 23.1.0-A21](https://img.shields.io/badge/AppVersion-23.1.0--A21-informational?style=flat-square)

Alfresco content repository Helm chart

Expand All @@ -19,7 +19,7 @@ Alfresco content repository Helm chart
| args | list | `[]` | |
| command | list | `[]` | |
| configuration.repository.existingConfigMap | string | `nil` | a configmap containing the "alfresco-global.properties" key populated with actual Alfresco repository properties |
| configuration.repository.existingSecret | string | `nil` | Name of a pre-existing secret TODO: secret documentation |
| configuration.repository.existingSecrets | list | `[{"key":"license.lic","name":"repository-secrets","purpose":"acs-license"}]` | A list of secrets to make available to the repo as env vars. It's also used to pass the Alfresco license which will be mounted as a file when the secret as the `purpose` value set to `acs-license`. Other secrets will be used as env variables. |
| db.driver | string | `nil` | JDBC driver class of the driver if none is provided the it is guessed from the URL provided |
| db.existingSecret | object | `{"keys":{"password":"DATABASE_PASSWORD","username":"DATABASE_USERNAME"},"name":null}` | Existing secret and their keys where to find the database username & password. |
| db.existingSecret.keys.password | string | `"DATABASE_PASSWORD"` | Key within the secret holding the database password |
Expand Down
21 changes: 21 additions & 0 deletions charts/alfresco-repository/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ spec:
secretKeyRef:
name: {{ $dbsecret }}
key: {{ .Values.db.existingSecret.keys.password }}
{{- range .Values.configuration.repository.existingSecrets }}
{{- if not (eq "acs-license" .purpose) }}
{{- $repoSecretsKeyRef := dict "name" .name "key" .key }}
{{- $repoSecretsEnv:= dict "name" .key "valueFrom" (dict "secretKeyRef" $repoSecretsKeyRef) }}
{{- list $repoSecretsEnv | toYaml | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.command }}
command:
{{- toYaml .Values.command | nindent 12 }}
Expand Down Expand Up @@ -93,6 +100,13 @@ spec:
subPath: alfresco-global.properties
readOnly: true
{{- end }}
{{- range .Values.configuration.repository.existingSecrets }}
{{- if eq "acs-license" .purpose }}
- name: acs-license
mountPath: /usr/local/tomcat/shared/classes/alfresco/extension/license
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.extraVolumeMounts }}
{{- tpl (.Values.extraVolumeMounts | toYaml) . | nindent 12 }}
{{- end }}
Expand All @@ -107,6 +121,13 @@ spec:
- key: alfresco-global.properties
path: alfresco-global.properties
{{- end }}
{{- range .Values.configuration.repository.existingSecrets }}
{{- if eq "acs-license" .purpose }}
{{- $licitems := list (dict "key" .key "path" "license.lic") }}
{{- $licvol := dict "name" "acs-license" "secret" (dict "secretName" .name "defaultMode" 0400 "optional" true "items" $licitems ) }}
{{- list $licvol | toYaml | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.extraVolumes }}
{{- tpl (.Values.extraVolumes | toYaml) . | nindent 8 }}
{{- end }}
Expand Down
47 changes: 47 additions & 0 deletions charts/alfresco-repository/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,50 @@ tests:
volumeID: "whatever"
fsType: ext4
template: deployment.yaml

- it: should have default license volume
asserts:
- contains:
path: spec.template.spec.volumes
content: &acsLicenseVol
name: acs-license
secret:
defaultMode: 0400
items:
- key: license.lic
path: license.lic
optional: true
secretName: repository-secrets
template: deployment.yaml
- contains:
path: spec.template.spec.containers[0].volumeMounts
content: &acsLicenseMount
name: acs-license
mountPath: /usr/local/tomcat/shared/classes/alfresco/extension/license
readOnly: true
template: deployment.yaml
- it: should not have any license volume but vars instead
set:
configuration:
repository:
existingSecrets:
- name: mysecret
key: MYSECRETVAR
asserts:
- notContains:
path: spec.template.spec.volumes
content: *acsLicenseVol
template: deployment.yaml
- notContains:
path: spec.template.spec.containers[0].volumeMounts
content: *acsLicenseMount
template: deployment.yaml
- contains:
path: spec.template.spec.containers[0].env
content:
name: MYSECRETVAR
valueFrom:
secretKeyRef:
key: MYSECRETVAR
name: mysecret
template: deployment.yaml
11 changes: 8 additions & 3 deletions charts/alfresco-repository/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ configuration:
# -- a configmap containing the "alfresco-global.properties" key populated
# with actual Alfresco repository properties
existingConfigMap: null
# -- Name of a pre-existing secret
# TODO: secret documentation
existingSecret: null
# -- A list of secrets to make available to the repo as env vars. It's also
# used to pass the Alfresco license which will be mounted as a file when
# the secret as the `purpose` value set to `acs-license`. Other secrets
# will be used as env variables.
existingSecrets:
- name: repository-secrets
key: license.lic
purpose: acs-license

environment:
# -- Alfresco java system properties. These properties must be provided as a
Expand Down

0 comments on commit b1055da

Please sign in to comment.