
apiVersion: apps/v1

kind: Deployment
metadata:
  name: median-meter

spec:
  replicas: 3
  selector:
    matchLabels:
      app: median-meter-service

  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1

  template:
    metadata:
      labels:
        app: median-meter-service

    spec:
      containers:

        - name: median-meter-service
          image: xxlabaza/median-meter:latest
          imagePullPolicy: Always # just for skipping image caching issue
          volumeMounts:
            - name: config-volume
              mountPath: /etc/config
          env:
            - name: JAVA_TOOL_OPTIONS
              value: "--add-modules=java.se \
                      --add-exports='java.base/jdk.internal.ref=ALL-UNNAMED' \
                      --add-opens='java.base/java.lang=ALL-UNNAMED' \
                      --add-opens='java.base/java.nio=ALL-UNNAMED' \
                      --add-opens='java.base/sun.nio.ch=ALL-UNNAMED' \
                      --add-opens='java.management/sun.management=ALL-UNNAMED' \
                      --add-opens='jdk.management/com.sun.management.internal=ALL-UNNAMED'"

      volumes:
        - name: config-volume
          configMap:
            name: median-meter-configmap
