Fix dynamic inventory parsing in contrib/tf/packet (#4645)

pull/4652/head
Maxime Guyot 2019-04-25 09:40:46 +02:00 committed by Kubernetes Prow Robot
parent f5a83ceded
commit 696d481e3b
5 changed files with 11 additions and 10 deletions

View File

@ -33,6 +33,8 @@
extends: .terraform_install extends: .terraform_install
stage: deploy-part2 stage: deploy-part2
when: manual when: manual
variables:
ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
script: script:
- terraform apply -auto-approve ../../contrib/terraform/$PROVIDER - terraform apply -auto-approve ../../contrib/terraform/$PROVIDER
- ansible-playbook -i hosts ../../cluster.yml --become - ansible-playbook -i hosts ../../cluster.yml --become
@ -73,7 +75,7 @@ tf-packet-ubuntu16-default:
TF_VAR_number_of_k8s_nodes: "1" TF_VAR_number_of_k8s_nodes: "1"
TF_VAR_plan_k8s_masters: t1.small.x86 TF_VAR_plan_k8s_masters: t1.small.x86
TF_VAR_plan_k8s_nodes: t1.small.x86 TF_VAR_plan_k8s_nodes: t1.small.x86
TF_VAR_facilities: '["ewr1"]' TF_VAR_facility: ewr1
TF_VAR_public_key_path: "" TF_VAR_public_key_path: ""
TF_VAR_operating_system: ubuntu_16_04 TF_VAR_operating_system: ubuntu_16_04
@ -88,7 +90,7 @@ tf-packet-ubuntu18-default:
TF_VAR_number_of_k8s_nodes: "1" TF_VAR_number_of_k8s_nodes: "1"
TF_VAR_plan_k8s_masters: t1.small.x86 TF_VAR_plan_k8s_masters: t1.small.x86
TF_VAR_plan_k8s_nodes: t1.small.x86 TF_VAR_plan_k8s_nodes: t1.small.x86
TF_VAR_facilities: '["ams1"]' TF_VAR_facility: ams1
TF_VAR_public_key_path: "" TF_VAR_public_key_path: ""
TF_VAR_operating_system: ubuntu_18_04 TF_VAR_operating_system: ubuntu_18_04

View File

@ -15,7 +15,7 @@ resource "packet_device" "k8s_master" {
count = "${var.number_of_k8s_masters}" count = "${var.number_of_k8s_masters}"
hostname = "${var.cluster_name}-k8s-master-${count.index+1}" hostname = "${var.cluster_name}-k8s-master-${count.index+1}"
plan = "${var.plan_k8s_masters}" plan = "${var.plan_k8s_masters}"
facilities = "${var.facilities}" facilities = ["${var.facility}"]
operating_system = "${var.operating_system}" operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}" billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}" project_id = "${var.packet_project_id}"
@ -28,7 +28,7 @@ resource "packet_device" "k8s_master_no_etcd" {
count = "${var.number_of_k8s_masters_no_etcd}" count = "${var.number_of_k8s_masters_no_etcd}"
hostname = "${var.cluster_name}-k8s-master-${count.index+1}" hostname = "${var.cluster_name}-k8s-master-${count.index+1}"
plan = "${var.plan_k8s_masters_no_etcd}" plan = "${var.plan_k8s_masters_no_etcd}"
facilities = "${var.facilities}" facilities = ["${var.facility}"]
operating_system = "${var.operating_system}" operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}" billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}" project_id = "${var.packet_project_id}"
@ -41,7 +41,7 @@ resource "packet_device" "k8s_etcd" {
count = "${var.number_of_etcd}" count = "${var.number_of_etcd}"
hostname = "${var.cluster_name}-etcd-${count.index+1}" hostname = "${var.cluster_name}-etcd-${count.index+1}"
plan = "${var.plan_etcd}" plan = "${var.plan_etcd}"
facilities = "${var.facilities}" facilities = ["${var.facility}"]
operating_system = "${var.operating_system}" operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}" billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}" project_id = "${var.packet_project_id}"
@ -54,7 +54,7 @@ resource "packet_device" "k8s_node" {
count = "${var.number_of_k8s_nodes}" count = "${var.number_of_k8s_nodes}"
hostname = "${var.cluster_name}-k8s-node-${count.index+1}" hostname = "${var.cluster_name}-k8s-node-${count.index+1}"
plan = "${var.plan_k8s_nodes}" plan = "${var.plan_k8s_nodes}"
facilities = "${var.facilities}" facilities = ["${var.facility}"]
operating_system = "${var.operating_system}" operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}" billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}" project_id = "${var.packet_project_id}"

View File

@ -10,7 +10,7 @@ packet_project_id = "Example-API-Token"
public_key_path = "~/.ssh/id_rsa.pub" public_key_path = "~/.ssh/id_rsa.pub"
# cluster location # cluster location
facilities = ["ewr1"] facility = "ewr1"
# standalone etcds # standalone etcds
number_of_etcd = 0 number_of_etcd = 0

View File

@ -19,8 +19,8 @@ variable "billing_cycle" {
default = "hourly" default = "hourly"
} }
variable "facilities" { variable "facility" {
default = ["dfw2"] default = "dfw2"
} }
variable "plan_k8s_masters" { variable "plan_k8s_masters" {

View File

@ -178,7 +178,6 @@ def packet_device(resource, tfvars=None):
} }
# add groups based on attrs # add groups based on attrs
groups.append('packet_facilities=' + attrs['facilities'])
groups.append('packet_operating_system=' + attrs['operating_system']) groups.append('packet_operating_system=' + attrs['operating_system'])
groups.append('packet_locked=%s' % attrs['locked']) groups.append('packet_locked=%s' % attrs['locked'])
groups.append('packet_state=' + attrs['state']) groups.append('packet_state=' + attrs['state'])