Skip to content
This repository was archived by the owner on Feb 5, 2020. It is now read-only.
Merged
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
1 change: 0 additions & 1 deletion Documentation/variables/gcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ This document gives an overview of variables used in the Google Cloud platform o
| tectonic_gcp_worker_disk_size | The size of the disk in gigabytes for the root block device of worker nodes. | string | `30` |
| tectonic_gcp_worker_disktype | The type of disk (pd-standard or pd-ssd) for the worker nodes. | string | `pd-standard` |
| tectonic_gcp_worker_gce_type | Instance size for the worker node(s). Example: `n1-standard-2`. | string | `n1-standard-2` |
| tectonic_gcp_zones | List of two or more zones to use from specified GCP region. | list | - |

11 changes: 11 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
creds = [
file(credentialsId: 'tectonic-license', variable: 'TF_VAR_tectonic_license_path'),
file(credentialsId: 'tectonic-pull', variable: 'TF_VAR_tectonic_pull_secret_path'),
file(credentialsId: 'GCP-APPLICATION', variable: 'GOOGLE_APPLICATION_CREDENTIALS'),
[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'tectonic-jenkins-installer'
Expand Down Expand Up @@ -72,6 +73,11 @@ pipeline {
defaultValue: true,
description: ''
)
booleanParam(
name: 'PLATFORM/GCP',
defaultValue: true,
description: ''
)
booleanParam(
name: 'PLATFORM/BARE_METAL',
defaultValue: true,
Expand Down Expand Up @@ -197,6 +203,7 @@ pipeline {
GRAFITI_DELETER_ROLE = 'grafiti-deleter'
TF_VAR_tectonic_container_images = "${params.hyperkube_image}"
TF_VAR_tectonic_container_linux_version = "${params.container_linux_version}"
GOOGLE_PROJECT = "tectonic-installer"
}
steps {
script {
Expand Down Expand Up @@ -226,6 +233,10 @@ pipeline {
builds['azure_example'] = runRSpecTest('spec/azure_example_spec.rb', '')
}

if (params."PLATFORM/GCP") {
builds['gcp'] = runRSpecTest('spec/gcp_spec.rb', '')
}

if (params."PLATFORM/BARE_METAL") {
builds['bare_metal'] = {
node('worker && bare-metal') {
Expand Down
3 changes: 0 additions & 3 deletions examples/terraform.tfvars.gcp
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ tectonic_gcp_worker_disktype = "pd-standard"
// Instance size for the worker node(s). Example: `n1-standard-2`.
tectonic_gcp_worker_gce_type = "n1-standard-2"

// List of two or more zones to use from specified GCP region.
tectonic_gcp_zones = ""

// The path to the tectonic licence file.
// You can download the Tectonic license file from your Account overview page at [1].
//
Expand Down
23 changes: 5 additions & 18 deletions modules/gcp/master-igm/ignition.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
data "ignition_config" "main" {
files = [
"${data.ignition_file.kubeconfig.id}",
"${var.ign_max_user_watches_id}",
"${var.ign_gcs_puller_id}",
"${data.ignition_file.init_assets.id}",
"${var.ign_installer_kubelet_env_id}",
]

Expand All @@ -11,31 +10,19 @@ data "ignition_config" "main" {
var.ign_locksmithd_service_id,
var.ign_kubelet_service_id,
var.ign_k8s_node_bootstrap_service_id,
var.ign_init_assets_service_id,
var.ign_bootkube_service_id,
var.ign_tectonic_service_id,
var.ign_bootkube_path_unit_id,
var.ign_tectonic_path_unit_id
))}"]
}

data "template_file" "init_assets" {
template = "${file("${path.module}/resources/init-assets.sh")}"

vars {
cluster_name = "${var.cluster_name}"
assets_gcs_location = "${var.assets_gcs_location}"
kubelet_image_url = "${replace(var.container_images["hyperkube"],var.image_re,"$1")}"
kubelet_image_tag = "${replace(var.container_images["hyperkube"],var.image_re,"$2")}"
}
}

data "ignition_file" "init_assets" {
data "ignition_file" "kubeconfig" {
filesystem = "root"
path = "/opt/init-assets.sh"
mode = 0755
path = "/etc/kubernetes/kubeconfig"
mode = 0644

content {
content = "${data.template_file.init_assets.rendered}"
content = "${var.kubeconfig_content}"
}
}
15 changes: 10 additions & 5 deletions modules/gcp/master-igm/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ resource "google_compute_instance_template" "master-it" {
}
}

resource "google_compute_instance_group_manager" "master-igm" {
count = "${var.instance_count}"
target_size = 1
resource "google_compute_region_instance_group_manager" "master-igm" {
count = 1
region = "${var.region}"
target_size = "${var.instance_count}"
name = "${var.cluster_name}-master-igm-${count.index}"
zone = "${element(var.zone_list, count.index)}"
instance_template = "${google_compute_instance_template.master-it.self_link}"
target_pools = ["${var.master_targetpool_self_link}"]
base_instance_name = "mstr"
base_instance_name = "${var.cluster_name}-master"

named_port {
name = "https"
port = 443
}
}
2 changes: 1 addition & 1 deletion modules/gcp/master-igm/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ limitations under the License.
*/

output "instance_group" {
value = ["${google_compute_instance_group_manager.master-igm.*.instance_group}"]
value = ["${google_compute_region_instance_group_manager.master-igm.*.instance_group}"]
}
19 changes: 0 additions & 19 deletions modules/gcp/master-igm/resources/init-assets.sh

This file was deleted.

21 changes: 4 additions & 17 deletions modules/gcp/master-igm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ variable "region" {
type = "string"
}

variable "zone_list" {
type = "list"
}

variable "machine_type" {
type = "string"
}
Expand Down Expand Up @@ -74,19 +70,6 @@ variable "ign_tectonic_path_unit_id" {
type = "string"
}

variable "ign_gcs_puller_id" {
type = "string"
}

variable "ign_init_assets_service_id" {
type = "string"
}

variable "assets_gcs_location" {
type = "string"
description = "Location on gcs of the Bootkube/Tectonic assets to use (bucket/key)"
}

variable "container_images" {
description = "Container images to use"
type = "map"
Expand All @@ -100,3 +83,7 @@ variable "image_re" {
variable "public_ssh_key" {
default = ""
}

variable "kubeconfig_content" {
type = "string"
}
49 changes: 46 additions & 3 deletions modules/gcp/network/loadbalancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,57 @@ resource "google_compute_http_health_check" "worker-hc" {
check_interval_sec = 1
}

resource "google_compute_address" "masters-ip" {
// api-server/masters lb
// We need to use a global lb for bootstraping
// because of https://issuetracker.google.com/issues/67366622
resource "google_compute_global_address" "masters-ip" {
name = "${var.cluster_name}-masters-ip"
}

resource "google_compute_global_forwarding_rule" "api-external-fwd-rule" {
name = "${var.cluster_name}-api-external-fwd-rule"
target = "${google_compute_target_tcp_proxy.api-external-tcp-proxy.self_link}"
ip_address = "${google_compute_global_address.masters-ip.address}"
port_range = "443"
}

resource "google_compute_target_tcp_proxy" "api-external-tcp-proxy" {
name = "${var.cluster_name}-api-external-tcp-proxy"
backend_service = "${google_compute_backend_service.api-backend-service.self_link}"
}

resource "google_compute_backend_service" "api-backend-service" {
name = "${var.cluster_name}-api-backend-service"
protocol = "TCP"
port_name = "https"
timeout_sec = 10
session_affinity = "NONE"

backend {
group = "${var.master_instance_group[0]}"
}

health_checks = ["${google_compute_health_check.api-health-check.self_link}"]
}

resource "google_compute_health_check" "api-health-check" {
name = "${var.cluster_name}-api-health-check"
timeout_sec = 1
check_interval_sec = 1

ssl_health_check {
port = "443"
}
}

resource "google_compute_address" "ssh-masters-ip" {
name = "${var.cluster_name}-masters-ip"
}

resource "google_compute_forwarding_rule" "api-external-fwd-rule" {
load_balancing_scheme = "EXTERNAL"
name = "${var.cluster_name}-api-external-fwd-rule"
ip_address = "${google_compute_address.masters-ip.address}"
ip_address = "${google_compute_address.ssh-masters-ip.address}"
region = "${var.gcp_region}"
target = "${google_compute_target_pool.master-targetpool.self_link}"
port_range = "443"
Expand All @@ -39,7 +82,7 @@ resource "google_compute_address" "ingress-ip" {
resource "google_compute_forwarding_rule" "api-external-ssh-fwd-rule" {
load_balancing_scheme = "EXTERNAL"
name = "${var.cluster_name}-api-external-ssh-fwd-rule"
ip_address = "${google_compute_address.masters-ip.address}"
ip_address = "${google_compute_address.ssh-masters-ip.address}"
region = "${var.gcp_region}"
target = "${google_compute_target_pool.master-targetpool.self_link}"
port_range = "22"
Expand Down
6 changes: 5 additions & 1 deletion modules/gcp/network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ limitations under the License.
*/

output "master_ip" {
value = "${google_compute_address.masters-ip.address}"
value = "${google_compute_global_address.masters-ip.address}"
}

output "ssh_master_ip" {
value = "${google_compute_address.ssh-masters-ip.address}"
}

output "ingress_ip" {
Expand Down
12 changes: 11 additions & 1 deletion modules/gcp/worker-igm/ignition.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data "ignition_config" "main" {
files = [
"${data.ignition_file.kubeconfig.id}",
"${var.ign_max_user_watches_id}",
"${var.ign_gcs_puller_id}",
"${var.ign_installer_kubelet_env_id}",
]

Expand All @@ -12,3 +12,13 @@ data "ignition_config" "main" {
"${var.ign_kubelet_service_id}",
]
}

data "ignition_file" "kubeconfig" {
filesystem = "root"
path = "/etc/kubernetes/kubeconfig"
mode = 0644

content {
content = "${var.kubeconfig_content}"
}
}
12 changes: 4 additions & 8 deletions modules/gcp/worker-igm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ variable "region" {
type = "string"
}

variable "zone_list" {
type = "list"
}

variable "machine_type" {
type = "string"
}
Expand All @@ -56,10 +52,10 @@ variable "disk_size" {
description = "The size of the volume in gigabytes for the root block device."
}

variable "ign_gcs_puller_id" {
type = "string"
}

variable "public_ssh_key" {
default = ""
}

variable "kubeconfig_content" {
type = "string"
}
10 changes: 5 additions & 5 deletions modules/gcp/worker-igm/worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ resource "google_compute_instance_template" "worker-it" {
}
}

resource "google_compute_instance_group_manager" "worker-igm" {
count = "${var.instance_count}"
target_size = 1
resource "google_compute_region_instance_group_manager" "worker-igm" {
count = 1
region = "${var.region}"
target_size = "${var.instance_count}"
name = "${var.cluster_name}-worker-igm-${count.index}"
zone = "${element(var.zone_list, count.index)}"
instance_template = "${google_compute_instance_template.worker-it.self_link}"
target_pools = ["${var.worker_targetpool_self_link}"]
base_instance_name = "wrkr"
base_instance_name = "${var.cluster_name}-worker"
}
14 changes: 0 additions & 14 deletions modules/ignition/assets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,6 @@ data "ignition_file" "s3_puller" {
}
}

data "template_file" "gcs_puller" {
template = "${file("${path.module}/resources/bin/gcs-puller.sh")}"
}

data "ignition_file" "gcs_puller" {
filesystem = "root"
path = "/opt/gcs-puller.sh"
mode = 0755

content {
content = "${data.template_file.gcs_puller.rendered}"
}
}

data "ignition_systemd_unit" "locksmithd" {
name = "locksmithd.service"
mask = true
Expand Down
8 changes: 0 additions & 8 deletions modules/ignition/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ output "s3_puller_rendered" {
value = "${data.template_file.s3_puller.rendered}"
}

output "gcs_puller_id" {
value = "${data.ignition_file.gcs_puller.id}"
}

output "gcs_puller_rendered" {
value = "${data.template_file.gcs_puller.rendered}"
}

output "locksmithd_service_id" {
value = "${data.ignition_systemd_unit.locksmithd.id}"
}
Expand Down
17 changes: 0 additions & 17 deletions modules/ignition/resources/bin/gcs-puller.sh

This file was deleted.

Loading