Skip to content
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

Hackathon/flexible amps #925

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
27 changes: 27 additions & 0 deletions helm/alfresco-content-services/7.3.N_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
repository:
image:
tag: 7.3.1
modules:
- name: alfresco-share-services-18.15
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-share-services/18.15
- name: alfresco-googledrive-repo-enterprise-3.3.0
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/org/alfresco/integrations/alfresco-googledrive-repo-enterprise/3.3.0
- name: alfresco-governance-services-enterprise-repo-18.15
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/org/alfresco/alfresco-governance-services-enterprise-repo/18.15
- name: alfresco-script-root-object-1.0.0
type: jar
url: >-
https://github.com/aborroy/alfresco-script-root-object/releases/download/1.0.0
command: ["catalina.sh", "run"]
ooiService:
image:
tag: 1.1.3
Expand Down Expand Up @@ -38,6 +56,15 @@ filestore:
share:
image:
tag: 7.3.1
modules:
- name: alfresco-googledrive-share-3.3.0
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/integrations/alfresco-googledrive-share/3.3.0
- name: alfresco-governance-services-enterprise-share-18.19
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/org/alfresco/alfresco-governance-services-enterprise-share/18.19
activemq:
image:
tag:
Expand Down
64 changes: 64 additions & 0 deletions helm/alfresco-content-services/templates/_helpers-amps.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{{/*
generate an ephemral volume name
*/}}
{{- define "alfresco.amps.vols" -}}
{{ toYaml .modules | sha1sum }}
{{- end -}}

{{/*
Alfresco modules initContainers
*/}}
{{- define "alfresco.amps.init" -}}
- name: get-amps
image: curlimages/curl:8.00.1
#image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.pullPolicy }}
{{- template "component-security-context" . }}
resources:
limits:
cpu: "0.25"
memory: "10Mi"
command:
- curl
args:
- --output-dir
- /amps
- -O
- -Lv
- >-
{{- $urls := list }}
{{- range .modules }}
{{- $urls = append $urls (printf "%s/%s.%s" .url .name .type) }}
{{- end }}
{
{{- join "," $urls -}}
}
volumeMounts:
- mountPath: /amps
name: {{ template "alfresco.amps.vols" . }}
- name: repack-amps
image: alfresco/alfresco-base-java:jdk17-rockylinux8
{{- template "component-security-context" . }}
resources: {{- toYaml .resources | nindent 4 }}
command:
- /bin/bash
- -xec
args:
- |
cd /amps
[ -d jars ] || mkdir jars
[ ! -f *.jar ] || mv *.jar jars
for AMP in $(ls /amps/*.amp); do
mkdir amp && cd $_
jar xf $AMP
module_id=$(grep 'module\.id' module.properties | cut -d= -f 2 | tr -d '[:cntrl:]')
echo "repackaging $module_id..."
[ -d "config/alfresco/module/${module_id}" ] || mkdir -p "config/alfresco/module/${module_id}"
mv module.properties config/alfresco/module/${module_id}
jar -c -f ${AMP%.amp}-classes.jar -C config/ .
cd ../ && rm -rf amp
done
volumeMounts:
- mountPath: /amps
name: {{ template "alfresco.amps.vols" . }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.repository.modules }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: alfresco-context
labels:
{{- include "repository.labels" . | nindent 4 }}
data:
alfresco.xml: |-
{{- tpl (.Files.Get "webapp-context.xml") (dict "Template" $.Template "webapp" .Values.repository) | nindent 4 }}
{{- end }}
12 changes: 12 additions & 0 deletions helm/alfresco-content-services/templates/config-share-context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.share.modules }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: share-context
labels:
{{- include "share.labels" . | nindent 4 }}
data:
share.xml: |-
{{- tpl (.Files.Get "webapp-context.xml") (dict "Template" $.Template "webapp" .Values.share) | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
imagePullPolicy: {{ .Values.repository.image.pullPolicy }}
{{- if .Values.repository.command }}
command:
{{ tpl .Values.repository.command . | indent 12 }}
{{ toYaml .Values.repository.command | nindent 12 }}
{{- end }}
{{- include "component-security-context" .Values.repository | indent 8 }}
envFrom:
Expand Down Expand Up @@ -75,14 +75,20 @@ spec:
{{- end }}
resources: {{- toYaml .Values.repository.resources | nindent 12 }}
volumeMounts:
- name: data
mountPath: {{ .Values.repository.persistence.data.mountPath }}
subPath: {{ .Values.repository.persistence.data.subPath }}
{{- if .Values.repository.modules }}
- name: alfresco-context
mountPath: /usr/local/tomcat/conf/Catalina/localhost/
{{- end }}
{{- if and (index .Values "alfresco-search" "enabled") (eq .Values.global.tracking.auth "secret") }}
- name: repository-properties
mountPath: /usr/local/tomcat/shared/classes/alfresco-global.properties
subPath: alfresco-global.properties
{{- end }}
- name: data
mountPath: {{ .Values.repository.persistence.data.mountPath }}
subPath: {{ .Values.repository.persistence.data.subPath }}
- mountPath: /amps
name: {{ template "alfresco.amps.vols" .Values.repository }}
{{- if .Values.repository.licenseSecret }}
- mountPath: /usr/local/tomcat/shared/classes/alfresco/extension/license/
name: acs-license
Expand Down Expand Up @@ -122,6 +128,9 @@ spec:
exec:
command: ["/bin/bash", "-c", "sleep 20"]
initContainers:
{{- if .Values.repository.modules }}
{{- include "alfresco.amps.init" .Values.repository | nindent 8 }}
{{- end }}
{{- if .Values.repository.extraInitContainers }}
{{- toYaml .Values.repository.extraInitContainers | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -188,6 +197,8 @@ spec:
{{- end }}
volumes:
{{- include "data_volume" .Values.repository | nindent 8 }}
- name: {{ template "alfresco.amps.vols" .Values.repository }}
emptyDir:
{{- if and (index .Values "alfresco-search" "enabled") (eq .Values.global.tracking.auth "secret") }}
- name: repository-properties
secret:
Expand All @@ -203,6 +214,11 @@ spec:
secretName: {{ .Values.repository.licenseSecret }}
defaultMode: 0400
{{- end }}
{{- if .Values.repository.modules }}
- name : alfresco-context
configMap:
name: alfresco-context
{{- end }}
{{- if .Values.repository.extraLogStatements }}
- name : repository-logging-properties-volume
configMap:
Expand Down
24 changes: 20 additions & 4 deletions helm/alfresco-content-services/templates/deployment-share.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,22 @@ spec:
{{- include "component-security-context" .Values.share | indent 8 }}
{{- if .Values.share.command }}
command:
{{ tpl .Values.share.command . | indent 12 }}
{{ toYaml .Values.share.command | nindent 12 }}
{{- end }}
ports:
- containerPort: {{ .Values.share.image.internalPort }}
resources: {{- toYaml .Values.share.resources | nindent 12 }}
envFrom:
- configMapRef:
name: {{ template "content-services.shortname" . }}-share-configmap
{{- if .Values.share.extraVolumeMounts }}
volumeMounts:
- mountPath: /amps
name: {{ template "alfresco.amps.vols" .Values.share }}
{{- if .Values.share.modules }}
- mountPath: /usr/local/tomcat/conf/Catalina/localhost/
name: share-context
{{- end }}
{{- if .Values.share.extraVolumeMounts }}
{{ toYaml .Values.share.extraVolumeMounts | indent 10 }}
{{- end }}
readinessProbe:
Expand All @@ -70,11 +76,21 @@ spec:
preStop:
exec:
command: ["/bin/bash", "-c", "sleep 20"]
{{- if .Values.share.extraInitContainers }}
initContainers:
{{- if .Values.share.modules }}
{{- include "alfresco.amps.init" .Values.share | nindent 8 }}
{{- end }}
{{- if .Values.share.extraInitContainers }}
{{ tpl .Values.share.extraInitContainers . | indent 8 }}
{{- end }}
{{- if .Values.share.extraVolumes }}
volumes:
- name: {{ template "alfresco.amps.vols" .Values.share }}
emptyDir:
{{- if .Values.share.modules }}
- name : share-context
configMap:
name: share-context
{{- end }}
{{- if .Values.share.extraVolumes }}
{{ toYaml .Values.share.extraVolumes | indent 6 }}
{{- end }}
24 changes: 24 additions & 0 deletions helm/alfresco-content-services/webapp-context.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<Context>
<Resources>
<JarResources base="/amps/jars"
className="org.apache.catalina.webresources.DirResourceSet"
webAppMount="/WEB-INF/lib"/>
{{- range .webapp.modules }}
{{- if eq .type "amp" }}
{{- $packedClasses := printf "%s-classes.jar" .name }}
<JarResources base="/amps/{{ .name }}.{{ .type }}"
className="org.apache.catalina.webresources.JarResourceSet"
internalPath="/lib"
webAppMount="/WEB-INF/lib"/>
<JarResources base="/amps/{{ $packedClasses }}"
className="org.apache.catalina.webresources.JarResourceSet"
webAppMount="/WEB-INF/classes"/>
<JarResources base="/amps/{{ .name }}.{{ .type }}"
className="org.apache.catalina.webresources.JarResourceSet"
internalPath="/web"
webAppMount="/"/>
{{- end }}
{{- end }}
</Resources>
</Context>
41 changes: 37 additions & 4 deletions test/community-integration-test-values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
---
repository:
image:
repository: alxgomz/alfresco-community-repo-base
tag: 7.3.1-hackathon.1
modules:
- name: alfresco-share-services-18.15
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-share-services/18.15
- name: alfresco-googledrive-repo-community-3.3.0
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/integrations/alfresco-googledrive-repo-community/3.3.0
- name: alfresco-governance-services-community-repo-18.15
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repo_groups/public/content/org/alfresco/alfresco-governance-services-community-repo/18.15
- name: support-tools-repo-1.2.0.0-amp
type: amp
url: >-
https://repo1.maven.org/maven2/org/orderofthebee/support-tools/support-tools-repo/1.2.0.0
- name: alfresco-script-root-object-1.0.0
type: jar
url: >-
https://github.com/aborroy/alfresco-script-root-object/releases/download/1.0.0
command: ["catalina.sh", "run"]
resources:
requests:
cpu: "0.01"
Expand All @@ -11,18 +36,26 @@ repository:
persistence:
accessModes:
- ReadWriteOnce
image:
repository: alfresco/alfresco-content-repository-community
share:
image:
repository: alxgomz/alfresco-share-community-base
tag: 7.3.1-noamps.1
modules:
- name: alfresco-googledrive-share-3.3.0
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/integrations/alfresco-googledrive-share/3.3.0
- name: alfresco-governance-services-community-share-18.19
type: amp
url: >-
https://nexus.alfresco.com/nexus/service/local/repo_groups/public/content/org/alfresco/alfresco-governance-services-community-share/18.19
resources:
requests:
cpu: "0.01"
memory: "256Mi"
limits:
memory: "512Mi"
replicaCount: 1
image:
repository: alfresco/alfresco-share
pdfrenderer:
resources:
requests:
Expand Down