From c749c277e4f0ab308e143502c470b7d0690c7820 Mon Sep 17 00:00:00 2001 From: Wulf Thimm <12035025+wulfthimm@users.noreply.github.com> Date: Fri, 18 Dec 2020 14:43:49 +0100 Subject: [PATCH] [terraform] updated gcp terraform scripts (#2556) --- chart/values.yaml | 4 +- install/gcp-full-terraform/.gitignore | 1 - install/gcp-full-terraform/Makefile | 19 -- .../gcp-full-terraform/default.auto.tfvars | 4 - install/gcp-full-terraform/main.tf | 192 ------------- .../gcp-full-terraform/modules/dns/main.tf | 54 ---- .../gcp-full-terraform/modules/dns/outputs.tf | 20 -- .../modules/dns/variables.tf | 29 -- .../gcp-full-terraform/modules/gitpod/main.tf | 63 ----- .../gitpod/templates/node-affinity.tpl | 23 -- .../modules/gitpod/templates/node-layout.tpl | 15 - .../modules/gitpod/templates/values.tpl | 10 - .../modules/gitpod/variables.tf | 58 ---- .../gcp-full-terraform/modules/https/main.tf | 186 ------------- .../modules/https/output.tf | 12 - .../templates/cert-manager_certificate.tpl | 15 - .../modules/https/templates/values.tpl | 9 - .../modules/kubernetes/README.md | 1 - .../modules/kubernetes/locals.tf | 18 -- .../modules/kubernetes/main.tf | 196 ------------- .../modules/kubernetes/outputs.tf | 20 -- .../kubernetes/templates/kubeconfig.tpl | 20 -- .../modules/kubernetes/variables.tf | 96 ------- .../modules/monitoring/main.tf | 17 -- .../modules/mysql_gcp/README.md | 3 - .../modules/mysql_gcp/locals.tf | 26 -- .../modules/mysql_gcp/main.tf | 259 ------------------ .../modules/mysql_gcp/outputs.tf | 16 -- .../modules/mysql_gcp/templates/values.tpl | 16 -- .../modules/mysql_gcp/variables.tf | 96 ------- .../modules/mysql_helm/main.tf | 138 ---------- .../modules/mysql_helm/templates/values.tpl | 16 -- .../modules/mysql_helm/variables.tf | 46 ---- .../modules/network/README.md | 1 - .../modules/network/main.tf | 58 ---- .../modules/network/outputs.tf | 20 -- .../modules/network/variables.tf | 33 --- .../modules/registry/README.md | 1 - .../modules/registry/main.tf | 130 --------- .../modules/registry/outputs.tf | 16 -- .../registry/templates/registry-auth.tpl | 7 - .../modules/registry/templates/values.tpl | 17 -- .../modules/storage/locals.tf | 11 - .../modules/storage/main.tf | 135 --------- .../modules/storage/outputs.tf | 16 -- .../modules/storage/templates/values.tpl | 33 --- .../modules/storage/variables.tf | 78 ------ install/gcp-full-terraform/outputs.tf | 36 --- install/gcp-full-terraform/provider.tf | 54 ---- .../gcp-full-terraform/templates/values.tpl | 64 ----- install/gcp-terraform/BUILD.yaml | 30 -- .../gcp-terraform/environment/full/.gitignore | 3 + .../environment/full}/README.md | 0 .../gcp-terraform/environment/full/main.tf | 131 +++++++++ .../environment/full/providers.tf | 37 +++ .../environment/full/values.yaml | 11 + .../environment/full}/variables.tf | 31 ++- .../environment/full/versions.tf | 23 ++ .../{ => environment/installer}/.gitignore | 0 .../environment/installer}/BUILD.yaml | 4 +- .../installer}/main.auto.tfvars | 0 .../environment/installer/main.tf | 88 ++++++ .../environment/installer/modules | 1 + .../{ => environment/installer}/outputs.tf | 6 +- .../environment/installer/providers.tf | 28 ++ .../installer/templates/values.tpl | 18 ++ .../{ => environment/installer}/variables.tf | 3 +- install/gcp-terraform/main.tf | 82 ------ install/gcp-terraform/modules/BUILD.yaml | 24 ++ .../gcp-terraform/modules/certmanager/main.tf | 122 +++++++++ .../locals.tf => certmanager/outputs.tf} | 6 +- .../certmanager/templates/certificate.tpl | 18 ++ .../certmanager/templates/clusterissuer.tpl} | 15 +- .../modules/certmanager/templates/values.tpl | 5 + .../modules/certmanager}/variables.tf | 37 +-- .../modules/certmanager/versions.tf | 21 ++ .../gcp-terraform/modules/database/README.md | 10 + .../gcp-terraform/modules/database/main.tf | 227 +++++++++++++++ .../modules/database/outputs.tf} | 9 +- .../modules/database/templates/values.tpl | 20 ++ .../modules/database/variables.tf | 40 +++ .../modules/dns/README.md | 0 install/gcp-terraform/modules/dns/locals.tf | 3 + install/gcp-terraform/modules/dns/main.tf | 88 ++++++ install/gcp-terraform/modules/dns/outputs.tf | 20 ++ .../modules/dns/templates/values.tpl | 13 + .../modules/dns}/variables.tf | 25 +- install/gcp-terraform/modules/dns/versions.tf | 16 ++ install/gcp-terraform/modules/gitpod/main.tf | 47 ++++ .../templates/values.node-layout.tpl} | 5 +- .../modules/gitpod/templates/values.tpl | 7 + .../gcp-terraform/modules/gitpod/variables.tf | 61 +++++ install/gcp-terraform/modules/helm/main.tf | 82 ------ .../modules/helm/templates/node-affinity.tpl | 23 -- .../modules/helm/templates/values.tpl | 13 - .../gcp-terraform/modules/helm/variables.tf | 66 ----- .../gcp-terraform/modules/kubeconfig/main.tf | 33 +++ .../modules/kubeconfig/outputs.tf} | 5 +- .../kubeconfig/templates/kubeconfig.tpl | 26 ++ .../modules/kubeconfig/terraform.tf} | 19 +- .../modules/kubeconfig/variables.tf} | 13 +- .../modules/kubernetes/README.md | 18 ++ .../modules/kubernetes/locals.tf | 18 -- .../gcp-terraform/modules/kubernetes/main.tf | 181 ++++++------ .../modules/kubernetes/outputs.tf | 9 +- .../kubernetes/templates/kubeconfig.tpl | 20 -- .../modules/kubernetes/variables.tf | 61 +---- .../gcp-terraform/modules/monitoring/main.tf | 17 -- install/gcp-terraform/modules/network/main.tf | 43 --- .../gcp-terraform/modules/network/outputs.tf | 17 -- .../modules/network/variables.tf | 19 -- .../modules/registry}/README.md | 0 .../gcp-terraform/modules/registry/main.tf | 91 +++--- .../gcp-terraform/modules/registry/outputs.tf | 10 +- .../registry/templates/registry-auth.tpl | 2 +- .../modules/registry/templates/values.tpl | 10 +- .../modules/registry/variables.tf | 15 +- .../modules/storage/README.md | 0 .../gcp-terraform/modules/storage/locals.tf | 11 - install/gcp-terraform/modules/storage/main.tf | 91 ++---- .../gcp-terraform/modules/storage/outputs.tf | 6 +- .../modules/storage/templates/values.tpl | 68 +++-- .../modules/storage/variables.tf | 25 +- install/gcp-terraform/provider.tf | 54 ---- install/gcp-terraform/templates/values.tpl | 0 install/installer/BUILD.yaml | 3 +- install/installer/dev-layout.yaml | 2 +- install/installer/leeway.Dockerfile | 3 +- 128 files changed, 1489 insertions(+), 3328 deletions(-) delete mode 100644 install/gcp-full-terraform/.gitignore delete mode 100644 install/gcp-full-terraform/Makefile delete mode 100644 install/gcp-full-terraform/default.auto.tfvars delete mode 100644 install/gcp-full-terraform/main.tf delete mode 100644 install/gcp-full-terraform/modules/dns/main.tf delete mode 100644 install/gcp-full-terraform/modules/dns/outputs.tf delete mode 100644 install/gcp-full-terraform/modules/dns/variables.tf delete mode 100644 install/gcp-full-terraform/modules/gitpod/main.tf delete mode 100644 install/gcp-full-terraform/modules/gitpod/templates/node-affinity.tpl delete mode 100644 install/gcp-full-terraform/modules/gitpod/templates/node-layout.tpl delete mode 100644 install/gcp-full-terraform/modules/gitpod/templates/values.tpl delete mode 100644 install/gcp-full-terraform/modules/gitpod/variables.tf delete mode 100644 install/gcp-full-terraform/modules/https/main.tf delete mode 100644 install/gcp-full-terraform/modules/https/output.tf delete mode 100644 install/gcp-full-terraform/modules/https/templates/cert-manager_certificate.tpl delete mode 100644 install/gcp-full-terraform/modules/https/templates/values.tpl delete mode 100644 install/gcp-full-terraform/modules/kubernetes/README.md delete mode 100644 install/gcp-full-terraform/modules/kubernetes/locals.tf delete mode 100644 install/gcp-full-terraform/modules/kubernetes/main.tf delete mode 100644 install/gcp-full-terraform/modules/kubernetes/outputs.tf delete mode 100644 install/gcp-full-terraform/modules/kubernetes/templates/kubeconfig.tpl delete mode 100644 install/gcp-full-terraform/modules/kubernetes/variables.tf delete mode 100644 install/gcp-full-terraform/modules/monitoring/main.tf delete mode 100644 install/gcp-full-terraform/modules/mysql_gcp/README.md delete mode 100644 install/gcp-full-terraform/modules/mysql_gcp/locals.tf delete mode 100644 install/gcp-full-terraform/modules/mysql_gcp/main.tf delete mode 100644 install/gcp-full-terraform/modules/mysql_gcp/outputs.tf delete mode 100644 install/gcp-full-terraform/modules/mysql_gcp/templates/values.tpl delete mode 100644 install/gcp-full-terraform/modules/mysql_gcp/variables.tf delete mode 100644 install/gcp-full-terraform/modules/mysql_helm/main.tf delete mode 100644 install/gcp-full-terraform/modules/mysql_helm/templates/values.tpl delete mode 100644 install/gcp-full-terraform/modules/mysql_helm/variables.tf delete mode 100644 install/gcp-full-terraform/modules/network/README.md delete mode 100644 install/gcp-full-terraform/modules/network/main.tf delete mode 100644 install/gcp-full-terraform/modules/network/outputs.tf delete mode 100644 install/gcp-full-terraform/modules/network/variables.tf delete mode 100644 install/gcp-full-terraform/modules/registry/README.md delete mode 100644 install/gcp-full-terraform/modules/registry/main.tf delete mode 100644 install/gcp-full-terraform/modules/registry/outputs.tf delete mode 100644 install/gcp-full-terraform/modules/registry/templates/registry-auth.tpl delete mode 100644 install/gcp-full-terraform/modules/registry/templates/values.tpl delete mode 100644 install/gcp-full-terraform/modules/storage/locals.tf delete mode 100644 install/gcp-full-terraform/modules/storage/main.tf delete mode 100644 install/gcp-full-terraform/modules/storage/outputs.tf delete mode 100644 install/gcp-full-terraform/modules/storage/templates/values.tpl delete mode 100644 install/gcp-full-terraform/modules/storage/variables.tf delete mode 100644 install/gcp-full-terraform/outputs.tf delete mode 100644 install/gcp-full-terraform/provider.tf delete mode 100644 install/gcp-full-terraform/templates/values.tpl delete mode 100644 install/gcp-terraform/BUILD.yaml create mode 100644 install/gcp-terraform/environment/full/.gitignore rename install/{gcp-full-terraform => gcp-terraform/environment/full}/README.md (100%) create mode 100644 install/gcp-terraform/environment/full/main.tf create mode 100644 install/gcp-terraform/environment/full/providers.tf create mode 100644 install/gcp-terraform/environment/full/values.yaml rename install/{gcp-full-terraform => gcp-terraform/environment/full}/variables.tf (67%) create mode 100644 install/gcp-terraform/environment/full/versions.tf rename install/gcp-terraform/{ => environment/installer}/.gitignore (100%) rename install/{gcp-full-terraform => gcp-terraform/environment/installer}/BUILD.yaml (93%) rename install/gcp-terraform/{ => environment/installer}/main.auto.tfvars (100%) create mode 100644 install/gcp-terraform/environment/installer/main.tf create mode 120000 install/gcp-terraform/environment/installer/modules rename install/gcp-terraform/{ => environment/installer}/outputs.tf (65%) create mode 100644 install/gcp-terraform/environment/installer/providers.tf create mode 100644 install/gcp-terraform/environment/installer/templates/values.tpl rename install/gcp-terraform/{ => environment/installer}/variables.tf (93%) delete mode 100644 install/gcp-terraform/main.tf create mode 100644 install/gcp-terraform/modules/BUILD.yaml create mode 100644 install/gcp-terraform/modules/certmanager/main.tf rename install/gcp-terraform/modules/{monitoring/locals.tf => certmanager/outputs.tf} (70%) create mode 100644 install/gcp-terraform/modules/certmanager/templates/certificate.tpl rename install/{gcp-full-terraform/modules/https/templates/cert-manager_cluster-issuer.tpl => gcp-terraform/modules/certmanager/templates/clusterissuer.tpl} (52%) create mode 100644 install/gcp-terraform/modules/certmanager/templates/values.tpl rename install/{gcp-full-terraform/modules/https => gcp-terraform/modules/certmanager}/variables.tf (54%) create mode 100644 install/gcp-terraform/modules/certmanager/versions.tf create mode 100644 install/gcp-terraform/modules/database/README.md create mode 100644 install/gcp-terraform/modules/database/main.tf rename install/{gcp-full-terraform/modules/registry/locals.tf => gcp-terraform/modules/database/outputs.tf} (68%) create mode 100644 install/gcp-terraform/modules/database/templates/values.tpl create mode 100644 install/gcp-terraform/modules/database/variables.tf rename install/{gcp-full-terraform => gcp-terraform}/modules/dns/README.md (100%) create mode 100644 install/gcp-terraform/modules/dns/locals.tf create mode 100644 install/gcp-terraform/modules/dns/main.tf create mode 100644 install/gcp-terraform/modules/dns/outputs.tf create mode 100644 install/gcp-terraform/modules/dns/templates/values.tpl rename install/{gcp-full-terraform/modules/registry => gcp-terraform/modules/dns}/variables.tf (66%) create mode 100644 install/gcp-terraform/modules/dns/versions.tf create mode 100644 install/gcp-terraform/modules/gitpod/main.tf rename install/gcp-terraform/modules/{helm/templates/node-layout.tpl => gitpod/templates/values.node-layout.tpl} (85%) create mode 100644 install/gcp-terraform/modules/gitpod/templates/values.tpl create mode 100644 install/gcp-terraform/modules/gitpod/variables.tf delete mode 100644 install/gcp-terraform/modules/helm/main.tf delete mode 100644 install/gcp-terraform/modules/helm/templates/node-affinity.tpl delete mode 100644 install/gcp-terraform/modules/helm/templates/values.tpl delete mode 100644 install/gcp-terraform/modules/helm/variables.tf create mode 100644 install/gcp-terraform/modules/kubeconfig/main.tf rename install/{gcp-full-terraform/modules/dns/locals.tf => gcp-terraform/modules/kubeconfig/outputs.tf} (74%) create mode 100644 install/gcp-terraform/modules/kubeconfig/templates/kubeconfig.tpl rename install/{gcp-full-terraform/modules/mysql_helm/outputs.tf => gcp-terraform/modules/kubeconfig/terraform.tf} (51%) rename install/{gcp-full-terraform/modules/monitoring/locals.tf => gcp-terraform/modules/kubeconfig/variables.tf} (66%) create mode 100644 install/gcp-terraform/modules/kubernetes/README.md delete mode 100644 install/gcp-terraform/modules/kubernetes/locals.tf delete mode 100644 install/gcp-terraform/modules/kubernetes/templates/kubeconfig.tpl delete mode 100644 install/gcp-terraform/modules/monitoring/main.tf delete mode 100644 install/gcp-terraform/modules/network/main.tf delete mode 100644 install/gcp-terraform/modules/network/outputs.tf delete mode 100644 install/gcp-terraform/modules/network/variables.tf rename install/{gcp-full-terraform/modules/monitoring => gcp-terraform/modules/registry}/README.md (100%) rename install/{gcp-full-terraform => gcp-terraform}/modules/storage/README.md (100%) delete mode 100644 install/gcp-terraform/modules/storage/locals.tf delete mode 100644 install/gcp-terraform/provider.tf delete mode 100644 install/gcp-terraform/templates/values.tpl diff --git a/chart/values.yaml b/chart/values.yaml index 211c819693b971..f3ef4ec72f3898 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -311,11 +311,11 @@ components: http: expose: true containerPort: 80 - nodePort: 31080 + # nodePort: 31080 https: expose: true containerPort: 443 - nodePort: 31443 + # nodePort: 31443 loadBalancerIP: null serviceType: "LoadBalancer" serviceSessionAffinity: "None" diff --git a/install/gcp-full-terraform/.gitignore b/install/gcp-full-terraform/.gitignore deleted file mode 100644 index 0696b3ebc1b70e..00000000000000 --- a/install/gcp-full-terraform/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.terraform \ No newline at end of file diff --git a/install/gcp-full-terraform/Makefile b/install/gcp-full-terraform/Makefile deleted file mode 100644 index 2848fa3e5ecf23..00000000000000 --- a/install/gcp-full-terraform/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -.PHONY: init -init: - terraform init - -.PHONY: refresh -refresh: init - terraform refresh - -.PHONY: test -test: refresh - terraform plan - -.PHONY: install -install: test - terraform apply --auto-approve - -.PHONY: uninstall -uninstall: refresh - terraform destroy --auto-approve \ No newline at end of file diff --git a/install/gcp-full-terraform/default.auto.tfvars b/install/gcp-full-terraform/default.auto.tfvars deleted file mode 100644 index 1b34dee59677fe..00000000000000 --- a/install/gcp-full-terraform/default.auto.tfvars +++ /dev/null @@ -1,4 +0,0 @@ -container_registry = { - location = "EU" -} -certificate_email = "certificates@your-domain.com" diff --git a/install/gcp-full-terraform/main.tf b/install/gcp-full-terraform/main.tf deleted file mode 100644 index 45da1b5c53cefd..00000000000000 --- a/install/gcp-full-terraform/main.tf +++ /dev/null @@ -1,192 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - -# 1st stage of deployment, no dependencies - -# -# Network -# - -module "network" { - source = "./modules/network" - - project = var.project - region = var.region - name = "vpc-gitpod" -} - - - -# -# DNS -# - -module "dns" { - source = "./modules/dns" - - project = var.project - region = var.region - dns_name = var.dns_name - -} - - - - - -# 2nd stage of deployment, dependent on networking - -# -# Kubernetes -# - -module "kubernetes" { - source = "./modules/kubernetes" - - name = "gitpod-cluster" - project = var.project - location = var.region - network = module.network.vpc.name - subnets = module.network.subnets.*.self_link - - requirements = { - network = module.network.done - } - -} - - - - - -# 3rd stage of deployment, dependent on kubernetes at least - -# -# Registry -# - -module "registry" { - source = "./modules/registry" - - project = var.project - location = var.container_registry.location - # https://cloud.google.com/container-registry/docs/pushing-and-pulling#pushing_an_image_to_a_registry - hostname = "eu.gcr.io" - - requirements = { - kubernetes = module.kubernetes.done - } -} - - - -# -# Storage -# - -module "storage" { - source = "./modules/storage" - - project = var.project - region = var.region - location = "EU" - - requirements = { - kubernetes = module.kubernetes.done - } -} - - - -# -# Database -# - -module "database" { - source = "./modules/mysql_gcp" - - project = var.project - region = var.region - network = { - id = module.network.vpc.id - name = module.network.vpc.name - } - subnets = module.network.subnets.*.name - requirements = { - kubernetes = module.kubernetes.done - } -} - - - -# -# HTTPS -# - -module "https" { - source = "./modules/https" - - certificate_email = var.certificate_email - dns_name = module.dns.zone.dns_name - project = var.project - gitpod = { - namespace = var.kubernetes.namespace - } - kubeconfig = module.kubernetes.kubeconfig - - requirements = { - kubernetes = module.kubernetes.done - dns = module.dns.done - } -} - - -# -# Gitpod -# - -# https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file -data "template_file" "gitpod_values" { - template = file("${path.root}/templates/values.tpl") - vars = { - - } -} - - - -module "gitpod" { - source = "./modules/gitpod" - - project = var.project - region = var.region - kubernetes = { - namespace = var.kubernetes.namespace - } - hostname = module.dns.zone.dns_name - loadBalancerIP = module.dns.static_ip - path = "${path.root}/../../chart" - values = [ - data.template_file.gitpod_values.rendered, - module.database.values, - module.storage.values, - module.registry.values, - module.https.values, - ] - - gitpod = { - license = var.license - } - - requirements = [ - module.network.done, - module.kubernetes.done, - module.database.done, - module.storage.done, - module.registry.done, - module.dns.done, - module.https.done, - ] -} diff --git a/install/gcp-full-terraform/modules/dns/main.tf b/install/gcp-full-terraform/modules/dns/main.tf deleted file mode 100644 index a5a36fc17c23ec..00000000000000 --- a/install/gcp-full-terraform/modules/dns/main.tf +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - - -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_managed_zone -resource "google_dns_managed_zone" "gitpod" { - name = replace(trimsuffix(var.dns_name, ".-"), ".", "-") - dns_name = "${trimsuffix(var.dns_name, ".-")}." -} - - - -# -# Static IP -# - -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_address -resource "google_compute_address" "gitpod" { - name = "gitpod-static-ip" - - project = var.project - region = var.region -} - - - -# -# DNS records -# - -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_record_set -resource "google_dns_record_set" "gitpod" { - count = length(local.dns_prefixes) - name = "${local.dns_prefixes[count.index]}${google_dns_managed_zone.gitpod.dns_name}" - type = "A" - ttl = 300 - managed_zone = google_dns_managed_zone.gitpod.name - rrdatas = [google_compute_address.gitpod.address] - project = var.project -} - - - -# -# End -# - -resource "null_resource" "done" { - depends_on = [ - google_dns_record_set.gitpod - ] -} diff --git a/install/gcp-full-terraform/modules/dns/outputs.tf b/install/gcp-full-terraform/modules/dns/outputs.tf deleted file mode 100644 index c1398067109f84..00000000000000 --- a/install/gcp-full-terraform/modules/dns/outputs.tf +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - -# -# -# - -output "zone" { - value = google_dns_managed_zone.gitpod -} - -output "static_ip" { - value = google_compute_address.gitpod.address -} - -output "done" { - value = null_resource.done.id -} diff --git a/install/gcp-full-terraform/modules/dns/variables.tf b/install/gcp-full-terraform/modules/dns/variables.tf deleted file mode 100644 index 6771c3c6a0e75b..00000000000000 --- a/install/gcp-full-terraform/modules/dns/variables.tf +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - -# -# Project -# - -variable "project" { - type = string - default = "gitpod" -} - - -# -# Region -# -variable "region" { - type = string -} - -# -# DNS Name -# - -variable "dns_name" { - type = string -} diff --git a/install/gcp-full-terraform/modules/gitpod/main.tf b/install/gcp-full-terraform/modules/gitpod/main.tf deleted file mode 100644 index 31676199d4e9fc..00000000000000 --- a/install/gcp-full-terraform/modules/gitpod/main.tf +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - - - - -data "template_file" "gitpod_values_node_affinity" { - template = file("${path.module}/templates/node-affinity.tpl") -} - -data "template_file" "gitpod_values_node_layout" { - template = file("${path.module}/templates/node-layout.tpl") -} - - -resource "helm_release" "gitpod" { - name = "gitpod-self-hosted" - chart = var.path - - namespace = var.kubernetes.namespace - create_namespace = true - - timeout = "60" - - wait = false - - values = var.values - - - set { - name = "hostname" - value = trimsuffix(var.hostname, ".") - } - - set { - name = "components.proxy.loadBalancerIP" - value = var.loadBalancerIP - } - - set { - name = "installPodSecurityPolicies" - value = "true" - } - - depends_on = [ - var.requirements - ] - -} - - - -# -# End -# - -resource "null_resource" "done" { - depends_on = [ - helm_release.gitpod - ] -} diff --git a/install/gcp-full-terraform/modules/gitpod/templates/node-affinity.tpl b/install/gcp-full-terraform/modules/gitpod/templates/node-affinity.tpl deleted file mode 100644 index b81bbee1cef76b..00000000000000 --- a/install/gcp-full-terraform/modules/gitpod/templates/node-affinity.tpl +++ /dev/null @@ -1,23 +0,0 @@ -affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: gitpod.io/workload_meta - operator: In - values: - - "true" - -components: - workspace: - template: - spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: gitpod.io/workload_workspace - operator: In - values: - - "true" \ No newline at end of file diff --git a/install/gcp-full-terraform/modules/gitpod/templates/node-layout.tpl b/install/gcp-full-terraform/modules/gitpod/templates/node-layout.tpl deleted file mode 100644 index a56c9b86b7b05f..00000000000000 --- a/install/gcp-full-terraform/modules/gitpod/templates/node-layout.tpl +++ /dev/null @@ -1,15 +0,0 @@ -components: - nodeDaemon: - # Gitpod copies Theia to each node. This setting configures where Theia is copied to. - # We'll copy Theia to $theiaHostBasePath/theia/theia-$version - # The faster this location is (in terms of IO) the faster nodes will become available and the faster workspaces will start. - theiaHostBasePath: /mnt/disks/ssd0 - imageBuilder: - # The image builder deploys a Docker-in-Docker-daemon. By default that Docker daemon works in an empty-dir on the node. - # Depending on the types of node you operate that may cause image builds to fail or not perform well. We recommend you give the Docker daemon - # fast storage on the node, e.g. an SSD. - hostDindData: /mnt/disks/ssd0/docker - wsDaemon: - # Workspace data is stored on the nodes. This setting configures where on the ndoe the workspace data lives. - # The faster this location is (in terms of IO) the faster workspaces will initialize. - hostWorkspaceArea: /mnt/disks/ssd0/workspaces diff --git a/install/gcp-full-terraform/modules/gitpod/templates/values.tpl b/install/gcp-full-terraform/modules/gitpod/templates/values.tpl deleted file mode 100644 index 67a6119f255bee..00000000000000 --- a/install/gcp-full-terraform/modules/gitpod/templates/values.tpl +++ /dev/null @@ -1,10 +0,0 @@ -# -# Terraform Module: gitpod -# - -hostname: ${hostname} -components: - proxy: - loadBalancerIP: ${loadBalancerIP} - -installPodSecurityPolicies: true diff --git a/install/gcp-full-terraform/modules/gitpod/variables.tf b/install/gcp-full-terraform/modules/gitpod/variables.tf deleted file mode 100644 index 798b38d9aaa4c4..00000000000000 --- a/install/gcp-full-terraform/modules/gitpod/variables.tf +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - -variable "project" { - type = string -} - - - -variable "region" { - type = string -} - - -variable "kubernetes" { - type = object({ - namespace = string - }) - default = { - namespace = "gitpod" - } -} - -variable "hostname" { - type = string -} - -variable "loadBalancerIP" { - type = string -} - -variable "path" { - type = string -} - - -# -# Gitpod values -# - -variable "values" { - type = list(string) -} - -variable "requirements" { - type = list(string) -} - -variable "gitpod" { - type = object({ - license = string - }) - default = { - license = "" - } -} \ No newline at end of file diff --git a/install/gcp-full-terraform/modules/https/main.tf b/install/gcp-full-terraform/modules/https/main.tf deleted file mode 100644 index 2b02647eddee4c..00000000000000 --- a/install/gcp-full-terraform/modules/https/main.tf +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) 2020 TypeFox GmbH. All rights reserved. - * Licensed under the MIT License. See License-MIT.txt in the project root for license information. - */ - -# -# GCP Resources -# - -# https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id -resource "random_id" "cert_manager" { - byte_length = 1 -} - -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account -resource "google_service_account" "cert_manager" { - account_id = "cert-manager-${random_id.cert_manager.hex}" - display_name = "${var.project} Cert-Manager" - description = "${var.project} Cert-Manager Account" - project = var.project -} - -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_project_iam#google_project_iam_member -resource "google_project_iam_member" "project" { - project = var.project - role = "roles/dns.admin" - member = "serviceAccount:${google_service_account.cert_manager.email}" -} - -# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_key -resource "google_service_account_key" "cert_manager" { - service_account_id = google_service_account.cert_manager.name -} - - -# -# Kubernetes Resources -# - -# https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release -resource "helm_release" "cert_manager" { - name = var.cert_manager.name - chart = var.cert_manager.chart - repository = var.cert_manager.repository - - namespace = var.cert_manager.namespace - create_namespace = true - - wait = true - - set { - name = "installCRDs" - value = "true" - } - - depends_on = [ - var.requirements - ] - -} - -# https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret -resource "kubernetes_secret" "cert_manager" { - metadata { - name = "clouddns-dns01-solver-svc-acct" - namespace = var.cert_manager.namespace - } - - data = { - "key.json" = base64decode(google_service_account_key.cert_manager.private_key) - } - - depends_on = [ - helm_release.cert_manager - ] - -} - -# https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password -resource "random_password" "cert_manager_secret" { - length = 32 - special = false -} - - -# https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep -resource "time_sleep" "cert_manager" { - create_duration = "300s" - depends_on = [ - helm_release.cert_manager - ] -} - - -# -# Cluster Issuer -# - -# https://registry.terraform.io/providers/hashicorp/template/latest/docs/data-sources/file -data "template_file" "cluster_issuer" { - template = file("${path.module}/templates/cert-manager_cluster-issuer.tpl") - vars = { - email = var.certificate_email - project = var.project - } -} - -# https://registry.terraform.io/providers/mildred/null/latest/docs/resources/null_resource -resource "null_resource" "cert_manager_cluster_issuer" { - - provisioner "local-exec" { - command = "KUBECONFIG=${path.root}/secrets/kubeconfig kubectl apply --validate=false -f -< version && \ rm yq -COPY install-gcp-terraform--lib terraform/gcp +COPY install-gcp-terraform-environment-installer--lib terraform/gcp +COPY install-gcp-terraform-modules--installer terraform/gcp/modules COPY install-aws-terraform--lib terraform/aws RUN echo "chart_location = \"../helm/gitpod\"" >> installer.auto.tfvars && \ echo "image_prefix = \"$IMAGE_PREFIX/\"" >> installer.auto.tfvars && \