diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml index b7c07295..9fb44c4b 100644 --- a/.github/workflows/charts-lint-test.yaml +++ b/.github/workflows/charts-lint-test.yaml @@ -167,7 +167,12 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check lint matrix status - if: ${{ needs.lint.result != 'success' }} + if: | + !contains(github.event.head_commit.message, '[ci-skip]') + && + needs.changes-lint.outputs.detected == 'true' + && + needs.lint.result != 'success' run: exit 1 unittest: @@ -255,5 +260,10 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Check install matrix status - if: ${{ needs.install.result != 'success' }} + if: | + !contains(github.event.head_commit.message, '[ci-skip]') + && + needs.changes-install.outputs.detected == 'true' + && + needs.install.result != 'success' run: exit 1 diff --git a/charts/stable/ser2sock/.helmignore b/charts/stable/ser2sock/.helmignore index e559de0a..4379e2b3 100644 --- a/charts/stable/ser2sock/.helmignore +++ b/charts/stable/ser2sock/.helmignore @@ -22,3 +22,5 @@ .vscode/ # OWNERS file for Kubernetes OWNERS +# helm-docs templates +*.gotmpl diff --git a/charts/stable/ser2sock/Chart.yaml b/charts/stable/ser2sock/Chart.yaml index 5afc771e..6c209f47 100644 --- a/charts/stable/ser2sock/Chart.yaml +++ b/charts/stable/ser2sock/Chart.yaml @@ -2,14 +2,19 @@ apiVersion: v2 appVersion: 1.0.0 description: Serial to Socket Redirector name: ser2sock -version: 2.0.3 +version: 3.0.0 +kubeVersion: ">=1.16.0-0" keywords: - - ser2sock +- ser2sock home: https://github.com/k8s-at-home/charts/tree/master/charts/stable/ser2sock icon: https://i.imgur.com/GfZ7McO.png sources: - - https://github.com/nutechsoftware/ser2sock - - https://github.com/tenstartups/ser2sock +- https://github.com/nutechsoftware/ser2sock +- https://github.com/tenstartups/ser2sock maintainers: - - name: billimek - email: jeff@billimek.com +- name: billimek + email: jeff@billimek.com +dependencies: +- name: common + repository: https://library-charts.k8s-at-home.com + version: 2.0.1 diff --git a/charts/stable/ser2sock/README.md b/charts/stable/ser2sock/README.md index 65eaf2e3..f494fb42 100644 --- a/charts/stable/ser2sock/README.md +++ b/charts/stable/ser2sock/README.md @@ -1,6 +1,6 @@ # ser2sock -![Version: 2.0.3](https://img.shields.io/badge/Version-2.0.3-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) +![Version: 3.0.0](https://img.shields.io/badge/Version-3.0.0-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) Serial to Socket Redirector @@ -13,10 +13,13 @@ Serial to Socket Redirector ## Requirements +Kubernetes: `>=1.16.0-0` + ## Dependencies | Repository | Name | Version | |------------|------|---------| +| https://library-charts.k8s-at-home.com | common | 2.0.1 | ## TL;DR @@ -65,9 +68,22 @@ helm install ser2sock k8s-at-home/ser2sock -f values.yaml ## Custom configuration -**IMPORTANT NOTE:** the USB device must be accessible on the node where this pod runs, in order for this chart to function properly. +**IMPORTANT NOTE:** a ser2sock controller device must be accessible on the node where this pod runs, in order for this chart to function properly. -A way to achieve this can be with nodeAffinity rules, for example: +First, you will need to mount your ser2sock device into the pod, you can do so by adding the following to your values: + +```yaml +additionalVolumeMounts: + - name: usb + mountPath: /path/to/device + +additionalVolumes: + - name: usb + hostPath: + path: /path/to/device +``` + +Second you will need to set a nodeAffinity rule, for example: ```yaml affinity: @@ -75,13 +91,13 @@ affinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - - key: usb + - key: app operator: In values: - - alarmdecoder + - ser2sock-controller ``` -... where a node with an attached Coral USB device is labeled with `usb: alarmdecoder` +... where a node with an attached ser2sock controller USB device is labeled with `app: ser2sock-controller` ## Values @@ -89,31 +105,17 @@ affinity: | Key | Type | Default | Description | |-----|------|---------|-------------| -| affinity | object | `{}` | Affinity settings for pod assignment of the GUI | -| baudRate | int | `115200` | Baudrate | -| device | string | `"/dev/ttyUSB0"` | USB Device to use | -| fullnameOverride | string | `""` | | -| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy | -| image.repository | string | `"tenstartups/ser2sock"` | Image repository | -| image.tag | string | `"latest"` | Image tag. Possible values listed [here](https://hub.docker.com/r/tenstartups/ser2sock/tags). | -| nameOverride | string | `""` | | -| nodeSelector | object | `{}` | Node labels for pod assignment of the GUI | -| pgid | string | `"1001"` | GID to run as | -| podAnnotations | object | `{}` | Pod annotations | -| puid | string | `"1001"` | UID to run as | -| resources | object | `{}` | CPU/Memory resource requests/limits or the GUI | -| service.annotations | object | `{}` | Service annotations for the GUI | -| service.clusterIP | string | `nil` | Cluster IP for the GUI | -| service.externalIPs | string | `nil` | External IPs for the GUI | -| service.externalTrafficPolicy | string | `nil` | Loadbalancer externalTrafficPolicy | -| service.loadBalancerIP | string | `nil` | Loadbalancer IP for the GUI | -| service.loadBalancerSourceRanges | string | `nil` | Loadbalancer client IP restriction range for the GUI | -| service.nodePort | string | `nil` | nodePort to listen on for the GUI | -| service.port | int | `10000` | Kubernetes port where the GUI is exposed | -| service.type | string | `"ClusterIP"` | Kubernetes service type for the GUI | -| strategyType | string | `"Recreate"` | Specifies the strategy used to replace old Pods by new ones | -| timezone | string | `nil` | Timezone the ser2sock instance should run as, e.g. 'America/New_York' | -| tolerations | list | `[]` | Toleration labels for pod assignment of the GUI | +| additionalVolumeMounts | list | `[]` | | +| additionalVolumes | list | `[]` | | +| env.BAUD_RATE | int | `115200` | | +| env.LISTENER_PORT | int | `10000` | | +| env.SERIAL_DEVICE | string | `"/dev/ttyUSB0"` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"tenstartups/ser2sock"` | | +| image.tag | string | `"latest"` | | +| ingress.enabled | bool | `false` | | +| service.port.port | int | `10000` | | +| strategy.type | string | `"Recreate"` | | ## Changelog @@ -121,7 +123,21 @@ All notable changes to this application Helm chart will be documented in this fi 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.0.2] +### [3.0.0] + +#### Added + +- N/A + +#### Changed + +- **BREAKING** Migrate ser2sock to the common library, Helm configuration values have changed. + +#### Removed + +- N/A + +### [1.0.0] #### Added @@ -135,7 +151,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - N/A -[2.0.2]: #2.0.2 +[3.0.0]: #3.0.0 +[1.0.0]: #1.0.0 ## Support diff --git a/charts/stable/ser2sock/README_CHANGELOG.md.gotmpl b/charts/stable/ser2sock/README_CHANGELOG.md.gotmpl index 51c2b7f0..29f12c5d 100644 --- a/charts/stable/ser2sock/README_CHANGELOG.md.gotmpl +++ b/charts/stable/ser2sock/README_CHANGELOG.md.gotmpl @@ -9,7 +9,21 @@ All notable changes to this application Helm chart will be documented in this fi 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.0.2] +### [3.0.0] + +#### Added + +- N/A + +#### Changed + +- **BREAKING** Migrate ser2sock to the common library, Helm configuration values have changed. + +#### Removed + +- N/A + +### [1.0.0] #### Added @@ -23,5 +37,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - N/A -[2.0.2]: #2.0.2 +[3.0.0]: #3.0.0 +[1.0.0]: #1.0.0 {{- end -}} diff --git a/charts/stable/ser2sock/README_CONFIG.md.gotmpl b/charts/stable/ser2sock/README_CONFIG.md.gotmpl index d7b19e64..662114c3 100644 --- a/charts/stable/ser2sock/README_CONFIG.md.gotmpl +++ b/charts/stable/ser2sock/README_CONFIG.md.gotmpl @@ -5,9 +5,22 @@ {{- define "custom.custom.configuration" -}} {{ template "custom.custom.configuration.header" . }} -**IMPORTANT NOTE:** the USB device must be accessible on the node where this pod runs, in order for this chart to function properly. +**IMPORTANT NOTE:** a ser2sock controller device must be accessible on the node where this pod runs, in order for this chart to function properly. -A way to achieve this can be with nodeAffinity rules, for example: +First, you will need to mount your ser2sock device into the pod, you can do so by adding the following to your values: + +```yaml +additionalVolumeMounts: + - name: usb + mountPath: /path/to/device + +additionalVolumes: + - name: usb + hostPath: + path: /path/to/device +``` + +Second you will need to set a nodeAffinity rule, for example: ```yaml affinity: @@ -15,11 +28,11 @@ affinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - - key: usb + - key: app operator: In values: - - alarmdecoder + - ser2sock-controller ``` -... where a node with an attached Coral USB device is labeled with `usb: alarmdecoder` +... where a node with an attached ser2sock controller USB device is labeled with `app: ser2sock-controller` {{- end -}} diff --git a/charts/stable/ser2sock/templates/NOTES.txt b/charts/stable/ser2sock/templates/NOTES.txt index 67377874..90f7b653 100644 --- a/charts/stable/ser2sock/templates/NOTES.txt +++ b/charts/stable/ser2sock/templates/NOTES.txt @@ -1,15 +1 @@ -1. Get the application URL by running these commands: -{{- if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "ser2sock.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - 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 {{ include "ser2sock.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ser2sock.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "ser2sock.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:5000 to use your application" - kubectl port-forward $POD_NAME 5000:5000 -{{- end }} +{{- include "common.notes.defaultNotes" . -}} diff --git a/charts/stable/ser2sock/templates/_helpers.tpl b/charts/stable/ser2sock/templates/_helpers.tpl deleted file mode 100644 index 0d9c12a6..00000000 --- a/charts/stable/ser2sock/templates/_helpers.tpl +++ /dev/null @@ -1,45 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "ser2sock.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). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "ser2sock.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "ser2sock.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "ser2sock.labels" -}} -app.kubernetes.io/name: {{ include "ser2sock.name" . }} -helm.sh/chart: {{ include "ser2sock.chart" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} diff --git a/charts/stable/ser2sock/templates/common.yaml b/charts/stable/ser2sock/templates/common.yaml new file mode 100644 index 00000000..a6613c2c --- /dev/null +++ b/charts/stable/ser2sock/templates/common.yaml @@ -0,0 +1 @@ +{{ include "common.all" . }} diff --git a/charts/stable/ser2sock/templates/deployment.yaml b/charts/stable/ser2sock/templates/deployment.yaml deleted file mode 100644 index 752e952d..00000000 --- a/charts/stable/ser2sock/templates/deployment.yaml +++ /dev/null @@ -1,73 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "ser2sock.fullname" . }} - labels: -{{ include "ser2sock.labels" . | indent 4 }} -spec: - replicas: 1 - revisionHistoryLimit: 3 - strategy: - type: {{ .Values.strategyType }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "ser2sock.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "ser2sock.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - {{- if .Values.podAnnotations }} - annotations: - {{- range $key, $value := .Values.podAnnotations }} - {{ $key }}: {{ $value | quote }} - {{- end }} - {{- end }} - spec: - containers: - - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - securityContext: - privileged: true - ports: - - name: http - containerPort: 10000 - protocol: TCP - env: - {{- if .Values.timezone }} - - name: TZ - value: "{{ .Values.timezone }}" - {{- end }} - - name: LISTENER_PORT - value: "10000" - - name: BAUD_RATE - value: "{{ .Values.baudRate }}" - - name: SERIAL_DEVICE - value: "/dev/ttyUSB0" - - name: PUID - value: "{{ .Values.puid }}" - - name: PGID - value: "{{ .Values.pgid }}" - volumeMounts: - - mountPath: /dev/ttyUSB0 - name: usb - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumes: - - name: usb - hostPath: - path: {{ .Values.device }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/charts/stable/ser2sock/templates/service.yaml b/charts/stable/ser2sock/templates/service.yaml deleted file mode 100644 index dad9e63e..00000000 --- a/charts/stable/ser2sock/templates/service.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "ser2sock.fullname" . }} - labels: -{{ include "ser2sock.labels" . | indent 4 }} -{{- if .Values.service.labels }} -{{ toYaml .Values.service.labels | indent 4 }} -{{- end }} -{{- with .Values.service.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} -spec: -{{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }} - type: ClusterIP - {{- if .Values.service.clusterIP }} - clusterIP: {{ .Values.service.clusterIP }} - {{end}} -{{- else if eq .Values.service.type "LoadBalancer" }} - type: {{ .Values.service.type }} - {{- if .Values.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} - {{- end }} - {{- if .Values.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: -{{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }} - {{- end -}} -{{- else }} - type: {{ .Values.service.type }} -{{- end }} -{{- if .Values.service.externalIPs }} - externalIPs: -{{ toYaml .Values.service.externalIPs | indent 4 }} -{{- end }} - {{- if .Values.service.externalTrafficPolicy }} - externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }} - {{- end }} - ports: - - name: http - port: {{ .Values.service.port }} - protocol: TCP - targetPort: http -{{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }} - nodePort: {{.Values.service.nodePort}} -{{ end }} - selector: - app.kubernetes.io/name: {{ include "ser2sock.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} \ No newline at end of file diff --git a/charts/stable/ser2sock/values.yaml b/charts/stable/ser2sock/values.yaml index 95e3bdba..eafe99d2 100644 --- a/charts/stable/ser2sock/values.yaml +++ b/charts/stable/ser2sock/values.yaml @@ -1,73 +1,55 @@ -# Default values for ser2sock. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -# -- Specifies the strategy used to replace old Pods by new ones -strategyType: Recreate +# +# IMPORTANT NOTE +# +# This chart inherits from our common library chart. You can check the default values/options here: +# https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml +# image: - # -- Image repository repository: tenstartups/ser2sock - # -- Image tag. Possible values listed [here](https://hub.docker.com/r/tenstartups/ser2sock/tags). - tag: latest - # -- Image pull policy pullPolicy: IfNotPresent + tag: latest -nameOverride: "" -fullnameOverride: "" +strategy: + type: Recreate + +env: + # TZ: + # PUID: + # PGID: + LISTENER_PORT: 10000 + BAUD_RATE: 115200 + SERIAL_DEVICE: "/dev/ttyUSB0" -# -- (string) Timezone the ser2sock instance should run as, e.g. 'America/New_York' -timezone: -# -- USB Device to use -device: "/dev/ttyUSB0" -# -- UID to run as -puid: "1001" -# -- GID to run as -pgid: "1001" -# -- Baudrate -baudRate: 115200 service: - # -- Kubernetes service type for the GUI - type: ClusterIP - # -- Kubernetes port where the GUI is exposed - port: 10000 - # -- Service annotations for the GUI - annotations: {} - # -- (string) Cluster IP for the GUI - clusterIP: - # -- (string) External IPs for the GUI - externalIPs: - # -- (string) Loadbalancer IP for the GUI - loadBalancerIP: - # -- (string) Loadbalancer client IP restriction range for the GUI - loadBalancerSourceRanges: - # -- (string) Loadbalancer externalTrafficPolicy - externalTrafficPolicy: - # -- (string) nodePort to listen on for the GUI - nodePort: + port: + port: 10000 -# -- CPU/Memory resource requests/limits or the GUI -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi +ingress: + enabled: false -# -- Node labels for pod assignment of the GUI -nodeSelector: {} +# Privileged may be required if USB controller is accessed directly through the host machine +# securityContext: +# privileged: true -# -- Toleration labels for pod assignment of the GUI -tolerations: [] +# Path to your ser2sock device in the container +additionalVolumeMounts: [] +# - name: usb +# mountPath: /dev/ttyUSB0 -# -- Affinity settings for pod assignment of the GUI -affinity: {} +# Path to your ser2sock device on the host +additionalVolumes: [] +# - name: usb +# hostPath: +# path: /dev/ttyUSB0 -# -- Pod annotations -podAnnotations: {} +# affinity: +# nodeAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# nodeSelectorTerms: +# - matchExpressions: +# - key: app +# operator: In +# values: +# - ser2sock-controller