diff --git a/nzbhydra.old/templates/ingress.yaml b/nzbhydra.old/templates/ingress.yaml deleted file mode 100644 index 3aa0d22..0000000 --- a/nzbhydra.old/templates/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "nzbhydra.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "nzbhydra.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: -{{- 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: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} -{{- end }} diff --git a/nzbhydra.old/templates/service.yaml b/nzbhydra.old/templates/service.yaml deleted file mode 100644 index 038a4ac..0000000 --- a/nzbhydra.old/templates/service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "nzbhydra.fullname" . }} - labels: - {{- include "nzbhydra.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: 5076 - protocol: TCP - name: hydra - selector: - {{- include "nzbhydra.selectorLabels" . | nindent 4 }} diff --git a/nzbhydra.old/templates/statefulset.yaml b/nzbhydra.old/templates/statefulset.yaml deleted file mode 100644 index b853d89..0000000 --- a/nzbhydra.old/templates/statefulset.yaml +++ /dev/null @@ -1,85 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: {{ include "nzbhydra.fullname" . }} - labels: - {{- include "nzbhydra.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - serviceName: {{ include "nzbhydra.fullname" . }} - selector: - matchLabels: - {{- include "nzbhydra.selectorLabels" . | nindent 6 }} - template: - metadata: - labels: - {{- include "nzbhydra.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "nzbhydra.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: hydra - containerPort: 5076 - protocol: TCP - livenessProbe: - tcpSocket: - port: 5076 - readinessProbe: - tcpSocket: - port: 5076 - startupProbe: - tcpSocket: - port: 5076 - failureThreshold: 30 - periodSeconds: 10 - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumeMounts: - - name: hydra-config - mountPath: /config - - name: hydra-tmp - mountPath: /tmp - volumes: - - name: hydra-tmp - emptyDir: {} - {{- if and .Values.config.persistence.enabled .Values.config.persistence.existingClaim }} - - name: hydra-config - persistentVolumeClaim: - {{- with .Values.config.persistence.existingClaim }} - claimName: {{ tpl . $ }} - {{- end }} - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- if and .Values.config.persistence.enabled (not .Values.config.persistence.existingClaim) }} - volumeClaimTemplates: - - metadata: - name: hydra-config - spec: - accessModes: [ "ReadWriteOnce" ] - storageClassName: {{ .Values.config.persistence.storageClassName | quote }} - resources: - requests: - storage: {{ .Values.config.persistence.storageSize }} - {{- end -}} diff --git a/nzbhydra.old/.helmignore b/plexporter/.helmignore similarity index 100% rename from nzbhydra.old/.helmignore rename to plexporter/.helmignore diff --git a/nzbhydra.old/Chart.yaml b/plexporter/Chart.yaml similarity index 86% rename from nzbhydra.old/Chart.yaml rename to plexporter/Chart.yaml index 59a2027..3d2879c 100644 --- a/nzbhydra.old/Chart.yaml +++ b/plexporter/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -name: nzbhydra +name: plexporter description: A Helm chart for Kubernetes # A chart can be either an 'application' or a 'library' chart. @@ -14,10 +14,10 @@ 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. -version: 0.1.32 +version: 0.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. -appVersion: v3.13.0 +appVersion: v0.1 -icon: https://git.ervine.org/jonny/x86_64-alpine-nzbhydra/raw/branch/master/hydra.png +icon: https://www.plex.tv/wp-content/uploads/2018/01/pmp-icon-1.png diff --git a/nzbhydra.old/templates/NOTES.txt b/plexporter/templates/NOTES.txt similarity index 74% rename from nzbhydra.old/templates/NOTES.txt rename to plexporter/templates/NOTES.txt index bc7951e..7bca3b2 100644 --- a/nzbhydra.old/templates/NOTES.txt +++ b/plexporter/templates/NOTES.txt @@ -6,16 +6,16 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nzbhydra.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "sonarr.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 --namespace {{ .Release.Namespace }} svc -w {{ include "nzbhydra.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nzbhydra.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "sonarr.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "sonarr.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") 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 "nzbhydra.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "sonarr.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 {{- end }} diff --git a/nzbhydra.old/templates/_helpers.tpl b/plexporter/templates/_helpers.tpl similarity index 76% rename from nzbhydra.old/templates/_helpers.tpl rename to plexporter/templates/_helpers.tpl index 725ebef..bc3d1c7 100644 --- a/nzbhydra.old/templates/_helpers.tpl +++ b/plexporter/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Expand the name of the chart. */}} -{{- define "nzbhydra.name" -}} +{{- define "sonarr.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -11,7 +11,7 @@ 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 "nzbhydra.fullname" -}} +{{- define "sonarr.fullname" -}} {{- if .Values.fullnameOverride -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} @@ -27,16 +27,16 @@ If release name contains chart name it will be used as a full name. {{/* Create chart name and version as used by the chart label. */}} -{{- define "nzbhydra.chart" -}} +{{- define "sonarr.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* Common labels */}} -{{- define "nzbhydra.labels" -}} -helm.sh/chart: {{ include "nzbhydra.chart" . }} -{{ include "nzbhydra.selectorLabels" . }} +{{- define "sonarr.labels" -}} +helm.sh/chart: {{ include "sonarr.chart" . }} +{{ include "sonarr.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -46,17 +46,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "nzbhydra.selectorLabels" -}} -app.kubernetes.io/name: {{ include "nzbhydra.name" . }} +{{- define "sonarr.selectorLabels" -}} +app.kubernetes.io/name: {{ include "sonarr.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} {{/* Create the name of the service account to use */}} -{{- define "nzbhydra.serviceAccountName" -}} +{{- define "sonarr.serviceAccountName" -}} {{- if .Values.serviceAccount.create -}} - {{ default (include "nzbhydra.fullname" .) .Values.serviceAccount.name }} + {{ default (include "sonarr.fullname" .) .Values.serviceAccount.name }} {{- else -}} {{ default "default" .Values.serviceAccount.name }} {{- end -}} diff --git a/plexporter/templates/deployment.yaml b/plexporter/templates/deployment.yaml new file mode 100644 index 0000000..065a497 --- /dev/null +++ b/plexporter/templates/deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "plexporter.fullname" . }} + labels: + {{- include "plexporter.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "plexporter.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "plexporter.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "plexporter.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + env: + - name: PLEX_SERVER + value: {{ .Values.metrics.plex_server }} + - name: PLEX_TOKEN + value: {{ .Values.metrics.plex_token }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 9000 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- 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/nzbhydra.old/templates/serviceaccount.yaml b/plexporter/templates/serviceaccount.yaml similarity index 52% rename from nzbhydra.old/templates/serviceaccount.yaml rename to plexporter/templates/serviceaccount.yaml index 1b85d98..1b095bd 100644 --- a/nzbhydra.old/templates/serviceaccount.yaml +++ b/plexporter/templates/serviceaccount.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "nzbhydra.serviceAccountName" . }} + name: {{ include "sonarr.serviceAccountName" . }} labels: -{{ include "nzbhydra.labels" . | nindent 4 }} +{{ include "sonarr.labels" . | nindent 4 }} {{- end -}} diff --git a/nzbhydra.old/templates/tests/test-connection.yaml b/plexporter/templates/tests/test-connection.yaml similarity index 51% rename from nzbhydra.old/templates/tests/test-connection.yaml rename to plexporter/templates/tests/test-connection.yaml index aa8287e..3f81478 100644 --- a/nzbhydra.old/templates/tests/test-connection.yaml +++ b/plexporter/templates/tests/test-connection.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Pod metadata: - name: "{{ include "nzbhydra.fullname" . }}-test-connection" + name: "{{ include "sonarr.fullname" . }}-test-connection" labels: -{{ include "nzbhydra.labels" . | nindent 4 }} +{{ include "sonarr.labels" . | nindent 4 }} annotations: "helm.sh/hook": test-success spec: @@ -11,5 +11,5 @@ spec: - name: wget image: busybox command: ['wget'] - args: ['{{ include "nzbhydra.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "sonarr.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never diff --git a/nzbhydra.old/values.yaml b/plexporter/values.yaml similarity index 81% rename from nzbhydra.old/values.yaml rename to plexporter/values.yaml index a386e5e..edce75c 100644 --- a/nzbhydra.old/values.yaml +++ b/plexporter/values.yaml @@ -1,17 +1,22 @@ -# Default values for nzbhydra. +# Default values for sonarr. # This is a YAML-formatted file. # Declare variables to be passed into your templates. replicaCount: 1 image: - repository: harbor.ervine.dev/public/x86_64/alpine/nzbhydra - pullPolicy: Always + repository: harbor.ervine.dev/public/x86_64/prometheus-plex-exporter + tag: latest + pullPolicy: IfNotPresent imagePullSecrets: [] nameOverride: "" fullnameOverride: "" +metrics: + plex_token: xwDKx3sL621esg8ELVHj + plex_server: "http://plex.ipa.champion:32400" + serviceAccount: # Specifies whether a service account should be created create: true @@ -32,7 +37,7 @@ securityContext: service: type: ClusterIP - port: 5076 + port: 9000 ingress: enabled: false @@ -47,7 +52,7 @@ ingress: # hosts: # - chart-example.local -resources: +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 @@ -56,8 +61,8 @@ resources: # cpu: 100m # memory: 128Mi requests: - cpu: 300m - memory: 256Mi + cpu: 20m + memory: 64Mi nodeSelector: location: livingRoom @@ -66,9 +71,3 @@ tolerations: [] affinity: {} -config: - persistence: - enabled: true - existingClaim: media-nzbhydra-config - storageClassName: nfs-client-hermes - storageSize: 10Gi