Compare commits

...

3 Commits

Author SHA1 Message Date
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs
61028541f1 [common] v2.2.1 (#480)
* [common] v2.2.1
2021-01-08 15:21:03 +01:00
auricom
28118894f7 add recipes (#479) 2021-01-08 08:59:56 -05:00
Michael Goldstein
27b095e12d [Mosquitto] Update Mosquitto to support configurable ports (#475)
Co-authored-by: Michael Goldstein <michael.goldstein@digitalreasoning.com>
2021-01-08 08:26:32 -05:00
17 changed files with 300 additions and 10 deletions

View File

@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.2.1]
### Fixed
- Made explicit that `service.port.targetPort` cannot be a named port.
## [2.2.0]
### Added
@@ -53,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is the last version before starting this changelog. All sorts of cool stuff was changed, but only `git log` remembers what that was :slightly_frowning_face:
[2.2.1]: https://github.com/k8s-at-home/charts/tree/common-2.2.1/charts/common
[2.2.0]: https://github.com/k8s-at-home/charts/tree/common-2.2.0/charts/common
[2.1.0]: https://github.com/k8s-at-home/charts/tree/common-2.1.0/charts/common

View File

@@ -2,7 +2,7 @@ apiVersion: v2
name: common
description: Function library for k8s-at-home charts
type: library
version: 2.2.0
version: 2.2.1
keywords:
- k8s-at-home
- common

View File

@@ -32,6 +32,9 @@ Ports included by the controller.
ports:
{{- range $_ := $ports }}
- name: {{ .name }}
{{- if and .targetPort (kindIs "string" .targetPort) }}
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}
{{- end }}
containerPort: {{ .targetPort | default .port }}
protocol: {{ .protocol | default "TCP" }}
{{- end -}}

View File

@@ -107,8 +107,9 @@ service:
## name defaults to http
name:
protocol: TCP
## targetPort defaults to the service name. If targetPort is specified, this port number
## is used in the container definition instead of service.port.port.
## Specify a service targetPort if you wish to differ the service port from the application port.
## If targetPort is specified, this port number is used in the container definition instead of
## service.port.port. Therefore named ports are not supported for this field.
targetPort:
## Specify the nodePort value for the LoadBalancer and NodePort service types.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport

View File

@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "1.6.12"
description: Eclipse Mosquitto - An open source MQTT broker
name: mosquitto
version: 0.5.0
version: 0.6.0
keywords:
- message queue
- MQTT

View File

@@ -1,6 +1,6 @@
** Please be patient while the chart is being deployed **
Mosquitto can be accessed within the cluster on port 1883 at {{ template "mosquitto.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
Mosquitto can be accessed within the cluster on port {{ .Values.service.port }} at {{ template "mosquitto.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
To access for outside the cluster, perform the following steps:
@@ -26,13 +26,13 @@ NOTE: It may take a few minutes for the LoadBalancer IP to be available.
To Access the Moquitto port:
echo "URL : mqtt://$SERVICE_IP:1883/"
echo "URL : mqtt://$SERVICE_IP:{{ .Values.service.port }}/"
{{- else if contains "ClusterIP" .Values.service.type }}
To Access the Mosquitto MQTT port:
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "mosquitto.fullname" . }} 1883:1883
echo "URL : mqtt://127.0.0.1:1883/"
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "mosquitto.fullname" . }} {{ .Values.service.port }}:{{ .Values.service.port }}
echo "URL : mqtt://127.0.0.1:{{ .Values.service.port }}/"
{{- end }}

View File

@@ -17,11 +17,11 @@ spec:
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
ports:
- port: 1883
- port: {{ .Values.service.port }}
targetPort: default
protocol: TCP
name: default
- port: 9001
- port: {{ .Values.service.websocketPort }}
targetPort: websocket
protocol: TCP
name: websocket

View File

@@ -34,6 +34,8 @@ securityContext: {}
service:
annotations: {}
type: ClusterIP
port: 1883
websocketPort: 9001
# externalTrafficPolicy:
# loadBalancerIP:

View File

@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

19
charts/recipes/Chart.yaml Normal file
View File

@@ -0,0 +1,19 @@
apiVersion: v2
appVersion: 0.13.0
description: Recipes is a Django application to manage, tag and search recipes using either built in models or external storage providers hosting PDF's, Images or other files.
name: recipes
version: 2.2.1
keywords:
- recipes
- cooking
home: https://github.com/k8s-at-home/charts/tree/master/charts/recipes
sources:
- https://github.com/vabene1111/recipes
- https://hub.docker.com/r/vabene1111/recipes
maintainers:
- name: auricom
email: k8s-at-home@xpander.eml.cc
dependencies:
- name: common
repository: https://k8s-at-home.com/charts/
version: 2.2.0

4
charts/recipes/OWNERS Normal file
View File

@@ -0,0 +1,4 @@
approvers:
- auricom
reviewers:
- auricom

89
charts/recipes/README.md Normal file
View File

@@ -0,0 +1,89 @@
# Recipes
This is a helm chart for [Recipes](https://github.com/vabene1111/recipes).
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/k8s-at-home/charts/issues/new/choose)**
## TL;DR;
```shell
$ helm repo add k8s-at-home https://k8s-at-home.com/charts/
$ helm install k8s-at-home/recipes
```
## Installing the Chart
To install the chart with the release name `my-release`:
```console
helm install --name my-release k8s-at-home/recipes
```
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```console
helm delete my-release --purge
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following table lists the configurable parameters of the recipes chart and their default values that have to be overriden.
| Parameter | Description | Default |
| -------------------------------------| ------------------------------------------------------------------------------------------- | ------------------------------------------- |
| `env.DEBUG` | Only set this to true when testing/debugging | `0` |
| `env.ALLOWED_HOSTS` | Hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,... | `*` |
| `env.SECRET_KEY` | Random secret key, use for example `openssl rand -base64 24` to generate one | `changeme` |
| `env.TIMEZONE` | Your default timezone | `America/New_York` |
| `env.DB_ENGINE` | Database connector | `django.db.backends.postgresql_psycopg2` |
| `env.POSTGRES_HOST` | External PostreSQL hostname | |
| `env.POSTGRES_PORT` | External PostreSQL port | |
| `env.POSTGRES_USER` | External PostreSQL user | |
| `env.POSTGRES_DB` | External PostreSQL database name | |
| `env.POSTGRES_PASSWORD` | External PostreSQL database password | |
| `env.GUNICORN_MEDIA` | Serve mediafiles directly using gunicorn. Basically everyone recommends not doing this. | `0` |
| `env.FRACTION_PREF_DEFAULT` | Enable/disable fraction support | `0` |
| `env.COMMENT_PREF_DEFAULT` | Enable/disable commenting system | `1` |
| `env.SHOPPING_MIN_AUTOSYNC_INTERVAL` | Amount of time after which the shopping list is refreshed when they are in viewing mode | `5` |
You can add more environment variables, read through Recipes [.env.template](https://github.com/vabene1111/recipes/blob/master/.env.template)
Read through the charts [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/recipes/values.yaml)
file.
Additionally you can take a look at the common library [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/common/values.yaml) for more (advanced) configuration options.
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```console
helm install recipes \
--set env.POSTGRES_HOST="postgresql.domain" \
k8s-at-home/recipes
```
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the
chart. For example,
```console
helm install recipes k8s-at-home/recipes --values values.yaml
```
```yaml
image:
tag: ...
```
---
**NOTE**
If you get
```console
Error: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: ...`
```
it may be because you uninstalled the chart with `skipuninstall` enabled, you need to manually delete the pvc or use `existingClaim`.
---
## Upgrading an existing Release to a new major version
A major chart version change (like 1.0.1 -> 2.0.0) indicates that there is an incompatible breaking change potentially needing manual actions.

View File

@@ -0,0 +1 @@
{{- include "common.notes.defaultNotes" . -}}

View File

@@ -0,0 +1 @@
{{ include "common.all" . }}

View File

@@ -0,0 +1,35 @@
{{/*
Recipes Configuration files.
*/}}
apiVersion: v1
kind: ConfigMap
metadata:
name: "recipes-config"
labels:
{{- include "common.labels" . | nindent 4 }}
data:
nginx-config: |-
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name _;
client_max_body_size 16M;
# serve media files
location /media/ {
alias /media/;
}
# serve static files
location /static/ {
alias /static/;
}
# pass requests for dynamic content to gunicorn
location / {
proxy_set_header Host $host;
proxy_pass http://localhost:8080;
}
}
}

View File

@@ -0,0 +1,89 @@
# Default values for Recipes.
image:
repository: vabene1111/recipes
pullPolicy: IfNotPresent
tag: 0.13.0
strategy:
type: Recreate
service:
port:
port: 80
env:
DEBUG: "0"
ALLOWED_HOSTS: "*"
SECRET_KEY: changeme
DB_ENGINE: django.db.backends.sqlite3
POSTGRES_HOST:
POSTGRES_PORT:
POSTGRES_USER:
POSTGRES_DB:
POSTGRES_PASSWORD:
GUNICORN_MEDIA: "0"
TIMEZONE: America/New_York
FRACTION_PREF_DEFAULT: "0"
COMMENT_PREF_DEFAULT: "1"
SHOPPING_MIN_AUTOSYNC_INTERVAL: "5"
persistence:
config:
enabled: false
media:
enabled: false
emptyDir: false
mountPath: /opt/recipes/mediafiles
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
# storageClass: "-"
# accessMode: ReadWriteOnce
# size: 1Gi
## Do not delete the pvc upon helm uninstall
# skipuninstall: false
# existingClaim: ""
static:
enabled: false
emptyDir: false
mountPath: /opt/recipes/staticfiles
## Persistent Volume Storage Class
## If defined, storageClassName: <storageClass>
## If set to "-", storageClassName: "", which disables dynamic provisioning
## If undefined (the default) or set to null, no storageClassName spec is
## set, choosing the default provisioner. (gp2 on AWS, standard on
## GKE, AWS & OpenStack)
# storageClass: "-"
# accessMode: ReadWriteOnce
# size: 1Gi
## Do not delete the pvc upon helm uninstall
# skipuninstall: false
# existingClaim: ""
additionalContainers:
- name: nginx
image: nginx:1.19.6
ports:
- containerPort: 80
name: http
volumeMounts:
##
## If persistent volumes are enabled ; please uncomment the following lines
##
# - name: media
# mountPath: '/media'
# - name: static
# mountPath: '/static'
- name: recipes-config
mountPath: /etc/nginx/nginx.conf
subPath: nginx-config
readOnly: true
additionalVolumes:
- name: recipes-config
configMap:
name: recipes-config

View File

@@ -81,6 +81,21 @@ class Test < ChartTest
jq('.spec.template.spec.containers[0].ports[0].containerPort', resource('Deployment')).must_equal values[:service][:port][:targetPort]
jq('.spec.template.spec.containers[0].ports[0].name', resource('Deployment')).must_equal default_name
end
it 'targetPort cannot be a named port' do
values = {
service: {
port: {
targetPort: 'test'
}
}
}
chart.value values
exception = assert_raises HelmCompileError do
chart.execute_helm_template!
end
assert_match("Our charts do not support named ports for targetPort. (port name #{default_name}, targetPort #{values[:service][:port][:targetPort]})", exception.message)
end
end
end
end