apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  #@ replicas = 5
  #@ unavailBudget = 2
  replicas: #@ replicas
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: #@ (replicas - unavailBudget) if replicas > 3 else 1
    type: RollingUpdate
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
