---
# Modified from https://github.com/microservices-demo/microservices-demo
# Please see this repository for the original

apiVersion: apps/v1
kind: Deployment
metadata:
  name: carts
  labels:
    name: carts
  namespace: sock-shop
spec:
  selector:
    matchLabels:
      name: carts
  template:
    metadata:
      labels:
        name: carts
        version: '2'
    spec:
      containers:
      - name: carts
        image: weaveworksdemos/carts:0.4.8
        ports:
        - containerPort: 80
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: name
                  operator: In
                  values:
                  - carts
                - key: version
                  operator: In
                  values: 
                  - '2'
              topologyKey: kubernetes.io/hostname
