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-2297: cleanup unnecessary repo vars #139

Merged
merged 7 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions charts/alfresco-repository/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: 3.0.0-alpha.3
version: 3.0.0-alpha.4
- name: postgresql
repository: oci://registry-1.docker.io/bitnamicharts
version: 12.5.6
digest: sha256:fc5f240540fd10560dca1e88b13601b18128e2fbf0ed0b52ab9294ad58dff037
generated: "2023-10-18T14:43:10.28712+02:00"
digest: sha256:569e88f1d311e341437a62bae88d6bca83b986d8f40cb9bbafd4f33aa4e9ed8f
generated: "2023-10-27T17:28:14.899057+02:00"
4 changes: 2 additions & 2 deletions charts/alfresco-repository/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v2
name: alfresco-repository
description: Alfresco content repository Helm chart
type: application
version: 0.1.0-alpha.19
version: 0.1.0-alpha.20
appVersion: 23.1.0-A21
dependencies:
- name: alfresco-common
version: 3.0.0-alpha.3
version: 3.0.0-alpha.4
repository: https://alfresco.github.io/alfresco-helm-charts/
- name: postgresql
version: 12.5.6
Expand Down
6 changes: 2 additions & 4 deletions charts/alfresco-repository/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# alfresco-repository

![Version: 0.1.0-alpha.19](https://img.shields.io/badge/Version-0.1.0--alpha.19-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.20](https://img.shields.io/badge/Version-0.1.0--alpha.20-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

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.3 |
| https://alfresco.github.io/alfresco-helm-charts/ | alfresco-common | 3.0.0-alpha.4 |
| oci://registry-1.docker.io/bitnamicharts | postgresql | 12.5.6 |

## Values
Expand All @@ -20,8 +20,6 @@ Alfresco content repository Helm chart
| command | list | `[]` | |
| configuration.db.driver | string | `nil` | JDBC driver class of the driver if none is provided the it is guessed from the URL provided |
| configuration.db.existingConfigMap.keys.driver | string | `"DATABASE_DRIVER"` | configmap key where to find the JDBC driver class to use. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. |
| configuration.db.existingConfigMap.keys.host | string | `"DATABASE_HOST"` | configmap key where to find the hostname part of the database URL. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. |
| configuration.db.existingConfigMap.keys.port | string | `"DATABASE_PORT"` | configmap key where to find the port part of the database URL. The configmap may leverage the alfresco-repository.db.cm named template to auto-generate it from the sole url parameter. |
| configuration.db.existingConfigMap.keys.url | string | `"DATABASE_URL"` | configmap key where to find the URL of the database |
| configuration.db.existingConfigMap.name | string | `nil` | |
| configuration.db.existingSecret | object | `{"keys":{"password":"DATABASE_PASSWORD","username":"DATABASE_USERNAME"},"name":null}` | Existing secret and their keys where to find the database username & password. |
Expand Down
12 changes: 0 additions & 12 deletions charts/alfresco-repository/templates/_helpers-database.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ Usage: include "alfresco-repository.db.env" $
configMapKeyRef:
name: {{ $dbcm }}
key: {{ .existingConfigMap.keys.url }}
- name: DATABASE_HOST
valueFrom:
configMapKeyRef:
name: {{ $dbcm }}
key: {{ .existingConfigMap.keys.host }}
- name: DATABASE_PORT
valueFrom:
configMapKeyRef:
name: {{ $dbcm }}
key: {{ .existingConfigMap.keys.port }}
- name: DATABASE_DRIVER
valueFrom:
configMapKeyRef:
Expand All @@ -39,7 +29,5 @@ Usage: include "alfresco-repository.db.cm" (dict "url" "" "driver" "")
*/}}
{{- define "alfresco-repository.db.cm" -}}
DATABASE_URL: {{ hasPrefix "jdbc:" .url | ternary .url (print "jdbc:" .url) }}
DATABASE_HOST: {{ template "alfresco-common.db.hostname" .url }}
DATABASE_PORT: {{ include "alfresco-common.db.port" . | quote }}
DATABASE_DRIVER: {{ template "alfresco-common.db.driver" . }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
-Ddb.url="$DATABASE_URL"
-Ddb.username=${DATABASE_USERNAME}
-Ddb.password=${DATABASE_PASSWORD}
-Ddb.driver="$DATABASE_DRIVER"
-Ddb.driver="{{ printf "${DATABASE_DRIVER:-%s}" (include "alfresco-common.db.driver" .db) }}"
-Dmessaging.broker.url="$BROKER_URL"
-Dmessaging.broker.username="$BROKER_USERNAME"
-Dmessaging.broker.password="$BROKER_PASSWORD"
Expand Down
17 changes: 10 additions & 7 deletions charts/alfresco-repository/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ spec:
{{- include "alfresco-repository.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "alfresco-repository.serviceAccountName" . }}
{{- include "component-pod-security-context" .Values | indent 4 }}
{{- include "alfresco-common.component-pod-security-context" .Values | indent 4 }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 8 }}
{{- include "alfresco-content-services.imagePullSecrets" . | indent 6 }}
{{- include "alfresco-common.imagePullSecrets" . | indent 6 }}
initContainers:
- name: wait-db-ready
image: busybox:1.35
imagePullPolicy: IfNotPresent
{{- include "component-security-context" dict | indent 8 }}
{{- include "alfresco-common.component-security-context" dict | indent 8 }}
resources:
limits:
cpu: "0.25"
Expand All @@ -40,13 +40,16 @@ spec:
- sh
- -c
- |
until nc -w1 $(DATABASE_HOST):$(DATABASE_PORT)
do echo "waiting for database on $(DATABASE_HOST):$(DATABASE_PORT)"
{{- with .Values.configuration.db }}
{{- $dbsocket := printf "%s:%s" (include "alfresco-common.db.hostname" .url) (include "alfresco-common.db.port" .url) }}
until nc -w1 {{ $dbsocket }}
do echo 'waiting for {{ template "alfresco-common.db.rdbms" .url }} database on {{ $dbsocket }}'
sleep 2
done
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- include "component-security-context" .Values | indent 8 }}
{{- include "alfresco-common.component-security-context" .Values | indent 8 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- $dbsecretCtx := dict }}
Expand Down Expand Up @@ -189,7 +192,7 @@ spec:
{{ tpl (toYaml (list .)) $ | nindent 8 }}
{{- end }}
volumes:
{{- include "data_volume" .Values | nindent 8 }}
{{- include "alfresco-common.data_volume" .Values | nindent 8 }}
{{- if .Values.configuration.repository.existingConfigMap }}
- name: global-properties
configMap:
Expand Down
24 changes: 0 additions & 24 deletions charts/alfresco-repository/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:mysql://sandy:secret@myhost1:1111
- equal:
path: data.DATABASE_HOST
value: myhost1
- equal:
path: data.DATABASE_PORT
value: "1111"
- equal:
path: data.DATABASE_DRIVER
value: com.mysql.jdbc.Driver
Expand All @@ -79,12 +73,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:postgresql://pghost/alfdb
- equal:
path: data.DATABASE_HOST
value: pghost
- equal:
path: data.DATABASE_PORT
value: "5432"
- equal:
path: data.DATABASE_DRIVER
value: org.postgresql.Driver
Expand All @@ -99,12 +87,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000;
- equal:
path: data.DATABASE_HOST
value: sqlserverhost
- equal:
path: data.DATABASE_PORT
value: "1434"
- equal:
path: data.DATABASE_DRIVER
value: com.microsoft.sqlserver.jdbc.SQLServerDriver
Expand All @@ -119,12 +101,6 @@ tests:
- equal:
path: data.DATABASE_URL
value: jdbc:oracle:thin:@tcp://mydbhost:1521/mydbservice
- equal:
path: data.DATABASE_HOST
value: mydbhost
- equal:
path: data.DATABASE_PORT
value: "1521"
- equal:
path: data.DATABASE_DRIVER
value: oracle.jdbc.OracleDriver
Expand Down
53 changes: 51 additions & 2 deletions charts/alfresco-repository/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ tests:
- contains:
path: spec.template.spec.initContainers[0].command
content: |
until nc -w1 $(DATABASE_HOST):$(DATABASE_PORT)
do echo "waiting for database on $(DATABASE_HOST):$(DATABASE_PORT)"
until nc -w1 myhost1:1111
do echo 'waiting for mysql database on myhost1:1111'
sleep 2
done
template: deployment.yaml
Expand Down Expand Up @@ -193,3 +193,52 @@ tests:
configMapKeyRef:
name: mycm
key: DBURL


- it: should render wait-db-ready initcontainer with PostgreSQL server details
values: *test_values
set:
configuration:
db:
url: jdbc:postgresql://pghost/alfdb
asserts:
- contains:
path: spec.template.spec.initContainers[0].command
content: |
until nc -w1 pghost:5432
do echo 'waiting for postgresql database on pghost:5432'
sleep 2
done
template: deployment.yaml

- it: should render wait-db-ready initcontainer with Oracle server details
values: *test_values
set:
configuration:
db:
url: oracle:thin:@tcp://mydbhost:1521/mydbservice
asserts:
- contains:
path: spec.template.spec.initContainers[0].command
content: |
until nc -w1 mydbhost:1521
do echo 'waiting for oracle database on mydbhost:1521'
sleep 2
done
template: deployment.yaml

- it: should render wait-db-ready initcontainer with MQ SQL server details
values: *test_values
set:
configuration:
db:
url: sqlserver://sqlserverhost;databaseName=alfdb;lockTimeout=1000;
asserts:
- contains:
path: spec.template.spec.initContainers[0].command
content: |
until nc -w1 sqlserverhost:1434
do echo 'waiting for sqlserver database on sqlserverhost:1434'
sleep 2
done
template: deployment.yaml
8 changes: 0 additions & 8 deletions charts/alfresco-repository/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ configuration:
keys:
# -- configmap key where to find the URL of the database
url: DATABASE_URL
# -- configmap key where to find the hostname part of the database URL.
# The configmap may leverage the alfresco-repository.db.cm named
# template to auto-generate it from the sole url parameter.
host: DATABASE_HOST
# -- configmap key where to find the port part of the database URL.
# The configmap may leverage the alfresco-repository.db.cm named
# template to auto-generate it from the sole url parameter.
port: DATABASE_PORT
# -- configmap key where to find the JDBC driver class to use.
# The configmap may leverage the alfresco-repository.db.cm named
# template to auto-generate it from the sole url parameter.
Expand Down