apiVersion: v1
kind: Pod
metadata:
  name: myservice-pod
  annotations:
    podDirector: "director1"
    podEnvironment: "dev"
    podDC: "-dc1"
    podWeight: "1"
    vaasUser: "admin"
    vaasKey: "admin_api_key"
    vaasUrl: "http://localhost:80"
spec:
  containers:
  - name: myservice-with-hooks-container
    image: python:2
    command: ["python", "-m", "SimpleHTTPServer", "8080"]
    env:
    - name: KUBERNETES_POD_NAME
      valueFrom:
        fieldRef:
          fieldPath: metadata.name
    - name: KUBERNETES_POD_NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace
    ports:
    - containerPort: 8080
    volumeMounts:
    - name: hooks
      mountPath: /hooks
    lifecycle:
      postStart:
        exec:
          command: ["/bin/sh", "-c", "/hooks/vaas-hook --debug register"]
      preStop:
        exec:
          command: ["/bin/sh", "-c", "/hooks/vaas-hook --debug deregister"]
  - name: vaas-dev-container
    image: allegro/vaas
    ports:
    - containerPort: 80
  volumes:
  - name: hooks
    hostPath:
      path: /hooks
