---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hotel
  labels:
    app: hotell
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hotel
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 10%
  template:
    metadata:
      labels:
        app: hotel
    spec:
      containers:
        - name: hotel
          image: localhost:5000/hotel
          ports:
            - containerPort: 3000
          env:
            - name: MONGODB_URL
              valueFrom:
                secretKeyRef:
                  name: travelagent-data
                  key: hotelurl
      initContainers:
        - name: init-myservice
          image: busybox:1.31
          command: ['sh', '-c', 'until nslookup hotel; do echo waiting for hotel; sleep 2; done;']