Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Created May 3, 2021 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haproxytechblog/343ab8f71290fcc5dc64a276b3411610 to your computer and use it in GitHub Desktop.
Save haproxytechblog/343ab8f71290fcc5dc64a276b3411610 to your computer and use it in GitHub Desktop.
Announcing HAProxy Kubernetes Ingress Controller 1.6
backend-config-snippet: |
http-request deny if !{ src 127.0.0.1 10.0.0.0/8 1.2.3.4/24 }
backend-config-snippet: |
http-request set-header Exp-Date 1619481600 if !{ hdr(Key) Katotosh6Rae }
http-request set-header Exp-Date 1619568000 if !{ hdr(Key) laeP2oweu0ri }
http-request set-header Exp-Date 1619654400 if !{ hdr(Key) Xaib0ovao3ae }
$ cat /tmp/ips.acl
127.0.0.1
10.0.0.0/8
1.2.3.4/24
$ cat /tmp/keys.map
Katotosh6Rae 1619481600
laeP2oweu0ri 1619568000
Xaib0ovao3ae 1619654400
$ kubectl create -n default configmap staging-patterns \
--from-file=/tmp/ips.acl \
--from-file=/tmp/keys.map
configmap/staging-patterns created
apiVersion: v1
kind: ConfigMap
metadata:
name: staging-patterns
namespace: default
data:
ips.acl: |
127.0.0.1
10.0.0.0/8
1.2.3.4/24
keys.map: |
Katotosh6Rae 1619481600
laeP2oweu0ri 1619568000
Xaib0ovao3ae 1619654400
$ helm install kubernetes-ingress haproxytech/kubernetes-ingress \
--set-string "controller.extraArgs={--configmap-patternfiles=default/staging-patterns}"
backend-config-snippet: |
http-request deny if !{ src -f patterns/ips.acl }
backend-config-snippet: |
http-request set-header Exp-Date hdr(key),map(patterns/keys.map)
resolvers mydns
nameserver local 127.0.0.1:53
nameserver google 8.8.8.8:53
$ kubectl create configmap haproxy-aux-cfg \
--from-file ./haproxy-aux.cfg
configmap/haproxy-aux-cfg created
containers:
- name: haproxy-ingress
image: haproxytech/kubernetes-ingress:latest
volumeMounts:
- name: haproxy-cfg-vol
mountPath: /etc/haproxy/haproxy-aux.cfg
volumes:
- name: haproxy-cfg-vol
configMap:
name: haproxy-aux-cfg
backend-config-snippet: default-server init-addr none resolvers mydns
request-set-header: client-cn %[ssl_c_s_dn(CN)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment