Skip to content

Commit

Permalink
Upgrade rtorrent chart (#14)
Browse files Browse the repository at this point in the history
* Upgrade rtorrent chart

* Also bump plex version
  • Loading branch information
oguzkilcan authored Oct 29, 2021
1 parent 7eb98cd commit 59f7adc
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 27 deletions.
2 changes: 1 addition & 1 deletion charts/plex/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
type: application
name: plex
version: 1.2.0
version: 1.2.1
appVersion: 1.22.2.4282-a97b03fad
description: Streaming app for movies, TV, music, web shows and podcasts
home: https://plex.tv/
Expand Down
1 change: 0 additions & 1 deletion charts/plex/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ ingress:
# hosts:
# - chart-example.local


resources: {}
# limits:
# cpu: 100m
Expand Down
2 changes: 1 addition & 1 deletion charts/rtorrent-vpn/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: rtorrent-vpn
description: A Helm chart for rtorrent-vpn
type: application
version: 1.2.0
version: 1.3.0
appVersion: rtorrent-ps-1.1.r54.ga787dd9-1-31
sources:
- https://hub.docker.com/r/binhex/arch-rtorrentvpn/
Expand Down
4 changes: 1 addition & 3 deletions charts/rtorrent-vpn/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "rtorrent-vpn.fullname" . }})
Expand Down
31 changes: 31 additions & 0 deletions charts/rtorrent-vpn/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,34 @@ Create the name of the service account to use
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "rtorrent-vpn.ingress.apiVersion" -}}
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) -}}
{{- print "networking.k8s.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
{{/*
Return if ingress is stable.
*/}}
{{- define "rtorrent-vpn.ingress.isStable" -}}
{{- eq (include "rtorrent-vpn.ingress.apiVersion" .) "networking.k8s.io/v1" -}}
{{- end -}}
{{/*
Return if ingress supports ingressClassName.
*/}}
{{- define "rtorrent-vpn.ingress.supportsIngressClassName" -}}
{{- or (eq (include "rtorrent-vpn.ingress.isStable" .) "true") (and (eq (include "rtorrent-vpn.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}}
{{- end -}}
{{/*
Return if ingress supports pathType.
*/}}
{{- define "rtorrent-vpn.ingress.supportsPathType" -}}
{{- or (eq (include "rtorrent-vpn.ingress.isStable" .) "true") (and (eq (include "rtorrent-vpn.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}}
{{- end -}}
67 changes: 50 additions & 17 deletions charts/rtorrent-vpn/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,73 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressApiIsStable := eq (include "rtorrent-vpn.ingress.isStable" .) "true" -}}
{{- $ingressSupportsIngressClassName := eq (include "rtorrent-vpn.ingress.supportsIngressClassName" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "rtorrent-vpn.ingress.supportsPathType" .) "true" -}}
{{- $fullName := include "rtorrent-vpn.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
{{- $servicePort := .Values.service.port -}}
{{- $ingressPath := .Values.ingress.path -}}
{{- $ingressPathType := .Values.ingress.pathType -}}
apiVersion: {{ include "rtorrent-vpn.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "rtorrent-vpn.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
{{- if .Values.ingress.labels }}
{{ toYaml .Values.ingress.labels | indent 4 }}
{{- end }}
{{- if .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- range $key, $value := .Values.ingress.annotations }}
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
{{- end }}
spec:
{{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }}
ingressClassName: {{ .Values.ingress.ingressClassName }}
{{- end -}}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{ tpl (toYaml .Values.ingress.tls) $ | indent 4 }}
{{- end }}
rules:
{{- if .Values.ingress.hosts }}
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
- host: {{ tpl . $}}
http:
paths:
{{- range .paths }}
- path: {{ . }}
pathType: ImplementationSpecific
- path: {{ $ingressPath }}
{{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }}
{{- end }}
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- end }}
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
{{- else }}
- http:
paths:
- backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $fullName }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $servicePort }}
{{- end }}
{{- if $ingressPath }}
path: {{ $ingressPath }}
{{- end }}
{{- if $ingressSupportsPathType }}
pathType: {{ $ingressPathType }}
{{- end }}
{{- end -}}
{{- end }}
18 changes: 14 additions & 4 deletions charts/rtorrent-vpn/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,22 @@ service:

ingress:
enabled: false
# For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
# See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
# ingressClassName: nginx
# Values can be templated
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
labels: {}
path: /

# pathType is only for k8s >= 1.1=
pathType: Prefix

hosts:
- host: chart-example.local
paths: []
- chart-example.local

tls: []
# - secretName: chart-example-tls
# hosts:
Expand Down

0 comments on commit 59f7adc

Please sign in to comment.