apiVersion: v1
kind: PersistentVolume
metadata:
  name: mqtt-to-rdf-data
  labels:
    type: local
spec:
  storageClassName: manual
  hostPath:
    path: "/my/proj/homeauto/service/mqtt_to_rdf/conf"
  capacity: { storage: 1Mi }
  accessModes: [ReadWriteOnce]
  persistentVolumeReclaimPolicy: Retain
  claimRef: { namespace: default, name: mqtt-to-rdf-data }
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mqtt-to-rdf-data
spec:
  storageClassName: ""
  volumeName: "mqtt-to-rdf-data"
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 1Mi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mqtt-to-rdf
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mqtt-to-rdf
  template:
    metadata:
      labels:
        app: mqtt-to-rdf
    spec:
      containers:
        - name: mqtt-to-rdf
          image: bang5:5000/mqtt_to_rdf_image
          imagePullPolicy: "Always"
          ports:
            - containerPort: 10018 
          volumeMounts:
            - { name: data, mountPath: "/opt/conf" }
          # resources:
          #   limits:
          #     cpu: "2"
          #     memory: 100Mi
      volumes:
        - { name: data, persistentVolumeClaim: { claimName: mqtt-to-rdf-data } }

      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: "kubernetes.io/hostname"
                operator: In
                values: ["bang"]
---
apiVersion: v1
kind: Service
metadata:
  name: mqtt-to-rdf
spec:
  ports:
  - {port: 10018, targetPort: 10018}
  selector:
    app: mqtt-to-rdf
