|
| 1 | +apiVersion: apps/v1 |
| 2 | +kind: Deployment |
| 3 | +metadata: |
| 4 | + labels: |
| 5 | + run: haproxy-unified-gateway |
| 6 | + name: haproxy-unified-gateway |
| 7 | + namespace: haproxy-unified-gateway |
| 8 | +spec: |
| 9 | + # specify the number of controller replicas |
| 10 | + replicas: 1 |
| 11 | + selector: |
| 12 | + matchLabels: |
| 13 | + run: haproxy-unified-gateway |
| 14 | + template: |
| 15 | + metadata: |
| 16 | + labels: |
| 17 | + run: haproxy-unified-gateway |
| 18 | + spec: |
| 19 | + serviceAccountName: haproxy-unified-gateway |
| 20 | + containers: |
| 21 | + - name: haproxy-unified-gateway |
| 22 | + # specify the container image, tag and pull policy |
| 23 | + # image: docker.io/haproxytech/haproxy-unified-gateway:latest |
| 24 | + image: haproxytech/haproxy-unified-gateway:latest |
| 25 | + # imagePullPolicy: this is set to never for kind cluster usage |
| 26 | + # imagePullPolicy: Always for other environments |
| 27 | + imagePullPolicy: Never |
| 28 | + resources: |
| 29 | + limits: |
| 30 | + memory: 2560Mi |
| 31 | + requests: |
| 32 | + memory: 2048Mi |
| 33 | + lifecycle: |
| 34 | + preStop: |
| 35 | + exec: |
| 36 | + # Send SIGUSR1 directly to the haproxy process |
| 37 | + command: ["/bin/sh", "-c", "kill -SIGUSR1 $(cat /var/run/haproxy.pid)"] |
| 38 | + args: |
| 39 | + # specify the hugconf CRD location, all other params are in configuration file |
| 40 | + - --hugconf-crd=haproxy-unified-gateway/hugconf |
| 41 | + securityContext: |
| 42 | + runAsNonRoot: true |
| 43 | + allowPrivilegeEscalation: false |
| 44 | + runAsUser: 1000 |
| 45 | + runAsGroup: 1000 |
| 46 | + capabilities: |
| 47 | + drop: |
| 48 | + - ALL |
| 49 | + add: |
| 50 | + - NET_BIND_SERVICE |
| 51 | + seccompProfile: |
| 52 | + type: RuntimeDefault |
| 53 | + ports: |
| 54 | + # specify the container ports, it needs to align with gateway configuration |
| 55 | + - name: http |
| 56 | + containerPort: 31080 |
| 57 | + - name: https |
| 58 | + containerPort: 31443 |
| 59 | + # additional container port to specify the stats port |
| 60 | + - name: stat |
| 61 | + containerPort: 31024 |
| 62 | + env: |
| 63 | + # specify the environment variables needed for logs and metrics |
| 64 | + - name: POD_NAME |
| 65 | + valueFrom: |
| 66 | + fieldRef: |
| 67 | + fieldPath: metadata.name |
| 68 | + - name: POD_NAMESPACE |
| 69 | + valueFrom: |
| 70 | + fieldRef: |
| 71 | + fieldPath: metadata.namespace |
| 72 | + - name: POD_IP |
| 73 | + valueFrom: |
| 74 | + fieldRef: |
| 75 | + fieldPath: status.podIP |
| 76 | +--- |
| 77 | +apiVersion: v1 |
| 78 | +kind: Service |
| 79 | +metadata: |
| 80 | + name: haproxy-unified-gateway |
| 81 | + namespace: haproxy-unified-gateway |
| 82 | +spec: |
| 83 | + selector: |
| 84 | + run: haproxy-unified-gateway |
| 85 | + type: NodePort |
| 86 | + ports: |
| 87 | + - name: http |
| 88 | + port: 31080 |
| 89 | + targetPort: 31080 |
| 90 | + # nodePort is needed for NodePort service type |
| 91 | + nodePort: 31080 |
| 92 | + protocol: TCP |
| 93 | + - name: https |
| 94 | + port: 31443 |
| 95 | + targetPort: 31443 |
| 96 | + # nodePort is needed for NodePort service type |
| 97 | + nodePort: 31443 |
| 98 | + protocol: TCP |
| 99 | + - name: stat |
| 100 | + port: 31024 |
| 101 | + targetPort: 31024 |
0 commit comments