#  Copyright 2018 U.C. Berkeley RISE Lab
# 
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
# 
#      http://www.apache.org/licenses/LICENSE-2.0
# 
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

apiVersion: v1
kind: Pod
metadata:
  name: function-pod-NUM_DUMMY
  labels: 
    role: function
spec:
  restartPolicy: Never
  volumes:
  - name: ipc
    hostPath:
      path: /tmp
  hostNetwork: true
  hostIPC: true
  containers:
  ### FUNCTION CONTAINER 2
  - name: function-1
    image: fluentproject/executor
    imagePullPolicy: Always
    env: 
    - name: ROUTE_ADDR
      value: ROUTE_ADDR_DUMMY
    - name: MGMT_IP
      value: MGMT_IP_DUMMY
    - name: SCHED_IPS
      value: SCHED_IPS_DUMMY
    - name: THREAD_ID
      value: "0"
    - name: SYSTEM_FUNC
      value: none
    volumeMounts:
    - mountPath: /requests
      name: ipc
  ### FUNCTION CONTAINER 2
  - name: function-2
    image: fluentproject/executor
    imagePullPolicy: Always
    env: 
    - name: ROUTE_ADDR
      value: ROUTE_ADDR_DUMMY
    - name: MGMT_IP
      value: MGMT_IP_DUMMY
    - name: SCHED_IPS
      value: SCHED_IPS_DUMMY
    - name: THREAD_ID
      value: "1"
    - name: SYSTEM_FUNC
      value: none
    volumeMounts:
    - mountPath: /requests
      name: ipc
  ### FUNCTION CONTAINER 3
  - name: function-3
    image: fluentproject/executor
    imagePullPolicy: Always
    env: 
    - name: ROUTE_ADDR
      value: ROUTE_ADDR_DUMMY
    - name: MGMT_IP
      value: MGMT_IP_DUMMY
    - name: SCHED_IPS
      value: SCHED_IPS_DUMMY
    - name: THREAD_ID
      value: "2"
    - name: SYSTEM_FUNC
      value: none
    volumeMounts:
    - mountPath: /requests
      name: ipc
  ### CACHE CONTAINER
  - name: cache-container
    image: fluentproject/cache
    imagePullPolicy: Always
    env:
    - name: ROUTE_ADDR
      value: ROUTE_ADDR_DUMMY
    - name: MGMT_IP
      value: MGMT_IP_DUMMY
    volumeMounts:
    - mountPath: /requests
      name: ipc
  nodeSelector:
    role: function
    podid: function-NUM_DUMMY
