apiVersion: v1
kind: Service
metadata:
  name: airsonic
  namespace: airsonic
spec:
  type: NodePort
  ports:
    - name: http
      port: 4040
      nodePort: 30780
      targetPort: airsonic-http
  selector:
    app: airsonic
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: airsonic-pv-claim
  namespace: airsonic
  labels:
    app: airsonic
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: ""
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: airsonic
  namespace: airsonic
  labels:
    app: airsonic
spec:
  selector:
    matchLabels:
      app: airsonic
      tier: frontend
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: airsonic
        tier: frontend
    spec:
      containers:
      - env:
          - name: JAVA_OPTS
            value: -Dserver.port=4040
        name: airsonic
        #image: airsonic/airsonic
        image: docker-registry:32000/airsonic:1.0
        ports:
        - containerPort: 4040
          name: "airsonic-http"
        volumeMounts:
        - name: airsonic-www-folder
          mountPath: /airsonic/data
        - name: airsonic-www-folder
          mountPath: /airsonic/music
          #- name: airsonic-www-folder
          #mountPath: /airsonic/luisa
        - name: airsonic-www-folder
          mountPath: /airsonic/playlists
        - name: airsonic-www-folder
          mountPath: /airsonic/podcasts
      imagePullSecrets:
      - name: reg-cred-secret
      volumes:
      - name: airsonic-www-folder
        persistentVolumeClaim:
          claimName: airsonic-pv-claim
