apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: sdapi
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: screwdriver
        tier: api
    spec:
      containers:
      - name: screwdriver-api
        image: screwdrivercd/screwdriver
        ports:
        - containerPort: 8080
        env:
          - name: DATASTORE_PLUGIN
            value: dynamodb
          - name: HOST
            value: 0.0.0.0
          - name: DATA_DIR
            value: /opt/screwdriver/data
          - name: SECRET_JWT_PRIVATE_KEY
            valueFrom:
              secretKeyRef:
                name: plugin-login-secrets
                key: jwtprivatekey
          - name: SECRET_OAUTH_CLIENT_ID
            valueFrom:
              secretKeyRef:
                name: plugin-login-secrets
                key: oauthclientid
          - name: SECRET_OAUTH_CLIENT_SECRET
            valueFrom:
              secretKeyRef:
                name: plugin-login-secrets
                key: oauthclientsecret
          - name: SECRET_PASSWORD
            valueFrom:
              secretKeyRef:
                name: plugin-login-secrets
                key: password
          - name: K8S_TOKEN
            valueFrom:
              secretKeyRef:
                name: default-token-sw0ar
                key: token
          - name: DATASTORE_DYNAMODB_ID
            valueFrom:
              secretKeyRef:
                name: datastore-dynamodb
                key: id
          - name: DATASTORE_DYNAMODB_SECRET
            valueFrom:
              secretKeyRef:
                name: datastore-dynamodb
                key: secret

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: sdapi
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: screwdriver
        tier: api
    spec:
      containers:
      - name: screwdriver-api
        image: screwdrivercd/screwdriver
        ports:
        - containerPort: 8080
        # Environment variables that point to your secrets in your secrets.yaml
        env:
          - name: DATASTORE_PLUGIN
            value: dynamodb
          - name: HOST
            value: 0.0.0.0
          - name: DATA_DIR
            value: /opt/screwdriver/data
          - name: SECRET_JWT_PRIVATE_KEY
            valueFrom:
              secretKeyRef:
                name: secrets
                key: jwtprivatekey
          - name: SECRET_OAUTH_CLIENT_ID
            valueFrom:
              secretKeyRef:
                name: secrets
                key: oauthclientid
          - name: SECRET_OAUTH_CLIENT_SECRET
            valueFrom:
              secretKeyRef:
                name: secrets
                key: oauthclientsecret
          - name: SECRET_PASSWORD
            valueFrom:
              secretKeyRef:
                name: secrets
                key: password
          - name: K8S_TOKEN
            valueFrom:
              secretKeyRef:
                name: default-token-sw0ar     # insert your Kubernetes <DEFAULT_TOKEN_NAME> here
                key: token
          - name: DATASTORE_DYNAMODB_ID
            valueFrom:
              secretKeyRef:
                name: secrets
                key: dynamodbid
          - name: DATASTORE_DYNAMODB_SECRET
            valueFrom:
              secretKeyRef:
                name: secrets
                key: dynamodbsecret

Simplify secret environment variables in Kubernetes deployment YAML
Simplify secret environment variables in Kubernetes deployment YAML
