Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: install GatewayClass separately as a shared resource for all namespaces #360

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions charts/hedera-network/templates/gateway-api/gateway.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
{{- if $.Values.gatewayApi.gatewayClass.enable | eq "true" }}
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: {{ $.Values.gatewayApi.gatewayClass.name }}
namespace: {{ default $.Release.Namespace $.Values.global.namespaceOverride }}
labels:
fullstack.hedera.com/type: gateway-class
spec:
controllerName: {{ $.Values.gatewayApi.gatewayClass.controllerName }}
{{- end }}
{{- if $.Values.gatewayApi.gateway.enable | eq "true" }}
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
Expand Down
5 changes: 1 addition & 4 deletions charts/hedera-network/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ tester:
# gateway-api configuration
gatewayApi:
gatewayClass:
name: "fst"
enable: "true"
controllerName: "gateway.envoyproxy.io/gatewayclass-controller"
# controllerName: "haproxy-ingress.github.io/controller"
name: "fst-gateway-class"
gateway:
name: "fst"
enable: "true"
Expand Down
15 changes: 8 additions & 7 deletions dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,21 @@ uninstall-chart:
update-helm-dependencies:
helm dependency update ../charts/hedera-network

.PHONY: deploy-common
deploy-common: update-helm-dependencies deploy-gateway-api deploy-prometheus-operator deploy-minio-operator-if-required

.PHONY: destroy-common
destroy-common: destroy-gateway-api destroy-prometheus-operator undeploy-minio-operator

.PHONY: deploy-chart
deploy-chart:
$(MAKE) update-helm-dependencies
$(MAKE) deploy-minio-operator-if-required
$(MAKE) deploy-prometheus-operator
$(MAKE) deploy-gateway-api
$(MAKE) deploy-common
$(MAKE) install-chart

.PHONY: destroy-chart
destroy-chart:
-$(MAKE) uninstall-chart
-$(MAKE) destroy-gateway-api
-$(MAKE) destroy-prometheus-operator
-$(MAKE) undeploy-minio-operator
-$(MAKE) destroy-common

.PHONY: deploy-network
deploy-network: deploy-chart
Expand Down
9 changes: 9 additions & 0 deletions dev/common-resources/fst-gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: gateway.networking.k8s.io/v1beta1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this to a separate helm chart and not hide it in the dev tools. This will be necessary for all cluster deployments including automatic cluster setup my the infrastructure library.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I am working on another branch that was created from this branch. I'll convert into a separate chart and update the setup script and values.yaml accordingly as a separate PR to avoid conflicts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a ticket #361

kind: GatewayClass
metadata:
name: fst-gateway-class
labels:
fullstack.hedera.com/type: gateway-class
spec:
controllerName: "gateway.envoyproxy.io/gatewayclass-controller"
#controllerName: "haproxy-ingress.github.io/controller"
2 changes: 2 additions & 0 deletions dev/scripts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ readonly CHART_DIR="${SCRIPT_DIR}/../../charts/hedera-network"


# telemetry related env variables
readonly COMMON_RESOURCES="${SCRIPT_DIR}/../common-resources"
readonly GATEWAY_CLASS_NAME="fst-gateway-class"
readonly GATEWAY_API_DIR="${SCRIPT_DIR}/../gateway-api"
readonly TELEMETRY_DIR="${SCRIPT_DIR}/../telemetry"
readonly PROMETHEUS_DIR="${TELEMETRY_DIR}/prometheus"
Expand Down
46 changes: 40 additions & 6 deletions dev/scripts/gateway.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,33 @@ function deploy_gateway_api_crd() {
fi
}

function deploy_fst_gateway_class() {
echo ""
echo "Installing FST Gateway Class: ${GATEWAY_CLASS_NAME}"
echo "-----------------------------------------------------------------------------------------------------"
local fst_gateway_class_type=$(kubectl get gc "${GATEWAY_CLASS_NAME}" -o jsonpath='{.metadata.labels.fullstack\.hedera\.com\/type}')
if [[ ! "${fst_gateway_class_type}" = "gateway-class" ]]; then
kubectl create -f "${COMMON_RESOURCES}/fst-gateway.yaml"
kubectl wait --for=condition=Accepted gc "${GATEWAY_CLASS_NAME}" --timeout=300s
else
echo "FST Gateway Class '${GATEWAY_CLASS_NAME}' is already installed"
echo ""
fi
}

function destroy_fst_gateway_class() {
echo ""
echo "Uninstalling FST Gateway Class: ${GATEWAY_CLASS_NAME}"
echo "-----------------------------------------------------------------------------------------------------"
local fst_gateway_class_type=$(kubectl get gc "${GATEWAY_CLASS_NAME}" -o jsonpath='{.metadata.labels.fullstack\.hedera\.com\/type}')
if [[ ! "${fst_gateway_class_type}" = "gateway-class" ]]; then
kubectl delete -f "${COMMON_RESOURCES}/fst-gateway.yaml"
sleep 2s
fi
echo "FST Gateway Class '${GATEWAY_CLASS_NAME}' is uninstalled"
echo ""
}

function deploy_envoy_gateway_api() {
echo ""
echo "Installing Envoy Gateway API"
Expand All @@ -79,22 +106,27 @@ function deploy_envoy_gateway_api() {
echo "Envoy Gateway API is already installed"
echo ""
fi

deploy_fst_gateway_class

get_gateway_status
}

function get_gateway_status() {
echo ""
helm list --all-namespaces | grep envoy-gateway
echo "-----------------------------------------------------------------------------------------------------"
echo "-----------------------Gateway CRDs------------------------------------------------------------------------------"
kubectl get crd
echo "-----------------------------------------------------------------------------------------------------"
echo "-----------------------Gateway Class------------------------------------------------------------------------------"
kubectl get gatewayclass
echo "-----------------------------------------------------------------------------------------------------"
echo "-----------------------Gateway------------------------------------------------------------------------------"
kubectl get gateway
echo "-----------------------------------------------------------------------------------------------------"
echo "-----------------------HTTPRoute------------------------------------------------------------------------------"
kubectl get httproute
echo "-----------------------------------------------------------------------------------------------------"
echo "-----------------------GRPCRoute------------------------------------------------------------------------------"
kubectl get grpcroute
echo "-----------------------------------------------------------------------------------------------------"
echo "-----------------------TCPRoute------------------------------------------------------------------------------"
kubectl get tcproute
}

function destroy_envoy_gateway_api() {
Expand All @@ -103,6 +135,8 @@ function destroy_envoy_gateway_api() {
echo "-----------------------------------------------------------------------------------------------------"
get_gateway_status

destroy_fst_gateway_class

# Uninstall helm chart
local helm_chart=$(helm list --all-namespaces | grep envoy-gateway)
if [[ "${helm_chart}" ]]; then
Expand Down