# Find-and-replace 
#    INIT_IMAGE, 
#    VIPER_IMAGE, 
#    CONTROLLER_IMAGE
#    APPLICATION_IMAGE 
# ...with the actual names of the images
#
# Find-andreplace ARTIFACT_REPOSITORY with the actual path to the Build location 
#   where the vFunction artifacts are stored

apiVersion: apps/v1
kind: Deployment
metadata:
  name: application-with-vfunction-controller
  namespace: vfunction
  labels:
    app: application-with-vfunction-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app: application-with-vfunction-controller
  template:
    metadata:
    labels:
     app: application-with-vfunction-controller
    spec:
      initContainers:
      - image: INIT_IMAGE
        imagePullPolicy: IfNotPresent
        name: init
        securityContext:
          runAsNonRoot: true
          runAsUser: 1500
        volumeMounts:
        - mountPath: /shared/
          name: shared
      containers:
      - name: application
        image: APPLICATION_IMAGE
        env:
        - name: CORECLR_ENABLE_PROFILING
          valueFrom:
            configMapKeyRef:
              name: vf-agent-env-vars
              key: CORECLR_ENABLE_PROFILING
        - name: CORECLR_PROFILER
          valueFrom:
            configMapKeyRef:
              name: vf-agent-env-vars
              key: CORECLR_PROFILER
        - name: CORECLR_PROFILER_PATH_64
          valueFrom:
            configMapKeyRef:
              name: vf-agent-env-vars
              key: CORECLR_PROFILER_PATH_64
        - name: DOTNET_TailCallOpt
          valueFrom:
            configMapKeyRef:
              name: vf-agent-env-vars
              key: DOTNET_TailCallOpt
        - name: VF_AGENT_CONF_LOCATION
          valueFrom:
            configMapKeyRef:
              name: vf-agent-env-vars
              key: VF_AGENT_CONF_LOCATION
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
          protocol: TCP
        securityContext:
          runAsNonRoot: true
          runAsUser: 1500
        volumeMounts:
        - mountPath: /shared/
          name: shared
      - name: controller
        image: CONTROLLER_IMAGE
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsNonRoot: true
          runAsUser: 1500
        volumeMounts:
        - mountPath: /shared/
          name: shared
      - name: viper
        image: VIPER_IMAGE
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsNonRoot: true
          runAsUser: 1500
        volumeMounts:
        - mountPath: /shared/
          name: shared
      volumes:
      - emptyDir: {}
        name: shared