From d89ecb83083180746c6eb52425db3ecbc49448bb Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Tue, 23 Apr 2019 22:06:03 +0300 Subject: [PATCH] disable metrics server and fix terraform (#4617) * disable metrics server in centos7-flannel-addons job Change-Id: I1d87923547584896f64dda9ea8feb5581ad48cbe * Fix tf facility->facilities syntax Change-Id: I434bfe53f47e8e4a546890e0b62d24bde6e6d6a7 * Update Terraform CI for facilities * Fix undefined variable error --- .gitlab-ci/terraform.yml | 4 ++-- contrib/terraform/packet/kubespray.tf | 8 ++++---- contrib/terraform/packet/sample-inventory/cluster.tf | 2 +- contrib/terraform/packet/variables.tf | 4 ++-- contrib/terraform/terraform.py | 4 ++-- .../policy_controller/calico/tasks/main.yml | 2 +- tests/files/gce_centos7-flannel-addons.yml | 3 ++- tests/files/packet_centos7-flannel-addons.yml | 3 ++- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci/terraform.yml b/.gitlab-ci/terraform.yml index 6810cfb6d..9f496d325 100644 --- a/.gitlab-ci/terraform.yml +++ b/.gitlab-ci/terraform.yml @@ -72,7 +72,7 @@ tf-packet-ubuntu16-default: TF_VAR_number_of_k8s_nodes: "1" TF_VAR_plan_k8s_masters: t1.small.x86 TF_VAR_plan_k8s_nodes: t1.small.x86 - TF_VAR_facility: "ewr1" + TF_VAR_facilities: '["ewr1"]' TF_VAR_public_key_path: "" TF_VAR_operating_system: ubuntu_16_04 @@ -87,7 +87,7 @@ tf-packet-ubuntu18-default: TF_VAR_number_of_k8s_nodes: "1" TF_VAR_plan_k8s_masters: t1.small.x86 TF_VAR_plan_k8s_nodes: t1.small.x86 - TF_VAR_facility: "ams1" + TF_VAR_facilities: '["ams1"]' TF_VAR_public_key_path: "" TF_VAR_operating_system: ubuntu_18_04 diff --git a/contrib/terraform/packet/kubespray.tf b/contrib/terraform/packet/kubespray.tf index ac48f818a..75b58e927 100644 --- a/contrib/terraform/packet/kubespray.tf +++ b/contrib/terraform/packet/kubespray.tf @@ -13,7 +13,7 @@ resource "packet_device" "k8s_master" { count = "${var.number_of_k8s_masters}" hostname = "${var.cluster_name}-k8s-master-${count.index+1}" plan = "${var.plan_k8s_masters}" - facility = "${var.facility}" + facilities = "${var.facilities}" operating_system = "${var.operating_system}" billing_cycle = "${var.billing_cycle}" project_id = "${var.packet_project_id}" @@ -26,7 +26,7 @@ resource "packet_device" "k8s_master_no_etcd" { count = "${var.number_of_k8s_masters_no_etcd}" hostname = "${var.cluster_name}-k8s-master-${count.index+1}" plan = "${var.plan_k8s_masters_no_etcd}" - facility = "${var.facility}" + facilities = "${var.facilities}" operating_system = "${var.operating_system}" billing_cycle = "${var.billing_cycle}" project_id = "${var.packet_project_id}" @@ -39,7 +39,7 @@ resource "packet_device" "k8s_etcd" { count = "${var.number_of_etcd}" hostname = "${var.cluster_name}-etcd-${count.index+1}" plan = "${var.plan_etcd}" - facility = "${var.facility}" + facilities = "${var.facilities}" operating_system = "${var.operating_system}" billing_cycle = "${var.billing_cycle}" project_id = "${var.packet_project_id}" @@ -52,7 +52,7 @@ resource "packet_device" "k8s_node" { count = "${var.number_of_k8s_nodes}" hostname = "${var.cluster_name}-k8s-node-${count.index+1}" plan = "${var.plan_k8s_nodes}" - facility = "${var.facility}" + facilities = "${var.facilities}" operating_system = "${var.operating_system}" billing_cycle = "${var.billing_cycle}" project_id = "${var.packet_project_id}" diff --git a/contrib/terraform/packet/sample-inventory/cluster.tf b/contrib/terraform/packet/sample-inventory/cluster.tf index 2482194cf..a17b7a696 100644 --- a/contrib/terraform/packet/sample-inventory/cluster.tf +++ b/contrib/terraform/packet/sample-inventory/cluster.tf @@ -10,7 +10,7 @@ packet_project_id = "Example-API-Token" public_key_path = "~/.ssh/id_rsa.pub" # cluster location -facility = "ewr1" +facilities = ["ewr1"] # standalone etcds number_of_etcd = 0 diff --git a/contrib/terraform/packet/variables.tf b/contrib/terraform/packet/variables.tf index e71b78bbf..0d28fee31 100644 --- a/contrib/terraform/packet/variables.tf +++ b/contrib/terraform/packet/variables.tf @@ -19,8 +19,8 @@ variable "billing_cycle" { default = "hourly" } -variable "facility" { - default = "dfw2" +variable "facilities" { + default = ["dfw2"] } variable "plan_k8s_masters" { diff --git a/contrib/terraform/terraform.py b/contrib/terraform/terraform.py index 22f98a314..c4899e9e1 100755 --- a/contrib/terraform/terraform.py +++ b/contrib/terraform/terraform.py @@ -157,7 +157,7 @@ def packet_device(resource, tfvars=None): attrs = { 'id': raw_attrs['id'], - 'facility': raw_attrs['facility'], + 'facilities': parse_list(raw_attrs, 'facilities']), 'hostname': raw_attrs['hostname'], 'operating_system': raw_attrs['operating_system'], 'locked': parse_bool(raw_attrs['locked']), @@ -178,7 +178,7 @@ def packet_device(resource, tfvars=None): } # add groups based on attrs - groups.append('packet_facility=' + attrs['facility']) + groups.append('packet_facilities=' + attrs['facilities']) groups.append('packet_operating_system=' + attrs['operating_system']) groups.append('packet_locked=%s' % attrs['locked']) groups.append('packet_state=' + attrs['state']) diff --git a/roles/kubernetes-apps/policy_controller/calico/tasks/main.yml b/roles/kubernetes-apps/policy_controller/calico/tasks/main.yml index 3dfbf0a37..1f262affa 100644 --- a/roles/kubernetes-apps/policy_controller/calico/tasks/main.yml +++ b/roles/kubernetes-apps/policy_controller/calico/tasks/main.yml @@ -36,4 +36,4 @@ - inventory_hostname == groups['kube-master'][0] - not item is skipped loop_control: - label: "{{ item.item.file }}" \ No newline at end of file + label: "{{ item.item.file }}" diff --git a/tests/files/gce_centos7-flannel-addons.yml b/tests/files/gce_centos7-flannel-addons.yml index 7a2cfb640..d430d8436 100644 --- a/tests/files/gce_centos7-flannel-addons.yml +++ b/tests/files/gce_centos7-flannel-addons.yml @@ -20,7 +20,8 @@ cloud_provider: gce kube_encrypt_secret_data: true # ingress_nginx_enabled: true cert_manager_enabled: true -metrics_server_enabled: true +# Disabled temporarily +metrics_server_enabled: false kube_token_auth: true kube_basic_auth: true enable_nodelocaldns: false diff --git a/tests/files/packet_centos7-flannel-addons.yml b/tests/files/packet_centos7-flannel-addons.yml index fd75df3da..451f414e8 100644 --- a/tests/files/packet_centos7-flannel-addons.yml +++ b/tests/files/packet_centos7-flannel-addons.yml @@ -17,7 +17,8 @@ dns_min_replicas: 1 kube_encrypt_secret_data: true ingress_nginx_enabled: true cert_manager_enabled: true -metrics_server_enabled: true +# Disabled temporarily +metrics_server_enabled: false kube_token_auth: true kube_basic_auth: true enable_nodelocaldns: false