mirror of https://github.com/knative/func.git
Use Contour Ingress instead of Kourier (#1752)
* Use Contour Ingress instead of Kourier Contour can be used to expose resources other that ksvc (e.g. PaC controller). Signed-off-by: Matej Vasek <mvasek@redhat.com> * fixup: use defined version of contour Signed-off-by: Matej Vasek <mvasek@redhat.com> * fixup: shellcheck Signed-off-by: Matej Vasek <mvasek@redhat.com> * Use LoadBalancer instead of NodePort in test This makes services available on port 80 on both localhos and in docker network, before these ports differed. Signed-off-by: Matej Vasek <mvasek@redhat.com> --------- Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
parent
a72431bd65
commit
bc39a1aec2
|
|
@ -27,9 +27,11 @@ main() {
|
|||
local kubernetes_version=v1.24.6
|
||||
local knative_serving_version=v1.8.0
|
||||
local knative_eventing_version=v1.8.0
|
||||
local kourier_version=v1.8.0
|
||||
local contour_version=v1.8.0
|
||||
|
||||
# shellcheck disable=SC2155
|
||||
local em=$(tput bold)$(tput setaf 2)
|
||||
# shellcheck disable=SC2155
|
||||
local me=$(tput sgr0)
|
||||
|
||||
echo "${em}Allocating...${me}"
|
||||
|
|
@ -56,10 +58,10 @@ nodes:
|
|||
- role: control-plane
|
||||
image: kindest/node:${kubernetes_version}
|
||||
extraPortMappings:
|
||||
- containerPort: 30080
|
||||
- containerPort: 80
|
||||
hostPort: 80
|
||||
listenAddress: "127.0.0.1"
|
||||
- containerPort: 30443
|
||||
- containerPort: 433
|
||||
hostPort: 443
|
||||
listenAddress: "127.0.0.1"
|
||||
containerdConfigPatches:
|
||||
|
|
@ -110,45 +112,52 @@ dns() {
|
|||
}
|
||||
|
||||
networking() {
|
||||
echo "${em}④ Kourier Networking${me}"
|
||||
echo "${em}④ Contour Ingress${me}"
|
||||
|
||||
# Install Eourier
|
||||
kubectl apply --filename https://github.com/knative/net-kourier/releases/download/knative-$kourier_version/kourier.yaml
|
||||
sleep 5
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n kourier-system --timeout=5m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=5m
|
||||
# Install load balancer
|
||||
kubectl apply -f "https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml"
|
||||
kubectl wait --namespace metallb-system \
|
||||
--for=condition=ready pod \
|
||||
--selector=app=metallb \
|
||||
--timeout=90s
|
||||
|
||||
# Configure Knative to use Kourier
|
||||
kubectl patch configmap/config-network \
|
||||
--namespace knative-serving \
|
||||
--type merge \
|
||||
--patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
|
||||
local kind_addr
|
||||
kind_addr="$(docker container inspect func-control-plane | jq '.[0].NetworkSettings.Networks.kind.IPAddress' -r)"
|
||||
|
||||
# Create NodePort ingress for kourier
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
apiVersion: metallb.io/v1beta1
|
||||
kind: IPAddressPool
|
||||
metadata:
|
||||
name: kourier-ingress
|
||||
namespace: kourier-system
|
||||
labels:
|
||||
networking.knative.dev/ingress-provider: kourier
|
||||
name: example
|
||||
namespace: metallb-system
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: 3scale-kourier-gateway
|
||||
ports:
|
||||
- name: http2
|
||||
nodePort: 30080
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
- name: https
|
||||
nodePort: 30443
|
||||
port: 443
|
||||
targetPort: 8443
|
||||
addresses:
|
||||
- ${kind_addr}-${kind_addr}
|
||||
---
|
||||
apiVersion: metallb.io/v1beta1
|
||||
kind: L2Advertisement
|
||||
metadata:
|
||||
name: empty
|
||||
namespace: metallb-system
|
||||
EOF
|
||||
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n kourier-system --timeout=5m
|
||||
# Install a properly configured Contour.
|
||||
kubectl apply -f "https://github.com/knative/net-contour/releases/download/knative-${contour_version}/contour.yaml"
|
||||
sleep 5
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n contour-external --timeout=5m
|
||||
|
||||
# Install the Knative Contour controller.
|
||||
kubectl apply -f "https://github.com/knative/net-contour/releases/download/knative-${contour_version}/net-contour.yaml"
|
||||
sleep 5
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=5m
|
||||
|
||||
# Configure Knative Serving to use Contour.
|
||||
kubectl patch configmap/config-network \
|
||||
--namespace knative-serving \
|
||||
--type merge \
|
||||
--patch '{"data":{"ingress-class":"contour.ingress.networking.knative.dev"}}'
|
||||
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n contour-external --timeout=5m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=5m
|
||||
}
|
||||
|
||||
|
|
@ -309,6 +318,7 @@ EOF
|
|||
|
||||
|
||||
next_steps() {
|
||||
# shellcheck disable=SC2155
|
||||
local red=$(tput bold)$(tput setaf 1)
|
||||
|
||||
echo "${em}Image Registry${me}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue