apiVersion: apps/v1
kind: Deployment
metadata:
  name: devopstraining
  labels:
    app: frontend
spec:
  selector:
    matchLabels:
      octopusexport: OctopusExport
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: frontend
        octopusexport: OctopusExport
    spec:
      containers:
        - name: frontend
          image: 'davargonez/devops_training:frontend_#{version}#'
          ports:
            - name: appfrontport
              containerPort: 4200
              protocol: TCP
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                labelSelector:
                  matchExpressions:
                    - key: app
                      operator: In
                      values:
                        - web
                topologyKey: kubernetes.io/hostname
