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

OPSEXP-2293: align alfresco-ai-transformer chart with latest practices #167

Merged
merged 39 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9948f80
add ai xform serviceaccount templates
alxgomz Dec 13, 2023
3fdc87c
simplify tests
alxgomz Dec 13, 2023
d6529f6
add service account in deployment with tests
alxgomz Dec 13, 2023
032442f
move AWS credentials in a secret and add existingSecret in values
alxgomz Dec 14, 2023
3f7105c
add tests
alxgomz Dec 14, 2023
e3d2cad
fix values key and default
alxgomz Dec 14, 2023
b3702ae
project secrets items in deployment
alxgomz Dec 14, 2023
b709743
add component recommended label
alxgomz Dec 14, 2023
ad8c9fc
simplify configmap and add tests
alxgomz Dec 14, 2023
6500fc1
add aws existingConfigMap
alxgomz Dec 14, 2023
75918d2
split aws config to its own configmap
alxgomz Dec 14, 2023
24d8a58
add aws configs to deployment
alxgomz Dec 14, 2023
d16c790
encode secrets values
alxgomz Dec 14, 2023
d515ddd
align AMQ existing secret usage
alxgomz Dec 14, 2023
b02eea2
remove unused value
alxgomz Dec 14, 2023
4111a6c
bump alfresco-comon dependency & move MQ URL from secret to cm
alxgomz Dec 14, 2023
6175c23
remove older alfresco.shortname template
alxgomz Dec 14, 2023
90f2816
add broker credentials in deployment and tests
alxgomz Dec 14, 2023
2fc0fb7
simplify cm tests
alxgomz Dec 15, 2023
cd0ea58
add broker url in deployment
alxgomz Dec 15, 2023
3394c4a
fail on empty mq url
alxgomz Dec 15, 2023
08190f7
move to tag based dependencies management
alxgomz Dec 15, 2023
2543bf1
bump activemq dep
alxgomz Dec 15, 2023
ae539a7
remove old flag references
alxgomz Dec 15, 2023
ee9f896
add filestore values
alxgomz Dec 18, 2023
33c603c
use values in configmap
alxgomz Dec 18, 2023
f908f69
add configmap tests
alxgomz Dec 18, 2023
d39c49c
add sfs url env var in deployment
alxgomz Dec 18, 2023
56f7ec4
add tests
alxgomz Dec 18, 2023
99c5cf2
bump ai-transformer chart
alxgomz Dec 18, 2023
1ff1cc5
add missing service account template
alxgomz Dec 18, 2023
046f264
remove reference to older secret
alxgomz Dec 18, 2023
0c74994
split sfs cm to a dedicated one
alxgomz Dec 18, 2023
12a944d
rename aws secret and cm
alxgomz Dec 18, 2023
eb2a6ca
fixed name activemq in CI
alxgomz Dec 18, 2023
cf0986e
fixup
alxgomz Dec 18, 2023
2249b43
remove cluncky checksum support
alxgomz Dec 18, 2023
bddf0e6
remove non full qualified template names
alxgomz Dec 18, 2023
7b9397f
fix linter
alxgomz Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions charts/alfresco-ai-transformer/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies:
- name: alfresco-common
repository: https://alfresco.github.io/alfresco-helm-charts/
version: 2.1.0
version: 3.0.0
- name: activemq
repository: https://alfresco.github.io/alfresco-helm-charts/
version: 3.2.0
digest: sha256:2253dbee6aa979a16ff69d391f074dd62adf48c7d41f12271eebaee3fb89e54f
generated: "2023-08-18T17:01:09.053373+02:00"
version: 3.4.1
digest: sha256:9cc0f93b3dd14c9dde5cb9d9f4b7540d9d40d02d66b2a8d8eabd9d7f4f033f5c
generated: "2023-12-15T14:43:55.754327+01:00"
9 changes: 5 additions & 4 deletions charts/alfresco-ai-transformer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ apiVersion: v2
name: alfresco-ai-transformer
description: A Helm chart for deploying Alfresco ai transformer service
type: application
version: 0.4.1
version: 1.0.0-alpha.1
appVersion: 3.0.1
dependencies:
- name: alfresco-common
version: 2.1.0
version: 3.0.0
repository: https://alfresco.github.io/alfresco-helm-charts/
- name: activemq
version: 3.2.0
version: 3.4.1
repository: https://alfresco.github.io/alfresco-helm-charts/
condition: activemq.enabled
tags:
- ci
37 changes: 26 additions & 11 deletions charts/alfresco-ai-transformer/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
# alfresco-ai-transformer

![Version: 0.4.1](https://img.shields.io/badge/Version-0.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.1](https://img.shields.io/badge/AppVersion-3.0.1-informational?style=flat-square)
![Version: 1.0.0-alpha.1](https://img.shields.io/badge/Version-1.0.0--alpha.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 3.0.1](https://img.shields.io/badge/AppVersion-3.0.1-informational?style=flat-square)

A Helm chart for deploying Alfresco ai transformer service

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://alfresco.github.io/alfresco-helm-charts/ | activemq | 3.2.0 |
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 2.1.0 |
| https://alfresco.github.io/alfresco-helm-charts/ | activemq | 3.4.1 |
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0 |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| activemq.enabled | bool | `false` | |
| aws.accessKey | string | `"XXXXXXXXXXXXXXXXXXXXXXXX"` | AWS credentials are required as documented at https://docs.alfresco.com/intelligence-services/latest/config/#default-configuration |
| aws.comprehendRoleARN | string | `"arn:aws:iam::XXXXXXXXXXXX:role/ComprehendAsyncJobs"` | |
| aws.region | string | `"region-name"` | |
| aws.s3Bucket | string | `"s3-bucket-name"` | |
| aws.secretAccessKey | string | `"XXXXXXXXXXXXXXXXXXXXXXXX"` | |
| aws.accessKeyId | string | `nil` | AWS credentials are required as documented at https://docs.alfresco.com/intelligence-services/latest/config/#default-configuration |
| aws.comprehendRoleARN | string | `nil` | |
| aws.existingConfigMap.keys.comprehendRoleARN | string | `"AWS_COMPREHEND_ROLE_ARN"` | |
| aws.existingConfigMap.keys.region | string | `"AWS_REGION"` | |
| aws.existingConfigMap.keys.s3Bucket | string | `"AWS_S3_BUCKET"` | |
| aws.existingConfigMap.name | string | `nil` | |
alxgomz marked this conversation as resolved.
Show resolved Hide resolved
| aws.existingSecret.keys.accessKeyId | string | `"AWS_ACCESS_KEY_ID"` | |
| aws.existingSecret.keys.secretAccessKey | string | `"AWS_SECRET_ACCESS_KEY"` | |
| aws.existingSecret.name | string | `nil` | |
| aws.region | string | `nil` | |
| aws.s3Bucket | string | `nil` | |
| aws.secretAccessKey | string | `nil` | |
| environment.JAVA_OPTS | string | `"-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"` | |
| global.alfrescoRegistryPullSecrets | string | `"quay-registry-secret"` | |
| image.internalPort | int | `8090` | |
Expand All @@ -34,9 +40,11 @@ A Helm chart for deploying Alfresco ai transformer service
| livenessProbe.maxTransforms | int | `10000` | |
| livenessProbe.periodSeconds | int | `20` | |
| livenessProbe.timeoutSeconds | int | `10` | |
| messageBroker.existingSecretName | string | `nil` | Alternatively, provide credentials via an existing secret that contains BROKER_URL, BROKER_USERNAME and BROKER_PASSWORD keys |
| messageBroker.existingConfigMap | object | `{"keys":{"url":"BROKER_URL"},"name":null}` | Alternatively, provide credentials via an existing secret and set the keys as they are given |
| messageBroker.existingSecret.keys.password | string | `"BROKER_PASSWORD"` | |
| messageBroker.existingSecret.keys.username | string | `"BROKER_USERNAME"` | |
| messageBroker.existingSecret.name | string | `nil` | |
| messageBroker.password | string | `nil` | |
| messageBroker.secretName | string | `"acs-alfresco-cs-brokersecret"` | Name of the secret managed by this chart |
| messageBroker.url | string | `nil` | |
| messageBroker.user | string | `nil` | |
| nodeSelector | object | `{}` | |
Expand All @@ -52,8 +60,15 @@ A Helm chart for deploying Alfresco ai transformer service
| service.externalPort | int | `80` | |
| service.name | string | `"ai-transformer"` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `"ai-transformer-sa"` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| sfs.existingConfigMap.keys.url | string | `"FILE_STORE_URL"` | |
| sfs.existingConfigMap.name | string | `nil` | |
| sfs.url | string | `nil` | Alfresco Transformation filestore (e.g. http://acs-alfresco-transform-service) |
| strategy.rollingUpdate.maxSurge | int | `1` | |
| strategy.rollingUpdate.maxUnavailable | int | `0` | |
| tags.ci | bool | `false` | A chart tag used for Hyland's CI purpose. Do not set it to true. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
18 changes: 17 additions & 1 deletion charts/alfresco-ai-transformer/ci/default-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@ resources:
cpu: "1"
memory: "500Mi"
activemq:
enabled: true
fullnameOverride: activemq
resources:
requests:
cpu: "100m"
memory: "512Mi"
limits:
cpu: "1000m"
memory: "1Gi"
adminUser: &mquser
user: someone
password: something
aws:
accessKeyId: AAAAAAAAAAAAAAAAA
secretAccessKey: ZZZZZZZZZZZZZZZZZ
s3Bucket: somebucket
region: us-east-1
comprehendRoleARN: arn:aws:iam::000000000000:user/comprehend
sfs:
url: http://acs-alfresco-transform-service
messageBroker:
<<: *mquser
url: failover:(nio://activemq:61616)
tags:
ci: true
12 changes: 12 additions & 0 deletions charts/alfresco-ai-transformer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ helm.sh/chart: {{ include "alfresco-ai-transformer.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: {{ template "alfresco-ai-transformer.name" . }}
{{- end }}

{{/*
Expand All @@ -49,3 +50,14 @@ Selector labels
app.kubernetes.io/name: {{ include "alfresco-ai-transformer.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "alfresco-ai-transformer.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "alfresco-ai-transformer.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@ metadata:
labels:
{{- include "alfresco-ai-transformer.labels" . | nindent 4 }}
data:
{{- if .Values.environment }}
{{- range $key, $val := .Values.environment }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
FILE_STORE_URL: http://{{ template "alfresco.shortname" . }}-filestore:80/alfresco/api/-default-/private/sfs/versions/1/file
AWS_ACCESS_KEY: {{ .Values.aws.accessKey }}
AWS_SECRET_ACCESS_KEY: {{ .Values.aws.secretAccessKey }}
AWS_REGION: {{ .Values.aws.region }}
AWS_S3_BUCKET: {{ .Values.aws.s3Bucket }}
AWS_COMPREHEND_ROLE_ARN: {{ .Values.aws.comprehendRoleARN }}
livenessPercent: "{{ .Values.livenessProbe.livenessPercent }}"
livenessTransformPeriodSeconds: "{{ .Values.livenessProbe.livenessTransformPeriodSeconds }}"
maxTransforms: "{{ .Values.livenessProbe.maxTransforms }}"
Expand Down
13 changes: 13 additions & 0 deletions charts/alfresco-ai-transformer/templates/config-aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if not .Values.aws.existingConfigMap.name }}
apiVersion: v1
kind: ConfigMap
metadata:
{{- $cmCtx := dict "Values" (dict "nameOverride" "aws-comprehend") "Chart" .Chart "Release" .Release }}
name: {{ template "alfresco-ai-transformer.fullname" $cmCtx }}
labels:
{{- include "alfresco-ai-transformer.labels" . | nindent 4 }}
data:
AWS_REGION: {{ .Values.aws.region }}
AWS_S3_BUCKET: {{ .Values.aws.s3Bucket }}
AWS_COMPREHEND_ROLE_ARN: {{ .Values.aws.comprehendRoleARN }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if not .Values.messageBroker.existingConfigMap.name }}
apiVersion: v1
kind: ConfigMap
metadata:
{{- $mqCtx := dict "Values" (dict "nameOverride" "ai-mq") "Chart" .Chart "Release" .Release }}
name: {{ template "alfresco-ai-transformer.fullname" $mqCtx }}
labels:
{{- include "alfresco-ai-transformer.labels" $ | nindent 4 }}
data:
{{- $reqmsg := "Please provide a valid broker URL with messageBroker.url or as a configmap key using messageBroker.existingConfigMap" }}
{{ template "alfresco-common.activemq.cm" (required $reqmsg .Values.messageBroker.url) }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/alfresco-ai-transformer/templates/config-sfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if not .Values.sfs.existingConfigMap.name }}
apiVersion: v1
kind: ConfigMap
metadata:
{{- $cmCtx := dict "Values" (dict "nameOverride" "ai-sfs") "Chart" .Chart "Release" .Release }}
name: {{ template "alfresco-ai-transformer.fullname" $cmCtx }}
labels:
{{- include "alfresco-ai-transformer.labels" . | nindent 4 }}
data:
{{- $reqmsg := "You must provide a base URL for the filestore service as sfs.url" }}
FILE_STORE_URL: {{ printf "%s/alfresco/api/-default-/private/sfs/versions/1/file" (required $reqmsg .Values.sfs.url) }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ spec:
{{- toYaml .Values.strategy.rollingUpdate | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/config-ai-transformer.yaml") . | sha256sum }}
labels:
{{- include "alfresco-ai-transformer.selectorLabels" . | nindent 8 }}
spec:
{{- include "component-pod-security-context" .Values | indent 4 }}
{{- if .Values.nodeSelector }}
serviceAccountName: {{ include "alfresco-ai-transformer.serviceAccountName" . }}
{{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }}
{{- if .Values.nodeSelector }}
nodeSelector: {{- .Values.nodeSelector | toYaml | nindent 8 }}
{{- end }}
{{- include "alfresco-content-services.imagePullSecrets" . | indent 6 }}
{{- end }}
{{- include "alfresco-common.imagePullSecrets" . | indent 6 }}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down Expand Up @@ -58,14 +57,67 @@ spec:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- include "component-security-context" .Values | indent 8 }}
{{- include "alfresco-common.component-security-context" .Values | indent 8 }}
envFrom:
- configMapRef:
name: {{ template "alfresco-ai-transformer.fullname" . }}
- secretRef:
name: {{ default (printf "%s-messagebroker-secret" (include "alfresco-ai-transformer.fullname" $)) $.Values.messageBroker.existingSecretName }}
env:
{{- include "activemq.env" . | nindent 12 }}
{{- $mqSecretCtx := dict "Values" (dict "nameOverride" "ai-mq") "Chart" $.Chart "Release" $.Release }}
{{- $mqSecret := coalesce .Values.messageBroker.existingSecret.name (include "alfresco-ai-transformer.fullname" $mqSecretCtx) }}
{{- $awsSecretCtx := dict "Values" (dict "nameOverride" "aws-comprehend") "Chart" $.Chart "Release" $.Release }}
{{- $awsSecret := coalesce .Values.aws.existingSecret.name (include "alfresco-ai-transformer.fullname" $awsSecretCtx) }}
{{- $awsCmCtx := dict "Values" (dict "nameOverride" "aws-comprehend") "Chart" $.Chart "Release" $.Release }}
{{- $awsCm := coalesce .Values.aws.existingConfigMap.name (include "alfresco-ai-transformer.fullname" $awsCmCtx) }}
{{- $mqCmCtx := dict "Values" (dict "nameOverride" "ai-mq") "Chart" $.Chart "Release" $.Release }}
{{- $mqCm := coalesce .Values.messageBroker.existingSecret.name (include "alfresco-ai-transformer.fullname" $mqCmCtx) }}
{{- $sfsCmCtx := dict "Values" (dict "nameOverride" "ai-sfs") "Chart" .Chart "Release" .Release }}
{{- $sfsCm := coalesce .Values.sfs.existingConfigMap.name (include "alfresco-ai-transformer.fullname" $sfsCmCtx) }}
- name: BROKER_USERNAME
valueFrom:
secretKeyRef:
name: {{ $mqSecret }}
key: {{ .Values.messageBroker.existingSecret.keys.username }}
- name: BROKER_PASSWORD
valueFrom:
secretKeyRef:
name: {{ $mqSecret }}
key: {{ .Values.messageBroker.existingSecret.keys.password }}
- name: BROKER_URL
valueFrom:
configMapKeyRef:
name: {{ $mqCm }}
key: {{ .Values.messageBroker.existingConfigMap.keys.url }}
- name: FILE_STORE_URL
valueFrom:
configMapKeyRef:
name: {{ $sfsCm }}
key: {{ .Values.sfs.existingConfigMap.keys.url }}
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: {{ $awsSecret }}
key: {{ .Values.aws.existingSecret.keys.accessKeyId }}
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
name: {{ $awsSecret }}
key: {{ .Values.aws.existingSecret.keys.secretAccessKey }}
- name: AWS_REGION
valueFrom:
configMapKeyRef:
name: {{ $awsCm }}
key: {{ .Values.aws.existingConfigMap.keys.region }}
- name: AWS_S3_BUCKET
valueFrom:
configMapKeyRef:
name: {{ $awsCm }}
key: {{ .Values.aws.existingConfigMap.keys.s3Bucket }}
- name: AWS_COMPREHEND_ROLE_ARN
valueFrom:
configMapKeyRef:
name: {{ $awsCm }}
key: {{ .Values.aws.existingConfigMap.keys.comprehendRoleARN }}

ports:
- containerPort: {{ .Values.image.internalPort }}
resources: {{- toYaml .Values.resources | nindent 12 }}
Expand Down
16 changes: 16 additions & 0 deletions charts/alfresco-ai-transformer/templates/secret-aws.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if not .Values.aws.existingSecret.name }}
apiVersion: v1
kind: Secret
metadata:
{{- $secretCtx := dict "Values" (dict "nameOverride" "aws-comprehend") "Chart" .Chart "Release" .Release }}
name: {{ template "alfresco-ai-transformer.fullname" $secretCtx }}
labels:
{{- include "alfresco-ai-transformer.labels" . | nindent 4 }}
type: Opaque
data:
{{- with .Values.aws}}
{{- $reqmsg := "You need to pass AWS credentials as values aws.%s or provide an aws.existingSecret.name" }}
AWS_ACCESS_KEY_ID: {{ required (printf $reqmsg "accesseyId") .accessKeyId | b64enc | quote }}
AWS_SECRET_ACCESS_KEY: {{ required (printf $reqmsg "secretAccessKey") .secretAccessKey | b64enc | quote }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{{- if not .Values.messageBroker.existingSecretName }}
{{- if not .Values.messageBroker.existingSecret.name }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "alfresco-ai-transformer.fullname" . }}-messagebroker-secret
{{- $mqCtx := dict "Values" (dict "nameOverride" "ai-mq") "Chart" .Chart "Release" .Release }}
name: {{ template "alfresco-ai-transformer.fullname" $mqCtx }}
labels:
{{- include "alfresco-ai-transformer.labels" $ | nindent 4 }}
type: Opaque
data:
{{- if .Values.activemq.enabled }}
BROKER_URL: {{ printf "failover:(nio://%s-activemq-broker:61616)?timeout=3000&jms.useCompression=true" (include "alfresco-ai-transformer.fullname" .) | b64enc | quote }}
BROKER_USERNAME: {{ .Values.activemq.adminUser.user | b64enc | quote }}
BROKER_PASSWORD: {{ .Values.activemq.adminUser.password | b64enc | quote }}
{{- else }}
BROKER_URL: {{ required "Disabling in-cluster ActiveMQ requires passing (at least) messageBroker.url" .Values.messageBroker.url | b64enc | quote }}
BROKER_USERNAME: {{ .Values.messageBroker.user | b64enc | quote }}
BROKER_PASSWORD: {{ .Values.messageBroker.password | b64enc | quote }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/alfresco-ai-transformer/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "alfresco-ai-transformer.serviceAccountName" . }}
labels:
{{- include "alfresco-ai-transformer.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading