# yaml template for NCP ReplicationController
---
apiVersion: v1
kind: ReplicationController
metadata:
  # VMware NSX Container Plugin
  name: nsx-ncp
  namespace: nsx-system
  labels:
    tier: nsx-networking
    component: nsx-ncp
    version: v1
spec:
  # Active-Active/Active-Standby is not supported in current release.
  # so replica *must be* 1.
  replicas: 1
  template:
    metadata:
      labels:
        tier: nsx-networking
        component: nsx-ncp
        version: v1
    spec:
      hostNetwork: true
      serviceAccountName: ncp-svc-account
      containers:
        - name: nsx-ncp
          image: "{{ nsx_ncp_image }}"
          imagePullPolicy: IfNotPresent
          env:
            - name: NCP_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: NCP_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          livenessProbe:
            exec:
              command:
                - /bin/sh
                - -c
                - check_pod_liveness nsx-ncp
            initialDelaySeconds: 5
            timeoutSeconds: 5
            periodSeconds: 10
            failureThreshold: 5
          volumeMounts:
          - name: config-volume
            mountPath: /etc/nsx-ujo/ncp.ini
            subPath: ncp.ini
            readOnly: true
          - name: lb-cert
            mountPath: /etc/nsx-cert
{% if nsx_api_cert is defined %}
          - name: nsx-auth
            mountPath: /etc/nsx-auth-cert
{% endif %}
      volumes:
        - name: config-volume
          configMap:
            name: nsx-ncp-config
        - name: lb-cert
          secret:
            secretName: nsx-lb-cert
{% if nsx_api_cert is defined %}
        - name: nsx-auth
          secret:
            secretName: nsx-auth-cert
{% endif %}
