diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..603871f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,77 @@ +name: Releases + +on: + push: + branches: + - master + - dev-v1 + paths: + - '.github/**' + - 'charts/**' + - '!**.md' + +jobs: + + validate: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.changed.outputs.result }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: changed + name: Changed + run: | + files_changed="$(git show --pretty="" --name-only)" + echo "$files_changed" + num_version_bumps="$(echo "$files_changed" | grep Chart.yaml | xargs git show | grep -c "+version" || true)" + if [[ "$num_version_bumps" -eq "1" ]]; then + echo "result=ok" >> $GITHUB_OUTPUT + else + echo "result=skip" + echo "::warning::Version not changed, skipping release job..." + fi + + - name: Tests + if: ${{ steps.changed.outputs.result == 'ok' }} + run: | + helm repo add bitnami https://charts.bitnami.com/bitnami + helm plugin install https://github.com/helm-unittest/helm-unittest + for FILE in charts/*; do + helm dependency update $FILE + helm unittest $FILE + done + + release: + needs: validate + if: ${{ needs.validate.outputs.result == 'ok' }} + # depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions + # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Add repos + run: | + helm repo add bitnami https://charts.bitnami.com/bitnami + helm plugin install https://github.com/helm-unittest/helm-unittest + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..52e8c5b --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +name: Tests + +on: + push: + paths: + - '.github/**' + - 'charts/**' + - '!**.md' + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Add repos + run: | + helm repo add bitnami https://charts.bitnami.com/bitnami + helm plugin install https://github.com/helm-unittest/helm-unittest + + - name: Run unit tests + run: | + for FILE in charts/*; do + helm dependency update $FILE + helm unittest $FILE + done diff --git a/.gitignore b/.gitignore index 61445d6..c775b49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .DS_STORE -charts/ \ No newline at end of file +charts/*/charts \ No newline at end of file diff --git a/.helmignore b/.helmignore index 79d2e7d..8285ce9 100644 --- a/.helmignore +++ b/.helmignore @@ -19,4 +19,4 @@ .project .idea/ *.tmproj -tests/ \ No newline at end of file +charts/*/tests/ \ No newline at end of file diff --git a/Chart.yaml b/Chart.yaml deleted file mode 100644 index 50a7b99..0000000 --- a/Chart.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -description: XWiki is a free wiki software platform written in Java with a design emphasis on extensibility. XWiki is an enterprise wiki. It includes WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management. -name: xwiki -version: 1.0-SNAPSHOT -appVersion: 11.10.4 -keywords: -- xwiki -home: http://xwiki.org -icon: hhttps://www.xwiki.org/xwiki/bin/download/Main/Logo/logo-x.png -sources: -- https://github.com/xwiki-contrib/docker-xwiki -maintainers: -- name: Ashish Sharma - email: sharma.ashish960@gmail.com -- name: Ludovic Dubost - email: ludovic@xwiki.com diff --git a/README.md b/README.md index 97bfa95..81563c9 100644 --- a/README.md +++ b/README.md @@ -2,58 +2,21 @@ This is the XWiki [Helm Chart](https://helm.sh/) aiming to ease the deployment in both Local and Highly Available setups. +## Usage + +Please check the [documentation](https://extensions.xwiki.org/xwiki/bin/view/Extension/XWikiHelm/) about this chart. ## Resources * XWiki Installation Guide: https://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation * XWiki Docker : https://github.com/xwiki-contrib/docker-xwiki - -## Prerequisite - -* Minikube -* Kubectl cli -* helm cli - -## Installation on Minikube - -* First, enable ingress - -```bash -minikube addons enable ingress -``` - -* Install chart - -```bash -git clone https://github.com/xwiki-contrib/xwiki-helm -cd xwiki-helm-chart -helm dependency update -helm --debug upgrade -i --force xwiki -f ./values.yaml . -``` - -## Usage - -Get ip address of minikube - -```bash -ip=$(minikube ip) -curl $ip -``` - -## Test - -For testing first add [unittest](https://github.com/lrills/helm-unittest#install) -```bash -helm plugin install https://github.com/lrills/helm-unittest -helm unittest xwiki-helm -``` - ## Project Information * Project Lead: [Ashish Sharma](https://www.xwiki.org/xwiki/bin/view/XWiki/ashish932) +* [Documentation](https://extensions.xwiki.org/xwiki/bin/view/Extension/XWikiHelm/) * [Issue Tracker](http://jira.xwiki.org/browse/HELM) -* Communication: [Mailing List](http://dev.xwiki.org/xwiki/bin/view/Community/MailingLists), [IRC](http://dev.xwiki.org/xwiki/bin/view/Community/IRC) +* Communication: [Forums & Mailing Lists](https://dev.xwiki.org/xwiki/bin/view/Community/Discuss), [Chat](https://dev.xwiki.org/xwiki/bin/view/Community/Chat) * [Development Practices](http://dev.xwiki.org) * Minimal XWiki version supported: XWiki 8.4 * License: LGPL 2.1 diff --git a/charts/xwiki/Chart.lock b/charts/xwiki/Chart.lock new file mode 100644 index 0000000..c9d71c2 --- /dev/null +++ b/charts/xwiki/Chart.lock @@ -0,0 +1,15 @@ +dependencies: +- name: common + repository: https://charts.bitnami.com/bitnami + version: 2.2.2 +- name: mysql + repository: https://charts.bitnami.com/bitnami + version: 9.4.8 +- name: mariadb + repository: https://charts.bitnami.com/bitnami + version: 11.4.5 +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 12.1.13 +digest: sha256:eed001db0c159eb0e99d9c5c22ec579a79fe4d80c5d6ed2418f5d0472a08d9d0 +generated: "2023-02-02T10:11:09.3444207-03:00" diff --git a/charts/xwiki/Chart.yaml b/charts/xwiki/Chart.yaml new file mode 100644 index 0000000..1275698 --- /dev/null +++ b/charts/xwiki/Chart.yaml @@ -0,0 +1,35 @@ +apiVersion: v2 +description: XWiki is a free wiki software platform written in Java with a design emphasis on extensibility. XWiki is an enterprise wiki. It includes WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management. +name: xwiki +version: 1.0.0-Beta.3 +type: application +keywords: +- xwiki +home: http://xwiki.org +icon: https://www.xwiki.org/xwiki/bin/download/Main/Logo/logo-x.png +sources: +- https://github.com/xwiki-contrib/docker-xwiki +maintainers: +- name: Ashish Sharma + email: sharma.ashish960@gmail.com +- name: Ludovic Dubost + email: ludovic@xwiki.com +- name: Guilherme Sautner + email: guilherme.sautner@xwiki.com +dependencies: + - name: "common" + repository: "https://charts.bitnami.com/bitnami" + version: "2.2.2" + - name: mysql + repository: https://charts.bitnami.com/bitnami + version: 9.4.8 + condition: mysql.enabled + - name: mariadb + repository: https://charts.bitnami.com/bitnami + version: 11.4.5 + condition: mariadb.enabled + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 12.1.13 + condition: postgresql.enabled + diff --git a/templates/NOTES.txt b/charts/xwiki/templates/NOTES.txt old mode 100755 new mode 100644 similarity index 82% rename from templates/NOTES.txt rename to charts/xwiki/templates/NOTES.txt index 16f7fd5..81106dc --- a/templates/NOTES.txt +++ b/charts/xwiki/templates/NOTES.txt @@ -1,13 +1,13 @@ {{- if contains "NodePort" .Values.service.type }} Get the application URL by running these commands: - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "xwiki.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT/xwiki/ {{- else if contains "LoadBalancer" .Values.service.type }} Get the application URL by running these commands: NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + You can watch the status of by running 'kubectl get svc -w {{ template "xwiki.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "xwiki.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo http://$SERVICE_IP:{{ .Values.service.externalPort }} {{- end }} diff --git a/charts/xwiki/templates/_helpers.tpl b/charts/xwiki/templates/_helpers.tpl new file mode 100644 index 0000000..a720cad --- /dev/null +++ b/charts/xwiki/templates/_helpers.tpl @@ -0,0 +1,47 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "xwiki.name" -}} +{{- include "common.names.name" . }} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "xwiki.fullname" -}} +{{- include "common.names.fullname" . }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "xwiki.labels" -}} +{{- include "common.labels.standard" . }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "xwiki.selectorLabels" -}} +{{- include "common.labels.matchLabels" . }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "xwiki.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "xwiki.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{/* +Create the name of init scripts configmap +*/}} +{{- define "xwiki.initScripts" -}} +{{- printf "%s-init-scripts" (include "xwiki.fullname" .) }} +{{- end }} diff --git a/templates/configmaps.yaml b/charts/xwiki/templates/configmaps.yaml similarity index 50% rename from templates/configmaps.yaml rename to charts/xwiki/templates/configmaps.yaml index f7c32cc..d47c696 100644 --- a/templates/configmaps.yaml +++ b/charts/xwiki/templates/configmaps.yaml @@ -1,25 +1,27 @@ +{{- $fullName := include "xwiki.fullname" . -}} apiVersion: v1 kind: ConfigMap metadata: - name: {{ template "fullname" . }} + name: {{ $fullName }} labels: - app: {{ template "fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" - release: {{ .Release.Name | quote }} - heritage: {{ .Release.Service | quote }} + {{- include "xwiki.labels" . | nindent 4 }} data: {{- if .Values.solr.enabled }} INDEX_HOST: {{ .Values.solr.host | quote }} INDEX_PORT: {{ .Values.solr.port | quote }} {{- end }} -{{- if .Values.mysql.enabled }} - DB_USER: {{ .Values.mysql.mysqlUser | quote }} +{{- if .Values.mariadb.enabled }} + DB_USER: {{ .Values.mariadb.auth.username | quote }} + DB_HOST: "{{ .Release.Name }}-mariadb" + DB_DATABASE: {{ .Values.mariadb.auth.database | quote }} +{{- else if .Values.mysql.enabled }} + DB_USER: {{ .Values.mysql.auth.username | quote }} DB_HOST: "{{ .Release.Name }}-mysql" - DB_DATABASE: {{ .Values.mysql.mysqlDatabase | quote }} + DB_DATABASE: {{ .Values.mysql.auth.database | quote }} {{- else if .Values.postgresql.enabled }} - DB_USER: {{ .Values.postgresql.postgresqlUsername | quote }} + DB_USER: {{ .Values.postgresql.auth.username | quote }} DB_HOST: "{{ .Release.Name }}-postgresql" - DB_DATABASE: {{ .Values.postgresql.postgresqlDatabase | quote }} + DB_DATABASE: {{ .Values.postgresql.auth.database | quote }} {{- else }} DB_USER: {{ .Values.externalDB.user | quote }} DB_HOST: {{ .Values.externalDB.host | quote }} diff --git a/templates/gateway.yaml b/charts/xwiki/templates/gateway.yaml similarity index 92% rename from templates/gateway.yaml rename to charts/xwiki/templates/gateway.yaml index 160c344..c74a1f5 100644 --- a/templates/gateway.yaml +++ b/charts/xwiki/templates/gateway.yaml @@ -31,5 +31,5 @@ spec: - destination: port: number: {{ .Values.service.externalPort }} - host: {{ template "fullname" . }} + host: {{ template "xwiki.fullname" . }} {{- end -}} \ No newline at end of file diff --git a/charts/xwiki/templates/ingress.yaml b/charts/xwiki/templates/ingress.yaml new file mode 100644 index 0000000..72aca98 --- /dev/null +++ b/charts/xwiki/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "xwiki.fullname" . -}} +{{- $svcPort := .Values.service.externalPort -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ include "xwiki.fullname" . }} + labels: + {{- include "xwiki.labels" . | nindent 4 }} + annotations: + {{- if .Values.ingress.annotations }} +{{ toYaml .Values.ingress.annotations | indent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/xwiki/templates/initialization-configmaps.yaml b/charts/xwiki/templates/initialization-configmaps.yaml new file mode 100644 index 0000000..532de54 --- /dev/null +++ b/charts/xwiki/templates/initialization-configmaps.yaml @@ -0,0 +1,44 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ (include "xwiki.initScripts" .) }} + labels: + {{- include "xwiki.labels" . | nindent 4 }} +data: + entrypoint: | + #!/bin/bash + ## + # *Experimental* solution for custom properties. + # With time we are looking other alternatives to setup this custom values. + ## + # Always execute "first_start" in order to get all new values keys from future versions. + rm -f /usr/local/xwiki/data/xwiki.cfg + rm -f /usr/local/xwiki/data/xwiki.properties + rm -f /usr/local/xwiki/data/hibernate.cfg.xml + + # Reuse commands/resources from default entrypoint. + source /usr/local/bin/docker-entrypoint.sh + file_env 'CONTEXT_PATH' 'ROOT' + # Setup all default actions from first start + first_start + + # Replace all values from keys defineded on customConfigs + {{- range $file, $values := .Values.customConfigs }} + {{- range $key, $value := $values }} + # TODO review/manage extensions + if grep -wq "{{ $key }}" /usr/local/xwiki/data/{{ $file }}; then + echo "Key ({{ $key }}) exists on file ({{ $file }}), replacing that key line with new value." + xwiki_replace "/usr/local/xwiki/data/{{ $file }}" "{{ $key }}" "{{ $value }}" || true + else + echo "Key ({{ $key }}) don't exists on file ({{ $file }}), appending that key line with new value." + echo '{{ $key }} = {{ $value | quote }}' >> "/usr/local/xwiki/data/{{ $file }}" || true + fi + {{- end }} + {{- end }} + + {{- range $file, $value := .Values.properties }} + export JAVA_OPTS="${JAVA_OPTS} -D{{ $file }}={{ $value }}" + {{- end }} + + exec /usr/local/bin/docker-entrypoint.sh xwiki + \ No newline at end of file diff --git a/templates/poddisruptionbudget.yaml b/charts/xwiki/templates/poddisruptionbudget.yaml similarity index 61% rename from templates/poddisruptionbudget.yaml rename to charts/xwiki/templates/poddisruptionbudget.yaml index b73aef9..96317c8 100644 --- a/templates/poddisruptionbudget.yaml +++ b/charts/xwiki/templates/poddisruptionbudget.yaml @@ -1,13 +1,11 @@ {{- if .Values.podDisruptionBudget.enabled }} +{{- $fullName := include "xwiki.fullname" . -}} apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: - name: {{ template "fullname" . }} + name: {{ $fullName }} labels: - app: {{ template "fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" - release: {{ .Release.Name | quote }} - heritage: {{ .Release.Service | quote }} + {{- include "xwiki.labels" . | nindent 4 }} spec: {{- if .Values.podDisruptionBudget.minAvailable }} minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} @@ -17,5 +15,5 @@ spec: {{- end }} selector: matchLabels: - app: {{ template "fullname" . }} + {{- include "xwiki.selectorLabels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/charts/xwiki/templates/secrets.yaml b/charts/xwiki/templates/secrets.yaml new file mode 100644 index 0000000..3dc52d2 --- /dev/null +++ b/charts/xwiki/templates/secrets.yaml @@ -0,0 +1,18 @@ +{{- $fullName := include "xwiki.fullname" . -}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ $fullName }} + labels: + {{- include "xwiki.labels" . | nindent 4 }} +type: Opaque +data: +{{- if .Values.mariadb.enabled }} + DB_PASSWORD: {{ .Values.mariadb.auth.password | b64enc | quote }} +{{- else if .Values.postgresql.enabled }} + DB_PASSWORD: {{ .Values.postgresql.auth.password | b64enc | quote }} +{{- else if .Values.mysql.enabled }} + DB_PASSWORD: {{ .Values.mysql.auth.password | b64enc | quote }} +{{- else }} + DB_PASSWORD: {{ .Values.externalDB.password | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/templates/service.yaml b/charts/xwiki/templates/service.yaml old mode 100755 new mode 100644 similarity index 66% rename from templates/service.yaml rename to charts/xwiki/templates/service.yaml index 7b9743a..e8e2a28 --- a/templates/service.yaml +++ b/charts/xwiki/templates/service.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "fullname" . }} + name: {{ include "xwiki.fullname" . }} labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" + {{- include "xwiki.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: @@ -13,4 +13,4 @@ spec: name: {{ .Values.service.name }} sessionAffinity: ClientIP selector: - app: {{ template "fullname" . }} \ No newline at end of file + {{- include "xwiki.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/xwiki/templates/xwiki.yaml b/charts/xwiki/templates/xwiki.yaml new file mode 100644 index 0000000..51080c3 --- /dev/null +++ b/charts/xwiki/templates/xwiki.yaml @@ -0,0 +1,167 @@ +{{- $fullName := include "xwiki.fullname" . -}} +{{- if .Values.workloadStateful }} +apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }} +kind: StatefulSet +{{- else }} +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +{{- end }} +metadata: + name: {{ $fullName }} + labels: + {{- include "xwiki.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.workloadStateful }} + serviceName: {{ $fullName }} + {{- end }} + selector: + matchLabels: + {{- include "xwiki.selectorLabels" . | nindent 6 }} + template: + metadata: + annotations: + # Annotations to rollout changes on configs on workload + checksum/configmap: {{ include (print $.Template.BasePath "/configmaps.yaml") . | sha256sum }} + checksum/initialization-configmaps: {{ include (print $.Template.BasePath "/initialization-configmaps.yaml") . | sha256sum }} + labels: + {{- include "xwiki.labels" . | nindent 8 }} + spec: + containers: + - name: {{ .Chart.Name }} + {{- if .Values.image.tag }} + image: {{ .Values.image.name }}:{{ .Values.image.tag }} + {{- else if .Values.mysql.enabled }} + image: "{{ .Values.image.name }}:lts-mysql-tomcat" + {{- else if .Values.postgresql.enabled }} + image: "{{ .Values.image.name }}:lts-postgres-tomcat" + {{- else }} + image: {{ .Values.image.name }} + {{- end }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: ["/bin/bash", "/configmaps/entrypoint"] + ports: + - containerPort: {{ .Values.service.internalPort }} + env: + {{- if .Values.javaOpts }} + - name: JAVA_OPTS + value: {{ .Values.javaOpts | join " " | quote }} + {{- end }} + {{- range .Values.extraEnvVars }} + - name: {{ .name }} + value: {{ .value | quote }} + {{- end }} + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + {{- if .Values.mysql.enabled }} + name: "{{ .Release.Name }}-mysql" + key: mysql-password + {{- else if .Values.postgresql.enabled }} + name: "{{ .Release.Name }}-postgresql" + key: postgres-password + {{- else }} + name: {{ .Release.Name | quote }} + key: DB_PASSWORD + {{- end }} + {{- if .Values.solr.enabled }} + - name: INDEX_HOST + valueFrom: + configMapKeyRef: + name: {{ $fullName }} + key: INDEX_HOST + - name: INDEX_PORT + valueFrom: + configMapKeyRef: + name: {{ $fullName }} + key: INDEX_PORT + {{- end }} + - name: DB_HOST + valueFrom: + configMapKeyRef: + name: {{ $fullName }} + key: DB_HOST + - name: DB_USER + valueFrom: + configMapKeyRef: + name: {{ $fullName }} + key: DB_USER + - name: DB_DATABASE + valueFrom: + configMapKeyRef: + name: {{ $fullName }} + key: DB_DATABASE + resources: +{{ toYaml .Values.resources | indent 12 }} + volumeMounts: + - name: xwiki-data + mountPath: /usr/local/xwiki/data + - name: configmaps + mountPath: /configmaps + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: configmaps + configMap: + name: {{ include "xwiki.initScripts" . }} + - name: xwiki-data + {{- if and .Values.persistence.enabled .Values.persistence.existingClaim }} + persistentVolumeClaim: + claimName: {{ tpl .Values.persistence.existingClaim $ }} + {{- else if not .Values.persistence.enabled }} + emptyDir: {} + {{- else if .Values.workloadStateful }} + volumeClaimTemplates: + - metadata: + name: xwiki-data + {{- if .Values.persistence.annotations }} + annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }} + {{- end }} + {{- if .Values.persistence.labels }} + labels: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.labels "context" $) | nindent 10 }} + {{- end }} + spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + {{- if .Values.persistence.dataSource }} + dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataSource "context" $) | nindent 10 }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- if .Values.persistence.selector }} + selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 10 }} + {{- end }} + {{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 8 }} + {{- else }} + persistentVolumeClaim: + claimName: xwiki +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: xwiki +spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- if .Values.storageClass }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/charts/xwiki/tests/__snapshot__/configmaps_test.yaml.snap b/charts/xwiki/tests/__snapshot__/configmaps_test.yaml.snap new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/charts/xwiki/tests/__snapshot__/configmaps_test.yaml.snap @@ -0,0 +1 @@ +{} diff --git a/charts/xwiki/tests/__snapshot__/gateway_test.yaml.snap b/charts/xwiki/tests/__snapshot__/gateway_test.yaml.snap new file mode 100644 index 0000000..e7f33fb --- /dev/null +++ b/charts/xwiki/tests/__snapshot__/gateway_test.yaml.snap @@ -0,0 +1,40 @@ +should properly set value of VirtualService: + 1: | + gateways: + - xwiki-gateway + hosts: + - '*' + http: + - match: + - uri: + prefix: / + route: + - destination: + host: RELEASE-NAME-xwiki + port: + number: 80 +should set values properly of Gateway: + 1: | + selector: + istio: ingressgateway + servers: + - hosts: + - '*' + port: + name: http + number: 80 + protocol: HTTP + 2: | + gateways: + - xwiki-gateway + hosts: + - '*' + http: + - match: + - uri: + prefix: / + route: + - destination: + host: release-xwiki + port: + number: 80 diff --git a/charts/xwiki/tests/__snapshot__/ingress_test.yaml.snap b/charts/xwiki/tests/__snapshot__/ingress_test.yaml.snap new file mode 100644 index 0000000..75ddc3b --- /dev/null +++ b/charts/xwiki/tests/__snapshot__/ingress_test.yaml.snap @@ -0,0 +1,15 @@ +should set values properly: + 1: | + kubernetes.io/ingress.class: nginx + 2: | + rules: + - host: "" + http: + paths: + - backend: + service: + name: release-xwiki + port: + number: 80 + path: / + pathType: ImplementationSpecific diff --git a/tests/__snapshot__/secrets_test.yaml.snap b/charts/xwiki/tests/__snapshot__/secrets_test.yaml.snap similarity index 100% rename from tests/__snapshot__/secrets_test.yaml.snap rename to charts/xwiki/tests/__snapshot__/secrets_test.yaml.snap diff --git a/charts/xwiki/tests/__snapshot__/service_test.yaml.snap b/charts/xwiki/tests/__snapshot__/service_test.yaml.snap new file mode 100644 index 0000000..44e5e91 --- /dev/null +++ b/charts/xwiki/tests/__snapshot__/service_test.yaml.snap @@ -0,0 +1,12 @@ +should set values properly: + 1: | + ports: + - name: tcp + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app.kubernetes.io/instance: release + app.kubernetes.io/name: xwiki + sessionAffinity: ClientIP + type: ClusterIP diff --git a/tests/__snapshot__/deployment_test.yaml.snap b/charts/xwiki/tests/__snapshot__/xwiki_test.yaml.snap similarity index 66% rename from tests/__snapshot__/deployment_test.yaml.snap rename to charts/xwiki/tests/__snapshot__/xwiki_test.yaml.snap index 35ae6a6..0fc183d 100644 --- a/tests/__snapshot__/deployment_test.yaml.snap +++ b/charts/xwiki/tests/__snapshot__/xwiki_test.yaml.snap @@ -1,18 +1,3 @@ -should properly set value: - 1: | - - mountPath: /opt/solr/server/solr - name: xwiki-data - 2: | - - name: xwiki-data - persistentVolumeClaim: - claimName: xwiki -should properly set value pvc: - 1: | - accessModes: - - ReadWriteMany - resources: - requests: - storage: 500Mi should use custom image: 1: | - name: DB_PASSWORD @@ -20,6 +5,16 @@ should use custom image: secretKeyRef: key: DB_PASSWORD name: RELEASE-NAME + - name: INDEX_HOST + valueFrom: + configMapKeyRef: + key: INDEX_HOST + name: RELEASE-NAME-xwiki + - name: INDEX_PORT + valueFrom: + configMapKeyRef: + key: INDEX_PORT + name: RELEASE-NAME-xwiki - name: DB_HOST valueFrom: configMapKeyRef: @@ -42,6 +37,16 @@ should use mysql lts image: secretKeyRef: key: mysql-password name: RELEASE-NAME-mysql + - name: INDEX_HOST + valueFrom: + configMapKeyRef: + key: INDEX_HOST + name: RELEASE-NAME-xwiki + - name: INDEX_PORT + valueFrom: + configMapKeyRef: + key: INDEX_PORT + name: RELEASE-NAME-xwiki - name: DB_HOST valueFrom: configMapKeyRef: @@ -62,8 +67,18 @@ should use postgres lts image: - name: DB_PASSWORD valueFrom: secretKeyRef: - key: postgresql-password + key: postgres-password name: RELEASE-NAME-postgresql + - name: INDEX_HOST + valueFrom: + configMapKeyRef: + key: INDEX_HOST + name: RELEASE-NAME-xwiki + - name: INDEX_PORT + valueFrom: + configMapKeyRef: + key: INDEX_PORT + name: RELEASE-NAME-xwiki - name: DB_HOST valueFrom: configMapKeyRef: diff --git a/tests/configmaps_test.yaml b/charts/xwiki/tests/configmaps_test.yaml similarity index 51% rename from tests/configmaps_test.yaml rename to charts/xwiki/tests/configmaps_test.yaml index f3243a2..bd903da 100644 --- a/tests/configmaps_test.yaml +++ b/charts/xwiki/tests/configmaps_test.yaml @@ -14,42 +14,42 @@ tests: - equal: path: metadata.name value: release-xwiki - - equal: - path: metadata.labels.app - value: release-xwiki - - matchRegex: - path: metadata.labels.chart - value: xwiki-* - - equal: - path: metadata.labels.release - value: release - - equal: - path: metadata.labels.heritage - value: Tiller - - matchSnapshot: - path: spec +# - equal: +# path: metadata.labels.app +# value: release-xwiki +# - matchRegex: +# path: metadata.labels.chart +# value: xwiki-* +# - equal: +# path: metadata.labels.release +# value: release +# - equal: +# path: metadata.labels.heritage +# value: Tiller +# - matchSnapshot: +# path: spec - it: should set mysql config values set: - mysql.mysqlUser: xwiki - mysql.mysqlDatabase: xwikidb + mysql.auth.username: xwikim + mysql.auth.database: xwikimdb mysql.enabled: true - postgresql.enabled: true + postgresql.enabled: false release: name: release asserts: - equal: path: data.DB_USER - value: xwiki + value: xwikim - equal: path: data.DB_HOST value: release-mysql - equal: path: data.DB_DATABASE - value: xwikidb + value: xwikimdb - it: should set postgres config values set: - postgresql.postgresqlUsername: xwiki - postgresql.postgresqlDatabase: xwikidb + postgresql.auth.username: xwikip + postgresql.auth.database: xwikipdb mysql.enabled: false postgresql.enabled: true release: @@ -57,27 +57,47 @@ tests: asserts: - equal: path: data.DB_USER - value: xwiki + value: xwikip - equal: path: data.DB_HOST value: release-postgresql - equal: path: data.DB_DATABASE - value: xwikidb + value: xwikipdb + - it: should set mariadb config values + set: + mariadb.auth.username: xwikim + mariadb.auth.database: xwikimdb + mysql.enabled: false + postgresql.enabled: false + mariadb.enabled: true + release: + name: release + asserts: + - equal: + path: data.DB_USER + value: xwikim + - equal: + path: data.DB_HOST + value: release-mariadb + - equal: + path: data.DB_DATABASE + value: xwikimdb - it: should set externalDB config values set: - externalDB.user: xwiki + externalDB.user: xwikie externalDB.host: xwiki-host - externalDB.database: xwikidb + externalDB.database: xwikiedb mysql.enabled: false postgresql.enabled: false + mariadb.enabled: false asserts: - equal: path: data.DB_USER - value: xwiki + value: xwikie - equal: path: data.DB_HOST value: xwiki-host - equal: path: data.DB_DATABASE - value: xwikidb + value: xwikiedb diff --git a/tests/gateway_test.yaml b/charts/xwiki/tests/gateway_test.yaml similarity index 94% rename from tests/gateway_test.yaml rename to charts/xwiki/tests/gateway_test.yaml index 3e9ba38..fa04e35 100644 --- a/tests/gateway_test.yaml +++ b/charts/xwiki/tests/gateway_test.yaml @@ -10,11 +10,13 @@ tests: asserts: - isKind: of: Gateway + documentIndex: 0 - isAPIVersion: of: networking.istio.io/v1alpha3 - equal: path: metadata.name value: xwiki-gateway + documentIndex: 0 - matchSnapshot: path: spec - it: should properly set value of VirtualService diff --git a/tests/ingress_test.yaml b/charts/xwiki/tests/ingress_test.yaml similarity index 73% rename from tests/ingress_test.yaml rename to charts/xwiki/tests/ingress_test.yaml index 3fff50d..da46902 100644 --- a/tests/ingress_test.yaml +++ b/charts/xwiki/tests/ingress_test.yaml @@ -16,13 +16,16 @@ tests: asserts: - isKind: of: Ingress + template: ingress.yaml - matchSnapshot: path: metadata.annotations + template: ingress.yaml - equal: path: metadata.name value: release-xwiki - - matchRegex: - path: metadata.labels.chart - pattern: xwiki-* +# - matchRegex: +# path: metadata.labels.chart +# pattern: xwiki-* - matchSnapshot: - path: spec \ No newline at end of file + path: spec + template: ingress.yaml \ No newline at end of file diff --git a/tests/poddisruptionbudget_test.yaml b/charts/xwiki/tests/poddisruptionbudget_test.yaml similarity index 95% rename from tests/poddisruptionbudget_test.yaml rename to charts/xwiki/tests/poddisruptionbudget_test.yaml index 731bb26..5f6ed4e 100644 --- a/tests/poddisruptionbudget_test.yaml +++ b/charts/xwiki/tests/poddisruptionbudget_test.yaml @@ -14,8 +14,6 @@ tests: of: PodDisruptionBudget - isAPIVersion: of: policy/v1beta1 - - matchSnapshot: - path: metadata - matchSnapshot: path: spec - it: should not set maxUnavailable diff --git a/tests/secrets_test.yaml b/charts/xwiki/tests/secrets_test.yaml similarity index 67% rename from tests/secrets_test.yaml rename to charts/xwiki/tests/secrets_test.yaml index bcc77ce..b3a808a 100644 --- a/tests/secrets_test.yaml +++ b/charts/xwiki/tests/secrets_test.yaml @@ -14,32 +14,29 @@ tests: - equal: path: metadata.name value: release-xwiki - - equal: - path: metadata.labels.app - value: release-xwiki - - matchRegex: - path: metadata.labels.chart - value: xwiki-* - - equal: - path: metadata.labels.release - value: release - - equal: - path: metadata.labels.heritage - value: Tiller +# - matchRegex: +# path: metadata.labels.chart +# value: xwiki-* +# - equal: +# path: metadata.labels.release +# value: release +# - equal: +# path: metadata.labels.heritage +# value: Tiller - equal: path: type value: Opaque - it: should set mysql secret values set: - mysql.mysqlPassword: xwikip + mysql.auth.password: xwikip mysql.enabled: true - postgresql.enabled: true + postgresql.enabled: false asserts: - matchSnapshot: path: data.DB_PASSWORD - it: should set postgres secret values set: - postgresql.postgresqlPassword: xwikip + postgresql.auth.password: xwikip mysql.enabled: false postgresql.enabled: true asserts: diff --git a/tests/service_test.yaml b/charts/xwiki/tests/service_test.yaml similarity index 63% rename from tests/service_test.yaml rename to charts/xwiki/tests/service_test.yaml index f2a4bbd..59c84cb 100644 --- a/tests/service_test.yaml +++ b/charts/xwiki/tests/service_test.yaml @@ -1,7 +1,6 @@ suite: test service templates: - service.yaml - - deployment.yaml tests: - it: should set values properly set: @@ -14,8 +13,10 @@ tests: asserts: - isKind: of: Service +# template: service.yaml - matchSnapshot: path: spec +# template: service.yaml - it: should have same labels as Deployment set: service.type: ClusterIP @@ -26,13 +27,7 @@ tests: name: release asserts: - equal: - path: spec.selector.app - value: release-xwiki - - equal: - path: spec.selector.matchLabels.app - value: release-xwiki - template: deployment.yaml - - equal: - path: spec.template.metadata.labels.app - value: release-xwiki - template: deployment.yaml \ No newline at end of file + path: spec.selector + value: + app.kubernetes.io/instance: release + app.kubernetes.io/name: xwiki \ No newline at end of file diff --git a/charts/xwiki/tests/xwiki_test.yaml b/charts/xwiki/tests/xwiki_test.yaml new file mode 100644 index 0000000..e44e638 --- /dev/null +++ b/charts/xwiki/tests/xwiki_test.yaml @@ -0,0 +1,109 @@ +suite: test deployment +templates: + - xwiki.yaml + - configmaps.yaml + - initialization-configmaps.yaml +tests: + - it: testing default values + documentIndex: 0 + asserts: + - isKind: + of: StatefulSet + template: xwiki.yaml + - isNotEmpty: + path: spec.template.metadata.annotations["checksum/configmap"] + template: xwiki.yaml + - isNotEmpty: + path: spec.template.metadata.annotations["checksum/initialization-configmaps"] + template: xwiki.yaml + - it: should use custom image + set: + image.tag: latest + mysql.enabled: false + postgresql.enabled: false + mariadb.enabled: false + image.name: default + workloadStateful: false + asserts: + - isKind: + of: Deployment + template: xwiki.yaml + documentIndex: 0 + - equal: + path: spec.template.spec.containers[0].image + value: default:latest + template: xwiki.yaml + documentIndex: 0 + - matchSnapshot: + path: spec.template.spec.containers[0].env + template: xwiki.yaml + documentIndex: 0 + - it: should use mysql lts image + set: + mysql.enabled: true + postgresql.enabled: false + mariadb.enabled: false + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: xwiki:lts-mysql-tomcat + template: xwiki.yaml + - matchSnapshot: + path: spec.template.spec.containers[0].env + template: xwiki.yaml + - it: should use postgres lts image + set: + mysql.enabled: false + postgresql.enabled: true + mariadb.enabled: false + asserts: + - equal: + path: spec.template.spec.containers[0].image + value: xwiki:lts-postgres-tomcat + template: xwiki.yaml + - matchSnapshot: + path: spec.template.spec.containers[0].env + template: xwiki.yaml + - it: should properly set value + set: + image.pullPolicy: IfNotPresent + service.internalPort: 8080 + asserts: + - equal: + path: spec.template.spec.containers[0].imagePullPolicy + value: IfNotPresent + template: xwiki.yaml + - equal: + path: spec.template.spec.containers[0].ports[0].containerPort + value: 8080 + template: xwiki.yaml +# - equal: +# path: spec.template.spec.containers[0].volumeMounts[1].name +# value: xwiki-data +# template: xwiki.yaml +# - equal: +# path: spec.template.spec.volumes[1].name +# value: xwiki-data +# template: xwiki.yaml +# - equal: +# path: spec.template.spec.volumes[1].persistentVolumeClaim.claimName +# value: xwiki +# template: xwiki.yaml +# - matchSnapshot: +# path: spec.template.spec.containers[1].volumeMounts +# template: xwiki.yaml +# - matchSnapshot: +# path: spec.template.spec.volumes +# template: xwiki.yaml +# - it: should properly set value pvc +# asserts: +# - isKind: +# of: PersistentVolumeClaim +# documentIndex: 1 +# - matchSnapshot: +# path: spec +# documentIndex: 1 +# - equal: +# path: metadata.name +# value: xwiki +# documentIndex: 1 \ No newline at end of file diff --git a/charts/xwiki/values.yaml b/charts/xwiki/values.yaml new file mode 100644 index 0000000..5900ec9 --- /dev/null +++ b/charts/xwiki/values.yaml @@ -0,0 +1,242 @@ +# Default values for node. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +image: + name: xwiki + pullPolicy: IfNotPresent +## Image Tag useful when externalDB is been used + tag: '' +service: + portName: node + name: http + type: ClusterIP + externalPort: 80 + internalPort: 8080 +resources: {} +# limits: +# cpu: 2000m +# memory: 2000Mi +# requests: +# cpu: 500m +# memory: 768Mi + +javaOpts: [] +# - "-Xmx1024m" +extraEnvVars: [] +# - name: FOO +# value: "bar" + +# Enable to choose witch kind of workload will be used: (true) StatefulSet or (false) for Deployment +workloadStateful: true + +## +## MySql chart configuration +## +## https://github.com/bitnami/charts/tree/main/bitnami/mysql +## +mysql: + ## Whether to deploy a mysql server. Set false for a different database. + enabled: true + auth: + rootPassword: "xwiki" + username: "xwiki" + password: "xwiki" + database: "xwiki" + initdbScripts: + 00-init.sql: | + grant all privileges on *.* to xwiki@'%' + primary: + # Changed to use UTF8mb4, check future versions if this was already changed. + # TODO: review explicit_defaults_for_timestamp + configuration: |- + [mysqld] + default_authentication_plugin=mysql_native_password + skip-name-resolve + explicit_defaults_for_timestamp + basedir=/opt/bitnami/mysql + plugin_dir=/opt/bitnami/mysql/lib/plugin + port=3306 + socket=/opt/bitnami/mysql/tmp/mysql.sock + datadir=/bitnami/mysql/data + tmpdir=/opt/bitnami/mysql/tmp + max_allowed_packet=16M + bind-address=* + pid-file=/opt/bitnami/mysql/tmp/mysqld.pid + log-error=/opt/bitnami/mysql/logs/mysqld.log + character-set-server=UTF8MB4 + collation-server=utf8mb4_0900_ai_ci + slow_query_log=0 + slow_query_log_file=/opt/bitnami/mysql/logs/mysqld.log + long_query_time=10.0 + + [client] + port=3306 + socket=/opt/bitnami/mysql/tmp/mysql.sock + default-character-set=UTF8MB4 + plugin_dir=/opt/bitnami/mysql/lib/plugin + + [manager] + port=3306 + socket=/opt/bitnami/mysql/tmp/mysql.sock + pid-file=/opt/bitnami/mysql/tmp/mysqld.pid + +## +## MariaDB chart configuration +## +## https://github.com/bitnami/charts/tree/main/bitnami/mariadb +## +mariadb: + ## Whether to deploy a mysql server. Set false for a different database. + enabled: false + auth: + rootPassword: "xwiki" + username: "xwiki" + password: "xwiki" + database: "xwiki" + initdbScripts: + 00-init.sql: | + grant all privileges on *.* to xwiki@'%' + # Changed to use UTF8mb4, check future versions if this was already changed. + # TODO: review explicit_defaults_for_timestamp + configuration: |- + [mysqld] + skip-name-resolve + explicit_defaults_for_timestamp + basedir=/opt/bitnami/mariadb + plugin_dir=/opt/bitnami/mariadb/plugin + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + tmpdir=/opt/bitnami/mariadb/tmp + max_allowed_packet=16M + bind-address=* + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid + log-error=/opt/bitnami/mariadb/logs/mysqld.log + character-set-server=UTF8MB4 + collation-server=utf8mb4_general_ci + slow_query_log=0 + slow_query_log_file=/opt/bitnami/mariadb/logs/mysqld.log + long_query_time=10.0 + + [client] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + default-character-set=UTF8MB4 + plugin_dir=/opt/bitnami/mariadb/plugin + + [manager] + port=3306 + socket=/opt/bitnami/mariadb/tmp/mysql.sock + pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid +## +## PostgreSQL chart configuration +## +## https://github.com/helm/charts/tree/master/stable/postgresql +## +postgresql: + ## Whether to deploy a postgresql server. Set false for a different database. + enabled: false + auth: + postgresPassword: "xwiki" + username: "xwiki" + password: "xwiki" + database: "xwiki" + #persistence: + # size: 8Gi + +## +## For custom mysql and postgres database. Use externalDB. +## Would be used only if postgres and mysql is disabled. +## Set the image tag if want to use externalDB +## +externalDB: + password: '' + user: '' + database: '' + host: '' + +## +## To use external solr enable solr, provide host and port +## +solr: + enabled: true + host: localhost + port: 8983 + +# To use ingress for routing set ingress.enabled value to true and istio.enabled value to false +ingress: + enabled: false + className: "" + annotations: + kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + # ingress.kubernetes.io/rewrite-target: / + hosts: + - host: "" + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: secret-tls + # hosts: + # - xwiki.local + +# To use istio for routing set istio.enabled value to true and ingress.enabled value to false +istio: + enabled: false + host: "*" + +persistence: + enabled: true + existingClaim: "" + storageClass: "" + accessModes: + - ReadWriteOnce + size: "500Mi" + annotations: {} + labels: {} + selector: {} + dataSource: {} + +## Read about PostDistribution budget at https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ +## Use only on a clustered setup +podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + +# Reference: https://kubernetes.io/docs/user-guide/node-selection/ +nodeSelector: {} + +# Reference: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +tolerations: [] + # - key: "key" + # operator: "Equal" + # value: "value" + # effect: "NoSchedule" + +# https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ +affinity: {} + # nodeAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # nodeSelectorTerms: + # - matchExpressions: + # - key: kubernetes.io/e2e-az-name + # operator: In + # values: + # - e2e-az1 + # - e2e-az2 + +# Custom configuration files for xwiki +customConfigs: + # Properties key that exists, replace in line is done with value here defined. + # If key don't exists, this key and value will be appended in that specific file. + # This files are list of key: value that are translated as key=value in that file. + #xwiki.cfg: + # + #xwiki.properties: + # + +# Properties to be passed to Java process with -D parameters using JAVA_OPTS +properties: + # "key": "value" diff --git a/requirements.lock b/requirements.lock deleted file mode 100644 index 521b1cf..0000000 --- a/requirements.lock +++ /dev/null @@ -1,9 +0,0 @@ -dependencies: -- name: mysql - repository: https://kubernetes-charts.storage.googleapis.com - version: 1.2.0 -- name: postgresql - repository: https://kubernetes-charts.storage.googleapis.com - version: 5.3.7 -digest: sha256:0aa18b894724a89354e54e4ded80805f4dea1f6a3de4ff37012060e736f5abbc -generated: "2019-06-13T02:35:04.436894581+05:30" diff --git a/requirements.yaml b/requirements.yaml deleted file mode 100644 index 652fbba..0000000 --- a/requirements.yaml +++ /dev/null @@ -1,9 +0,0 @@ -dependencies: - - name: mysql - repository: https://kubernetes-charts.storage.googleapis.com - version: 1.4.0 - condition: mysql.enabled - - name: postgresql - repository: https://kubernetes-charts.storage.googleapis.com - version: 7.6.0 - condition: postgresql.enabled diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl deleted file mode 100755 index f0d83d2..0000000 --- a/templates/_helpers.tpl +++ /dev/null @@ -1,16 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}} -{{- define "fullname" -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/templates/deployment.yaml b/templates/deployment.yaml deleted file mode 100644 index 0883dec..0000000 --- a/templates/deployment.yaml +++ /dev/null @@ -1,102 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "fullname" . }} - labels: - {{- if .Values.mysql.enabled }} - app: "{{ .Values.image.name }}-{{ .Chart.AppVersion }}-lts-mysql-tomcat" - {{- else if .Values.postgresql.enabled }} - app: "{{ .Values.image.name }}-{{ .Chart.AppVersion }}-lts-postgres-tomcat" - {{- else }} - app: {{ .Values.image.name }}-{{ .Chart.AppVersion }}-{{ .Values.image.tag }} - {{- end }} - version: "{{ .Chart.AppVersion }}" - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app: {{ template "fullname" . }} # has to match .spec.template.metadata.labels - template: - metadata: - labels: - app: {{ template "fullname" . }} - spec: - containers: - - name: {{ .Chart.Name }} - {{- if .Values.mysql.enabled }} - image: "{{ .Values.image.name }}:lts-mysql-tomcat" - {{- else if .Values.postgresql.enabled }} - image: "{{ .Values.image.name }}:lts-postgres-tomcat" - {{- else }} - image: {{ .Values.image.name }}:{{ .Values.image.tag }} - {{- end }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - containerPort: {{ .Values.service.internalPort }} - env: - - name: JAVA_OPTS - value: "-Xmx2048m" - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - {{- if .Values.mysql.enabled }} - name: "{{ .Release.Name }}-mysql" - key: mysql-password - {{- else if .Values.postgresql.enabled }} - name: "{{ .Release.Name }}-postgresql" - key: postgresql-password - {{- else }} - name: {{ .Release.Name | quote }} - key: DB_PASSWORD - {{- end }} - {{- if .Values.solr.enabled }} - - name: INDEX_HOST - valueFrom: - configMapKeyRef: - name: {{ template "fullname" . }} - key: INDEX_HOST - - name: INDEX_PORT - valueFrom: - configMapKeyRef: - name: {{ template "fullname" . }} - key: INDEX_PORT - {{- end }} - - name: DB_HOST - valueFrom: - configMapKeyRef: - name: {{ template "fullname" . }} - key: DB_HOST - - name: DB_USER - valueFrom: - configMapKeyRef: - name: {{ template "fullname" . }} - key: DB_USER - - name: DB_DATABASE - valueFrom: - configMapKeyRef: - name: {{ template "fullname" . }} - key: DB_DATABASE - resources: -{{ toYaml .Values.resources | indent 12 }} - volumeMounts: - - name: xwiki-data - mountPath: /opt/solr/server/solr - volumes: - - name: xwiki-data - persistentVolumeClaim: - claimName: xwiki ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: xwiki -spec: - accessModes: - - ReadWriteMany - resources: - requests: - storage: {{ .Values.storage }} - {{- if .Values.storageClass }} - storageClassName: {{ .Values.storageClass | quote }} - {{- end }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml deleted file mode 100755 index fd37a29..0000000 --- a/templates/ingress.yaml +++ /dev/null @@ -1,20 +0,0 @@ -{{- if .Values.ingress.enabled -}} -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: {{ template "fullname" . }} - annotations: - {{- if .Values.ingress.annotations }} - {{ toYaml .Values.ingress.annotations | indent 0 }} - {{- end }} - labels: - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" -spec: - rules: - - http: - paths: - - path: / - backend: - serviceName: {{ template "fullname" . }} - servicePort: {{ .Values.service.externalPort }} -{{- end -}} \ No newline at end of file diff --git a/templates/secrets.yaml b/templates/secrets.yaml deleted file mode 100644 index 070e2b5..0000000 --- a/templates/secrets.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "fullname" . }} - labels: - app: {{ template "fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" - release: {{ .Release.Name | quote }} - heritage: {{ .Release.Service | quote }} -type: Opaque -data: -{{- if .Values.mysql.enabled }} - DB_PASSWORD: {{ .Values.mysql.mysqlPassword | b64enc | quote }} -{{- else if .Values.postgresql.enabled }} - DB_PASSWORD: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }} -{{- else }} - DB_PASSWORD: {{ .Values.externalDB.password | b64enc | quote }} -{{- end }} \ No newline at end of file diff --git a/tests/__snapshot__/configmaps_test.yaml.snap b/tests/__snapshot__/configmaps_test.yaml.snap deleted file mode 100644 index 6b49852..0000000 --- a/tests/__snapshot__/configmaps_test.yaml.snap +++ /dev/null @@ -1,3 +0,0 @@ -should set values properly: - 1: | - null diff --git a/tests/__snapshot__/gateway_test.yaml.snap b/tests/__snapshot__/gateway_test.yaml.snap deleted file mode 100644 index 47264fa..0000000 --- a/tests/__snapshot__/gateway_test.yaml.snap +++ /dev/null @@ -1,26 +0,0 @@ -should properly set value of VirtualService: - 1: | - gateways: - - xwiki-gateway - hosts: - - '*' - http: - - match: - - uri: - prefix: / - route: - - destination: - host: RELEASE-NAME-xwiki - port: - number: 80 -should set values properly of Gateway: - 1: | - selector: - istio: ingressgateway - servers: - - hosts: - - '*' - port: - name: http - number: 80 - protocol: HTTP diff --git a/tests/__snapshot__/ingress_test.yaml.snap b/tests/__snapshot__/ingress_test.yaml.snap deleted file mode 100644 index 5a7073e..0000000 --- a/tests/__snapshot__/ingress_test.yaml.snap +++ /dev/null @@ -1,11 +0,0 @@ -should set values properly: - 1: | - kubernetes.io/ingress.class: nginx - 2: | - rules: - - http: - paths: - - backend: - serviceName: release-xwiki - servicePort: 80 - path: / diff --git a/tests/__snapshot__/poddisruptionbudget_test.yaml.snap b/tests/__snapshot__/poddisruptionbudget_test.yaml.snap deleted file mode 100644 index 2721539..0000000 --- a/tests/__snapshot__/poddisruptionbudget_test.yaml.snap +++ /dev/null @@ -1,14 +0,0 @@ -should set values properly: - 1: | - labels: - app: release-xwiki - chart: xwiki-1.0-SNAPSHOT - heritage: Tiller - release: release - name: release-xwiki - 2: | - maxUnavailable: 2 - minAvailable: 1 - selector: - matchLabels: - app: release-xwiki diff --git a/tests/__snapshot__/service_test.yaml.snap b/tests/__snapshot__/service_test.yaml.snap deleted file mode 100644 index 67f82ed..0000000 --- a/tests/__snapshot__/service_test.yaml.snap +++ /dev/null @@ -1,11 +0,0 @@ -should set values properly: - 1: | - ports: - - name: tcp - port: 80 - protocol: TCP - targetPort: 8080 - selector: - app: release-xwiki - sessionAffinity: ClientIP - type: ClusterIP diff --git a/tests/deployment_test.yaml b/tests/deployment_test.yaml deleted file mode 100644 index 82a6750..0000000 --- a/tests/deployment_test.yaml +++ /dev/null @@ -1,103 +0,0 @@ -suite: test deployment -templates: - - deployment.yaml -tests: - - it: should use custom image - set: - image.tag: latest - mysql.enabled: false - postgresql.enabled: false - image.name: default - asserts: - - isKind: - of: Deployment - - equal: - path: spec.template.spec.containers[0].image - value: default:latest - - matchSnapshot: - path: spec.template.spec.containers[0].env - - matchRegex: - path: metadata.labels.app - pattern: default-* - - matchRegex: - path: metadata.labels.app - pattern: -latest - - it: should use mysql lts image - set: - image.tag: latest - mysql.enabled: true - postgresql.enabled: false - asserts: - - isKind: - of: Deployment - - equal: - path: spec.template.spec.containers[0].image - value: xwiki:lts-mysql-tomcat - - matchSnapshot: - path: spec.template.spec.containers[0].env - - matchRegex: - path: metadata.labels.app - pattern: xwiki-* - - matchRegex: - path: metadata.labels.app - pattern: -lts-mysql-tomcat - - it: should use postgres lts image - set: - image.tag: latest - mysql.enabled: false - postgresql.enabled: true - asserts: - - isKind: - of: Deployment - - equal: - path: spec.template.spec.containers[0].image - value: xwiki:lts-postgres-tomcat - - matchSnapshot: - path: spec.template.spec.containers[0].env - - matchRegex: - path: metadata.labels.app - pattern: xwiki-* - - matchRegex: - path: metadata.labels.app - pattern: -lts-postgres-tomcat - - it: should properly set value - set: - image.pullPolicy: IfNotPresent - service.internalPort: 8080 - asserts: - - equal: - path: metadata.name - value: RELEASE-NAME-xwiki - - equal: - path: spec.template.spec.containers[0].imagePullPolicy - value: IfNotPresent - - equal: - path: spec.template.spec.containers[0].ports[0].containerPort - value: 8080 - - equal: - path: spec.template.spec.containers[0].volumeMounts[0].name - value: xwiki-data - - equal: - path: spec.template.spec.volumes[0].name - value: xwiki-data - - equal: - path: spec.template.spec.volumes[0].persistentVolumeClaim.claimName - value: xwiki - - matchSnapshot: - path: spec.template.spec.containers[0].volumeMounts - - matchSnapshot: - path: spec.template.spec.volumes - - it: should properly set value pvc - asserts: - - isKind: - of: PersistentVolumeClaim - documentIndex: 1 - - matchSnapshot: - path: spec - documentIndex: 1 - - equal: - path: metadata.name - value: xwiki - documentIndex: 1 - - \ No newline at end of file diff --git a/values.yaml b/values.yaml deleted file mode 100755 index 9936a43..0000000 --- a/values.yaml +++ /dev/null @@ -1,105 +0,0 @@ -# Default values for node. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. -replicaCount: 1 -image: - name: xwiki - pullPolicy: IfNotPresent -## Image Tag useful when externalDB is been used - tag: '' -service: - portName: node - name: http - type: LoadBalancer - externalPort: 80 - internalPort: 8080 -resources: - limits: - cpu: 3000m - memory: 6000Mi - requests: - cpu: 500m - memory: 3000Mi -## -## MySql chart configuration -## -## https://github.com/helm/charts/tree/master/stable/mysql -## -mysql: - ## Whether to deploy a mysql server. Set false for a different database. - enabled: true - mysqlRootPassword: xwiki - mysqlUser: xwiki - mysqlPassword: xwiki - mysqlDatabase: xwiki - imageTag: 5.7 - configurationFiles: - mysql.cnf: |- - [client] - default-character-set = utf8mb4 - - [mysqld] - character-set-server = utf8mb4 - collation-server = utf8mb4_bin - explicit_defaults_for_timestamp = 1 - - [mysql] - default-character-set = utf8mb4 -## -## MySql chart configuration -## -## https://github.com/helm/charts/tree/master/stable/postgresql -## -postgresql: - ## Whether to deploy a postgresql server. Set false for a different database. - enabled: false - postgresqlUsername: xwiki - postgresqlPassword: xwiki - postgresqlDatabase: xwiki - image: - tag: 11.3.0-debian-9-r38 - #persistence: - # size: 8Gi - -## -## For custom mysql and postgres database. Use externalDB. -## Would be used only if postgres and mysql is disabled. -## Set the image tag if want to use externalDB -## -externalDB: - password: '' - user: '' - database: '' - host: '' - -## -## To use external solr enable solr, provide host and port -## -solr: - enabled: true - host: localhost - port: 8983 - -# To use ingress for routing set ingress.enabled value to true and istio.enabled value to false -ingress: - enabled: true - issuer: dev-issuer - annotations: - kubernetes.io/ingress.class: nginx - # ingress.kubernetes.io/rewrite-target: / - -# To use istio for routing set istio.enabled value to true and ingress.enabled value to false -istio: - enabled: false - host: "*" -storage: "500Mi" -storageClassName: "" -buildID: "123" - - -## Read about PostDistribution budget at https://kubernetes.io/docs/concepts/workloads/pods/disruptions/ -## Use only on a clustered setup -podDisruptionBudget: - enabled: false - minAvailable: 1 - # maxUnavailable: 1