Add HAProxy to addons

HAProxy is the most minimal implementation of the Gateway API - can be used in e2e tests

Signed-off-by: Jake Sanders <i@am.so-aweso.me>
This commit is contained in:
Jake Sanders
2021-08-02 14:06:18 +01:00
parent deb9ccc5a9
commit ff41812471
5 changed files with 111 additions and 1 deletions
+1
View File
@@ -12,6 +12,7 @@ filegroup(
"//devel/addon/bind:all-srcs",
"//devel/addon/certmanager:all-srcs",
"//devel/addon/gatewayapi:all-srcs",
"//devel/addon/haproxy:all-srcs",
"//devel/addon/ingressnginx:all-srcs",
"//devel/addon/kyverno:all-srcs",
"//devel/addon/pebble:all-srcs",
+3 -1
View File
@@ -36,7 +36,9 @@ data:
604800 ) ; Negative Cache TTL
@ IN NS localhost.
*.ingress-nginx IN A {SERVICE_IP_PREFIX}.15
ingress-nginx IN A {SERVICE_IP_PREFIX}.15
ingress-nginx IN A {SERVICE_IP_PREFIX}.15
*.haproxy IN A {SERVICE_IP_PREFIX}.14
haproxy IN A {SERVICE_IP_PREFIX}.14
db.dns01.example.com: |
;
+13
View File
@@ -0,0 +1,13 @@
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
+91
View File
@@ -0,0 +1,91 @@
#!/usr/bin/env bash
# Copyright 2020 The cert-manager Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Install HAProxy as a gateway-API e2e test
set -o nounset
set -o errexit
set -o pipefail
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")
source "${SCRIPT_ROOT}/../../lib/lib.sh"
check_tool helm
check_tool kubectl
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
helm repo update
export NAMESPACE="haproxy-ingress"
export VERSION="0.13.0-beta.2"
helm upgrade \
--install \
--wait \
--create-namespace \
--namespace "${NAMESPACE}" \
--version "${VERSION}" \
--set "controller.extraArgs.watch-gateway=true" \
--set "controller.service.type=ClusterIP" \
--set "controller.service.clusterIP=10.0.0.14" \
haproxy-ingress haproxy-ingress/haproxy-ingress
cat <<EOYAML | kubectl apply -f -
apiVersion: networking.x-k8s.io/v1alpha1
kind: GatewayClass
metadata:
name: haproxy-acmesolver
spec:
controller: haproxy-ingress.github.io/controller
EOYAML
cat <<EOYAML | kubectl apply -f -
apiVersion: networking.x-k8s.io/v1alpha1
kind: Gateway
metadata:
name: acmesolver
namespace: haproxy-ingress
spec:
gatewayClassName: haproxy-acmesolver
listeners:
- protocol: HTTP
port: 80
routes:
kind: HTTPRoute
selector:
matchLabels:
acme: solver
namespaces:
from: All
EOYAML
# Example of a cross namespace HTTPRoute
cat <<EOYAML | kubectl apply -f -
apiVersion: networking.x-k8s.io/v1alpha1
kind: HTTPRoute
metadata:
labels:
acme: solver
name: test
namespace: default
spec:
hostnames:
- blah.haproxy.http01.example.com
rules:
- forwardTo:
- serviceName: echoserver
port: 8080
EOYAML
+3
View File
@@ -61,3 +61,6 @@ echo "Loading vault into the cluster..."
echo "Installing sample-external-issuer into the cluster..."
"${SCRIPT_ROOT}/addon/sample-external-issuer/install.sh"
echo "Installing HAProxy into the cluster"
"${SCRIPT_ROOT}/addon/haproxy/install.sh"