Skip to content

Commit

Permalink
Add zk-stack Route53 zone and HTTP => HTTPS redirect (#14)
Browse files Browse the repository at this point in the history
* Add zk-stack R53 zone

* Add HTTP => HTTPS redirect

* Fix module references
  • Loading branch information
klaus993 authored Aug 15, 2024
1 parent d04cc0e commit 0f7e070
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 6 deletions.
8 changes: 8 additions & 0 deletions infra/kubernetes/frontendconfigs/http-https-redirect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
metadata:
name: http-https-redirect
spec:
redirectToHttps:
enabled: true
responseCodeName: PERMANENT_REDIRECT
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/en-grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: en01-grafana-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: en01-grafana
spec:
Expand Down
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/explorer-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: explorer-api-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: explorer-api
spec:
Expand Down
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/explorer-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: explorer-app-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: explorer-app
spec:
Expand Down
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/external-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: external-node-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: external-node
spec:
Expand Down
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: grafana-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: grafana
spec:
Expand Down
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/portal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: portal-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: portal
spec:
Expand Down
1 change: 1 addition & 0 deletions infra/kubernetes/ingress/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
kubernetes.io/ingress.global-static-ip-name: server-ip
cert-manager.io/issuer: http01-issuer
acme.cert-manager.io/http01-edit-in-place: "true"
networking.gke.io/v1beta1.FrontendConfig: "http-https-redirect"
labels:
app: server
spec:
Expand Down
8 changes: 7 additions & 1 deletion infra/terraform/dev/us-central1/gke/ip.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Public IPs
resource "google_compute_global_address" "explorer-app" {
name = "explorer-app-ip"
}
Expand Down Expand Up @@ -82,8 +83,13 @@ data "google_compute_global_address" "en-grafana" {
]
}

# DNS
resource "aws_route53_zone" "zk-stack" {
name = "zk-stack.lambdaclass.com"
}

data "aws_route53_zone" "zk-stack-lambdaclass-com" {
name = "${var.aws_dns_zone}."
zone_id = aws_route53_zone.zk-stack.zone_id
}

resource "aws_route53_record" "k8s-explorer-sepolia" {
Expand Down
2 changes: 1 addition & 1 deletion infra/terraform/modules/zk_stack/gke.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module "zk-stack-stack-gke-cluster" {
module "zk-stack-gke-cluster" {
source = "terraform-google-modules/kubernetes-engine/google//modules/beta-public-cluster"
version = "31.1.0"
project_id = var.project_id
Expand Down
8 changes: 4 additions & 4 deletions infra/terraform/modules/zk_stack/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ terraform {
}

provider "kubernetes" {
host = "https://${module.zk-stack-stack-gke-cluster.endpoint}"
host = "https://${module.zk-stack-gke-cluster.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.zk-stack-stack-gke-cluster.ca_certificate)
cluster_ca_certificate = base64decode(module.zk-stack-gke-cluster.ca_certificate)
}

provider "helm" {
kubernetes {
host = "https://${module.zk-stack-stack-gke-cluster.endpoint}"
host = "https://${module.zk-stack-gke-cluster.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.zk-stack-stack-gke-cluster.ca_certificate)
cluster_ca_certificate = base64decode(module.zk-stack-gke-cluster.ca_certificate)
}
}

Expand Down

0 comments on commit 0f7e070

Please sign in to comment.