diff --git a/.github/ct-install.yaml b/.github/ct-install.yaml index 958e173..a9ee3ba 100644 --- a/.github/ct-install.yaml +++ b/.github/ct-install.yaml @@ -3,4 +3,4 @@ chart-dirs: chart-repos: - bitnami=https://charts.bitnami.com/bitnami check-version-increment: true -debug: true +debug: false diff --git a/.github/workflows/charts.yaml b/.github/workflows/charts.yaml index f1b3a8b..e8fabb7 100644 --- a/.github/workflows/charts.yaml +++ b/.github/workflows/charts.yaml @@ -13,9 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch --prune --unshallow + with: + fetch-depth: 0 - name: Set up Helm uses: azure/setup-helm@v1 @@ -41,6 +40,7 @@ jobs: - name: Run chart-testing (lint) run: ct lint --config .github/ct-lint.yaml + kubeval-chart: runs-on: ubuntu-latest needs: @@ -49,9 +49,9 @@ jobs: matrix: chart: ${{ fromJson(needs.lint-chart.outputs.matrix) }} k8s: - - v1.17.11 - - v1.18.8 - - v1.19.4 + - v1.19.11 + - v1.20.7 + - v1.21.2 steps: - name: Checkout uses: actions/checkout@v1 @@ -79,20 +79,26 @@ jobs: strategy: matrix: k8s: - - v1.17.11 - - v1.18.8 - - v1.19.4 + - v1.19.11 + - v1.20.7 + - v1.21.2 steps: - name: Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Create kind ${{ matrix.k8s }} cluster - uses: helm/kind-action@v1.1.0 + uses: helm/kind-action@v1.2.0 with: node_image: kindest/node:${{ matrix.k8s }} - - name: Run chart-testing (install) - uses: helm/chart-testing-action@v2.0.1 + - uses: actions/setup-python@v2 with: - command: install - config: .github/ct-install.yaml + python-version: 3.7 + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.0.1 + + - name: Run chart-testing (install) + run: ct install --config .github/ct-install.yaml diff --git a/charts/invoiceninja/Chart.lock b/charts/invoiceninja/Chart.lock index 8acd306..798d3e9 100644 --- a/charts/invoiceninja/Chart.lock +++ b/charts/invoiceninja/Chart.lock @@ -1,15 +1,15 @@ dependencies: - name: common repository: https://charts.bitnami.com/bitnami - version: 1.4.3 + version: 1.7.0 - name: nginx repository: https://charts.bitnami.com/bitnami - version: 8.8.5 + version: 9.3.5 - name: mariadb repository: https://charts.bitnami.com/bitnami - version: 9.3.11 + version: 9.3.16 - name: redis repository: https://charts.bitnami.com/bitnami - version: 12.9.2 -digest: sha256:4255a558312b033e820635f491b0960bd4ec8e716164025212af06adafbd4cb9 -generated: "2021-05-11T09:31:45.433+08:00" + version: 12.10.1 +digest: sha256:d5605fef85b764ec25c0a486df1228f0d7946a3e029d361514d3582b779cbce6 +generated: "2021-07-07T02:14:37.758095+08:00" diff --git a/charts/invoiceninja/Chart.yaml b/charts/invoiceninja/Chart.yaml index de580c8..ae3d2dd 100644 --- a/charts/invoiceninja/Chart.yaml +++ b/charts/invoiceninja/Chart.yaml @@ -13,11 +13,11 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.5.1 +version: 0.6.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 5.1.64 +appVersion: 5.2.10 keywords: - invoiceninja home: https://invoiceninja.github.io/dockerfiles @@ -32,7 +32,7 @@ dependencies: version: 1.x.x - name: nginx repository: https://charts.bitnami.com/bitnami - version: 8.8.x + version: 9.x.x - condition: mariadb.enabled name: mariadb repository: https://charts.bitnami.com/bitnami @@ -40,7 +40,7 @@ dependencies: - condition: redis.enabled name: redis repository: https://charts.bitnami.com/bitnami - version: 12.9.x + version: 12.x.x maintainers: - email: lwj5@hotmail.com name: lwj5 diff --git a/charts/invoiceninja/README.md b/charts/invoiceninja/README.md index 60c8ff3..258f3bd 100644 --- a/charts/invoiceninja/README.md +++ b/charts/invoiceninja/README.md @@ -13,7 +13,7 @@ Please read [Upgrading](#upgrading) section before upgrading MAJOR versions. - The Bitnami [mariadb](https://github.com/bitnami/charts/tree/master/bitnami/mariadb) helm chart - The Bitnami [nginx](https://github.com/bitnami/charts/tree/master/bitnami/nginx) helm chart - The Bitnami [redis](https://github.com/bitnami/charts/tree/master/bitnami/redis) helm chart -- Tested on Kubernetes 1.17+ +- Tested on Kubernetes 1.19+ ## Installing the Chart @@ -21,7 +21,7 @@ To install the chart with the release name `invoiceninja`: ```bash helm repo add invoiceninja https://invoiceninja.github.io/dockerfiles -helm install invoiceninja invoiceninja/invoiceninja +helm install invoiceninja invoiceninja/invoiceninja --set appKey=changeit --set mariadb.auth.rootPassword=changeit --set mariadb.auth.password=changeit --set redis.password=changeit ``` The command deploys Invoice Ninja on the Kubernetes cluster in the default namespace. The [Parameters](#parameters) section lists the parameters that can be configured during installation. @@ -70,30 +70,30 @@ The following table shows the configuration options for the Invoice Ninja helm c ### Invoice Ninja parameters -| Parameter | Description | Default | -| -------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- | -| `image.registry` | Invoice Ninja image registry | `docker.io` | -| `image.repository` | Invoice Ninja image name | `invoiceninja/invoiceninja` | -| `image.tag` | Invoice Ninja image tag | Check `values.yaml` file | -| `image.pullPolicy` | Invoice Ninja image pull policy | `IfNotPresent` | -| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | -| `image.debug` | Specify if debug logs should be enabled | `false` | -| `serviceAccountName` | Name of a service account for the Invoice Ninja pods | `default` | -| `debug` | Turn on debug mode on Invoice Ninja | `false` | -| `appKey` | Laravel Application Key | _random 32 character alphanumeric string_ | -| `userEmail` | Initial user email address | `admin@example.com` | -| `userPassword` | Initial user password | `changeme!` | -| `logChannel` | Name of log channel to use | `nil` | -| `broadcastDriver` | Name of broadcast driver to use | `nil` | -| `cacheDriver` | Name of cache driver to use | `nil` | -| `sessionDriver` | Name of session driver to use | `nil` | -| `queueConnection` | Name of queue connection to use | `nil` | -| `snappdf` | Use snappdf instead of Phantom JS PDF generation | `true` | -| `mailer` | Name of the mailer to use (log, smtp, etc.) | `log` | -| `requireHttps` | Force HTTPS for internal connections to Invoice Ninja (see #349) | `false` | -| `extraEnvVars` | Extra environment variables to be set on Invoice Ninja container | `{}` | -| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` | -| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `nil` | +| Parameter | Description | Default | +| -------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------- | +| `image.registry` | Invoice Ninja image registry | `docker.io` | +| `image.repository` | Invoice Ninja image name | `invoiceninja/invoiceninja` | +| `image.tag` | Invoice Ninja image tag | Check `values.yaml` file | +| `image.pullPolicy` | Invoice Ninja image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `image.debug` | Specify if debug logs should be enabled | `false` | +| `serviceAccountName` | Name of a service account for the Invoice Ninja pods | `default` | +| `debug` | Turn on debug mode on Invoice Ninja | `false` | +| `appKey` | Laravel Application Key | _random 32 character alphanumeric string_ | +| `userEmail` | Initial user email address | `admin@example.com` | +| `userPassword` | Initial user password | `changeme!` | +| `logChannel` | Name of log channel to use | `nil` | +| `broadcastDriver` | Name of broadcast driver to use | `nil` | +| `cacheDriver` | Name of cache driver to use | `nil` | +| `sessionDriver` | Name of session driver to use | `nil` | +| `queueConnection` | Name of queue connection to use | `nil` | +| `snappdf` | Use snappdf instead of Phantom JS PDF generation | `true` | +| `mailer` | Name of the mailer to use (log, smtp, etc.) | `log` | +| `requireHttps` | Force HTTPS for internal connections to Invoice Ninja (see #349) | `false` | +| `extraEnvVars` | Extra environment variables to be set on Invoice Ninja container | `{}` | +| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `nil` | +| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `nil` | | `trustedProxy` | List of trusted proxies for Invoice Ninja to communicate with the nginx proxy | `'*'` | ### Invoice Ninja deployment parameters @@ -147,15 +147,13 @@ The following table shows the configuration options for the Invoice Ninja helm c ### Ingress parameters -| Parameter | Description | Default | -| ------------------------------------------------------- | ------------------------------------- | ------------------------ | -| `nginx.service.type` | Kubernetes Service type | `ClusterIP` | -| `nginx.ingress.enabled` | Enable ingress controller resource | `true` | -| `nginx.ingress.hostname` | Default host for the ingress resource | `invoiceninja.local` | -| `nginx.serverBlock` | Custom NGINX server block | `nil` | -| `nginx.extraVolumes` | Array to add extra volumes | Check `values.yaml` file | -| `nginx.extraVolumes[0].persistentVolumeClaim.claimName` | Name of Invoice Ninja public PVC | `invoiceninja-public` | -| `nginx.extraVolumeMounts` | Array to add extra mount | Check `values.yaml` file | +| Parameter | Description | Default | +| ------------------------------------ | ------------------------------------- | ------------------------------------------------------- | +| `nginx.service.type` | Kubernetes Service type | `ClusterIP` | +| `nginx.ingress.enabled` | Enable ingress controller resource | `true` | +| `nginx.ingress.hostname` | Default host for the ingress resource | `invoiceninja.local` | +| `nginx.existingServerBlockConfigmap` | Custom NGINX server block config map | `{{ include "invoiceninja.nginx.serverBlockName" . }}` | +| `nginx.staticSitePVC` | Name of Invoice Ninja public PVC | `{{ include "invoiceninja.public.storageName" . }}` | > See [Dependencies](#dependencies) for more. diff --git a/charts/invoiceninja/templates/_helpers.tpl b/charts/invoiceninja/templates/_helpers.tpl index 4322532..fa882b8 100644 --- a/charts/invoiceninja/templates/_helpers.tpl +++ b/charts/invoiceninja/templates/_helpers.tpl @@ -248,3 +248,11 @@ Return the Session Connection Name {{- printf "default" -}} {{- end -}} {{- end -}} + +{{/* +Server block configmap name for nignx. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "invoiceninja.nginx.serverBlockName" -}} +{{- printf "%s-%s" .Release.Name "server-block" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/charts/invoiceninja/templates/serverblock.yaml b/charts/invoiceninja/templates/serverblock.yaml new file mode 100644 index 0000000..89a4d81 --- /dev/null +++ b/charts/invoiceninja/templates/serverblock.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "invoiceninja.nginx.serverBlockName" . }} + labels: + {{- include "common.labels.standard" $ | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: + {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +data: + server-block.conf: |- + server { + listen 8080 default_server; + server_name _; + + root /app; + index index.php; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass {{ include "common.names.fullname" . }}:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /var/www/app/public$fastcgi_script_name; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + } + } diff --git a/charts/invoiceninja/values.yaml b/charts/invoiceninja/values.yaml index e49932a..7855292 100644 --- a/charts/invoiceninja/values.yaml +++ b/charts/invoiceninja/values.yaml @@ -18,7 +18,7 @@ image: registry: docker.io repository: invoiceninja/invoiceninja - tag: 5.1.64 + tag: 5.2.10 ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images ## @@ -469,43 +469,9 @@ nginx: ingress: enabled: true hostname: invoiceninja.local - ## Configure the serverblock for Invoice Ninja - ## Note: you may need to replace the fastcgi_pass value if the release name is different + ## Use the serverblock config map from Invoice Ninja ## - serverBlock: | - server { - listen 8080 default_server; - server_name _; - - root /var/www/app/public/; - index index.php; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass invoiceninja:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_intercept_errors off; - fastcgi_buffer_size 16k; - fastcgi_buffers 4 16k; - } - } - ## Configure the extraVolumes and extraVolumeMounts for Invoice Ninja - ## Note: you may need to replace the claimName if the release name is different + existingServerBlockConfigmap: '{{ include "invoiceninja.nginx.serverBlockName" . }}' + ## Use the public PVC created by Invoice Ninja ## - extraVolumes: - - name: public - persistentVolumeClaim: - claimName: invoiceninja-public - extraVolumeMounts: - - mountPath: /var/www/app/public - name: public - readOnly: true + staticSitePVC: '{{ include "invoiceninja.public.storageName" . }}'