apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-echo-service
  labels:
    k8s-app: demo-echo-service
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: demo-echo-service
  template:
    metadata:
      labels:
        k8s-app: demo-echo-service
    spec:
      terminationGracePeriodSeconds: 60
      containers:
      - name: echo-service
        image: registry.k8s.io/ingress-nginx/e2e-test-echo:v1.2.5@sha256:d7b3143152261e918e2197ef86840986ba7fbbd5ca72e0e79d6ec4ea99d2abc3
        ports:
        - containerPort: 8080
        resources:
          limits:
            cpu: 10m
            memory: 20Mi
          requests:
            cpu: 10m
            memory: 20Mi
---
apiVersion: v1
kind: Service
metadata:
  name: demo-echo-service
  labels:
    k8s-app: demo-echo-service
  namespace: default
spec:
  ports:
  - port: 80
    targetPort: 8080
  selector:
    k8s-app: demo-echo-service
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: public-demo-echo-service
  annotations:
    nginx.ingress.kubernetes.io/auth-url: http://demo-auth-service.default.svc.cluster.local?code=200
    nginx.ingress.kubernetes.io/auth-response-headers: UserID, UserRole
  namespace: default
spec:
  ingressClassName: nginx
  rules:
  - host: public-demo-echo-service.kube.local
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: demo-echo-service
            port:
              number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: secure-demo-echo-service
  annotations:
    nginx.ingress.kubernetes.io/auth-url: http://demo-auth-service.default.svc.cluster.local
    nginx.ingress.kubernetes.io/auth-response-headers: UserID, UserRole
  namespace: default
spec:
  ingressClassName: nginx
  rules:
  - host: secure-demo-echo-service.kube.local
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: demo-echo-service
            port:
              number: 80
