diff --git a/docs/source/installation/configuration.md b/docs/source/installation/configuration.md index 9668fa36a..589239b22 100644 --- a/docs/source/installation/configuration.md +++ b/docs/source/installation/configuration.md @@ -690,6 +690,36 @@ jupyterhub: users: true ``` +## Terraform Overrides + +The QHub configuration file provides a huge number of configuration options for customizing your +QHub Infrastructure, while these options are sufficient for an average user, but aren't +exhaustive by any means. There are still a plenty of things you might want to achieve which +cannot be configured directly by the above mentioned options, hence we have introduced a +new option called terraform overrides (`terraform_overrides`), which lets you override +the values of terraform variables in specific modules/resource. This is a relatively +advance feature and must be used with utmost care and you should really know, what +you're doing. + +Here we describe the overrides supported via QHub config file: + +### Ingress + +You can configure the IP of the load balancer and add annotations for the same via `ingress`'s +terraform overrides, one such example for GCP is: + + +```yaml +ingress: + terraform_overrides: + load_balancer_annotations: + "networking.gke.io/load-balancer-type": "Internal" + "networking.gke.io/internal-load-balancer-subnet": "pre-existing-subnet" + load_balancer_ip: "1.2.3.4" +``` + +This is quite useful for pinning the IP Address of the load balancer. + # Full configuration example ```yaml diff --git a/qhub/schema.py b/qhub/schema.py index 535f62efa..b6aa8f374 100644 --- a/qhub/schema.py +++ b/qhub/schema.py @@ -464,7 +464,7 @@ class Main(Base): prevent_deploy: bool = ( False # Optional, but will be given default value if not present ) - ingress: Ingress + ingress: typing.Optional[Ingress] # If the qhub_version in the schema is old # we must tell the user to first run qhub upgrade diff --git a/qhub/stages/input_vars.py b/qhub/stages/input_vars.py index 36771fbfb..cc12e477f 100644 --- a/qhub/stages/input_vars.py +++ b/qhub/stages/input_vars.py @@ -150,7 +150,9 @@ def stage_04_kubernetes_ingress(stage_outputs, config): "acme-email": config["certificate"].get("acme_email"), "acme-server": config["certificate"].get("acme_server"), "certificate-secret-name": config["certificate"]["secret_name"], - "load-balancer-annotations": config["ingress"]["terraform_overrides"]["load_balancer_annotations"], + "load-balancer-annotations": config["ingress"]["terraform_overrides"][ + "load_balancer_annotations" + ], "load-balancer-ip": config["ingress"]["terraform_overrides"]["load-balancer-ip"] if config["certificate"]["type"] == "existing" else None,