diff options
Diffstat (limited to 'roles/gonic')
-rw-r--r-- | roles/gonic/defaults/main.yaml | 9 | ||||
-rw-r--r-- | roles/gonic/files/gonic/.helmignore | 23 | ||||
-rw-r--r-- | roles/gonic/files/gonic/Chart.yaml | 5 | ||||
-rw-r--r-- | roles/gonic/files/gonic/templates/deployment.yaml | 33 | ||||
-rw-r--r-- | roles/gonic/files/gonic/templates/ingress.yaml | 34 | ||||
-rw-r--r-- | roles/gonic/files/gonic/templates/pv.yaml | 16 | ||||
-rw-r--r-- | roles/gonic/files/gonic/templates/pvc.yaml | 14 | ||||
-rw-r--r-- | roles/gonic/files/gonic/templates/service.yaml | 14 | ||||
-rw-r--r-- | roles/gonic/tasks/main.yaml | 17 |
9 files changed, 165 insertions, 0 deletions
diff --git a/roles/gonic/defaults/main.yaml b/roles/gonic/defaults/main.yaml new file mode 100644 index 0000000..d0e845c --- /dev/null +++ b/roles/gonic/defaults/main.yaml @@ -0,0 +1,9 @@ +gonic: + enabled: false + replicas: 1 + port: 80 + image: sentriz/gonic + version: v0.16.4 + +nfs: + path: "/mnt/nfs/k3s/gonic" diff --git a/roles/gonic/files/gonic/.helmignore b/roles/gonic/files/gonic/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/roles/gonic/files/gonic/.helmignore @@ -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/ diff --git a/roles/gonic/files/gonic/Chart.yaml b/roles/gonic/files/gonic/Chart.yaml new file mode 100644 index 0000000..2bdf9fd --- /dev/null +++ b/roles/gonic/files/gonic/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: gonic +description: Subsonic compatible music server +type: application +version: 0.1.0 diff --git a/roles/gonic/files/gonic/templates/deployment.yaml b/roles/gonic/files/gonic/templates/deployment.yaml new file mode 100644 index 0000000..0b1ed08 --- /dev/null +++ b/roles/gonic/files/gonic/templates/deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "{{ .Chart.Name }}-deployment" + labels: + app: {{ .Chart.Name }} +spec: + replicas: {{ .Values.replicas }} + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: + containers: + - name: gonic + image: "{{ .Values.image }}:{{ .Values.version }}" + volumeMounts: + - mountPath: "/data" + name: "{{ .Chart.Name }}-volume" + subPath: data + - mountPath: "/music" + name: "{{ .Chart.Name }}-volume" + subPath: music + - mountPath: "/playlists" + name: "{{ .Chart.Name }}-volume" + subPath: playlists + volumes: + - name: "{{ .Chart.Name }}-volume" + persistentVolumeClaim: + claimName: "{{ .Chart.Name }}-pvc" diff --git a/roles/gonic/files/gonic/templates/ingress.yaml b/roles/gonic/files/gonic/templates/ingress.yaml new file mode 100644 index 0000000..aa6a0bd --- /dev/null +++ b/roles/gonic/files/gonic/templates/ingress.yaml @@ -0,0 +1,34 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: gonic + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" +spec: + ingressClassName: traefik + tls: + - hosts: + - music.aadityadhruv.com + - music.home + secretName: gonic-tls + rules: + - host: music.home + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: gonic-service + port: + number: 80 + - host: music.aadityadhruv.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: gonic-service + port: + number: 80 diff --git a/roles/gonic/files/gonic/templates/pv.yaml b/roles/gonic/files/gonic/templates/pv.yaml new file mode 100644 index 0000000..869b121 --- /dev/null +++ b/roles/gonic/files/gonic/templates/pv.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: "{{ .Chart.Name }}-pv" + labels: + app: "{{ .Chart.Name }}-pv" +spec: + storageClassName: nfs + capacity: + storage: 100Gi + accessModes: + - ReadWriteMany + nfs: + server: {{ .Values.nfs.server }} + path: {{ .Values.nfs.path }} + readOnly: false diff --git a/roles/gonic/files/gonic/templates/pvc.yaml b/roles/gonic/files/gonic/templates/pvc.yaml new file mode 100644 index 0000000..10a5ced --- /dev/null +++ b/roles/gonic/files/gonic/templates/pvc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Chart.Name }}-pvc +spec: + storageClassName: nfs + accessModes: + - ReadWriteMany + resources: + requests: + storage: 100Gi + selector: + matchLabels: + app: "{{ .Chart.Name }}-pv" diff --git a/roles/gonic/files/gonic/templates/service.yaml b/roles/gonic/files/gonic/templates/service.yaml new file mode 100644 index 0000000..a9c272f --- /dev/null +++ b/roles/gonic/files/gonic/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-service +spec: + type: ClusterIP + selector: + app: {{ .Chart.Name }} + ports: + - protocol: TCP + port: {{ .Values.port }} + targetPort: 80 + name: webui + diff --git a/roles/gonic/tasks/main.yaml b/roles/gonic/tasks/main.yaml new file mode 100644 index 0000000..1d2daa6 --- /dev/null +++ b/roles/gonic/tasks/main.yaml @@ -0,0 +1,17 @@ +--- +- name: Deploy Gonic + kubernetes.core.helm: + name: gonic + chart_ref: "{{ lookup('env', 'PWD') }}/roles/gonic/files/gonic" + namespace: default + state: "{%- if gonic.enabled -%} present {%- else -%} absent {%- endif -%}" + values: + replicas: "{{ gonic.replicas }}" + port: "{{ gonic.port }}" + image: "{{ gonic.image }}" + version: "{{ gonic.version }}" + nfs: + server: "{{ nfs.server }}" + path: "{{ nfs.path }}" + delegate_to: localhost + run_once: true |