Skip to content

Commit

Permalink
Allow Gateway listeners[].port and spec.infrastructure configuration …
Browse files Browse the repository at this point in the history
…via values
  • Loading branch information
pbusko authored and danail-branekov committed Oct 12, 2024
1 parent 20bc069 commit 2d3e21c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
10 changes: 7 additions & 3 deletions helm/korifi/templates/gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ metadata:
namespace: {{ .Release.Namespace }}-gateway
spec:
gatewayClassName: {{ .Values.networking.gatewayClass }}
{{- if .Values.networking.gatewayInfrastructure }}
infrastructure:
{{- .Values.networking.gatewayInfrastructure | toYaml | nindent 4 }}
{{- end }}
listeners:
- allowedRoutes:
namespaces:
from: All
name: http-apps
port: 80
port: {{ .Values.networking.gatewayPorts.http }}
protocol: HTTP
- allowedRoutes:
namespaces:
from: All
hostname: {{ .Values.api.apiServer.url }}
name: https-api
port: 443
port: {{ .Values.networking.gatewayPorts.https }}
protocol: TLS
tls:
mode: Passthrough
Expand All @@ -46,7 +50,7 @@ spec:
from: All
hostname: "*.{{ .Values.defaultAppDomainName }}"
name: https-apps
port: 443
port: {{ .Values.networking.gatewayPorts.https }}
protocol: HTTPS
tls:
certificateRefs:
Expand Down
20 changes: 20 additions & 0 deletions helm/korifi/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,26 @@
"gatewayClass": {
"description": "The name of the GatewayClass Korifi Gateway references",
"type": "string"
},
"gatewayPorts": {
"description": "Ports for the Gateway listeners",
"type": "object",
"properties": {
"http": {
"description": "HTTP port",
"type": "integer",
"default": 80
},
"https": {
"description": "HTTPS port",
"type": "integer",
"default": 443
}
}
},
"gatewayInfrastructure": {
"description": "GatewayInfrastructure property of the Gateway, see https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.GatewayInfrastructure for contents",
"type": ["object", "null"]
}
},
"required": ["gatewayClass"]
Expand Down
4 changes: 4 additions & 0 deletions helm/korifi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ helm:
hooksImage: alpine/k8s:1.25.2

networking:
gatewayPorts:
http: 80
https: 443
gatewayInfrastructure:
gatewayClass:

experimental:
Expand Down
6 changes: 2 additions & 4 deletions scripts/deploy-on-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ function install_dependencies() {
}

function configure_contour() {
kubectl -n korifi-gateway patch gateway korifi --type='json' -p='[{"op": "replace", "path": "/spec/listeners/0/port", "value":32080}]'
kubectl -n korifi-gateway patch gateway korifi --type='json' -p='[{"op": "replace", "path": "/spec/listeners/1/port", "value":32443}]'
kubectl -n korifi-gateway patch gateway korifi --type='json' -p='[{"op": "replace", "path": "/spec/listeners/2/port", "value":32443}]'

kubectl apply -f - <<EOF
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1beta1
Expand Down Expand Up @@ -207,6 +203,8 @@ function deploy_korifi() {
--set=kpackImageBuilder.clusterStackRunImage="paketobuildpacks/run-jammy-base" \
--set=kpackImageBuilder.builderRepository="$KPACK_BUILDER_REPOSITORY" \
--set=networking.gatewayClass="contour" \
--set=networking.gatewayPorts.http="32080" \
--set=networking.gatewayPorts.https="32443" \
--set=experimental.managedServices.include="true" \
--set=experimental.managedServices.trustInsecureBrokers="true" \
--wait
Expand Down
6 changes: 2 additions & 4 deletions scripts/installer/install-korifi-kind.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,14 @@ spec:
--set=kpackImageBuilder.clusterStackRunImage="paketobuildpacks/run-jammy-base" \
--set=kpackImageBuilder.builderRepository="localregistry-docker-registry.default.svc.cluster.local:30050/kpack-builder" \
--set=networking.gatewayClass="contour" \
--set=networking.gatewayPorts.http="32080" \
--set=networking.gatewayPorts.https="32443" \
--set=experimental.managedServices.include="true" \
--set=experimental.managedServices.trustInsecureBrokers="true" \
--wait
kubectl wait --for=condition=ready clusterbuilder --all=true --timeout=15m
kubectl -n korifi-gateway patch gateway korifi --type='json' -p='[{"op": "replace", "path": "/spec/listeners/0/port", "value":32080}]'
kubectl -n korifi-gateway patch gateway korifi --type='json' -p='[{"op": "replace", "path": "/spec/listeners/1/port", "value":32443}]'
kubectl -n korifi-gateway patch gateway korifi --type='json' -p='[{"op": "replace", "path": "/spec/listeners/2/port", "value":32443}]'
kubectl apply -f - <<EOF
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1beta1
Expand Down

0 comments on commit 2d3e21c

Please sign in to comment.