apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-ssl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-ssl
  template:
    metadata:
      labels:
        app: nginx-ssl
      annotations:
        vault.hashicorp.com/agent-inject: "true"
        vault.hashicorp.com/agent-inject-secret-server.cert: "pki_int/issue/example-dot-ru"
        vault.hashicorp.com/agent-inject-template-server.cert: |
          {{- with secret "pki_int/issue/example-dot-ru" "common_name=otus.example.ru" -}}
          {{ .Data.certificate }}
          {{- end }}
        vault.hashicorp.com/agent-inject-secret-server.key: "pki_int/issue/example-dot-ru"
        vault.hashicorp.com/agent-inject-template-server.key: |
          {{- with secret "pki_int/issue/example-dot-ru" "common_name=otus.example.ru" -}}
          {{ .Data.private_key }}
          {{- end }}
        vault.hashicorp.com/role: "otus"
        vault.hashicorp.com/tls-skip-verify: "true"
        vault.hashicorp.com/service: "https://vault:8200"
    spec:
      serviceAccountName: vault-auth
      containers:
      - name: nginx-ssl
        image: mariarti/nginx-ssl:0.1.0
        imagePullPolicy: Always
        ports:
        - containerPort: 443
          name: https