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:v20220819-ga98c63787@sha256:778ac6d1188c8de8ecabeddd3c37b72c8adc8c712bad2bd7a81fb23a3514934c
        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
