Skip to content

Commit

Permalink
Fix dynamic inventory parsing in contrib/tf/packet (kubernetes-sigs#4645
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Miouge1 authored and k8s-ci-robot committed Apr 25, 2019
1 parent f5a83ce commit 696d481
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
6 changes: 4 additions & 2 deletions .gitlab-ci/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
extends: .terraform_install
stage: deploy-part2
when: manual
variables:
ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
script:
- terraform apply -auto-approve ../../contrib/terraform/$PROVIDER
- ansible-playbook -i hosts ../../cluster.yml --become
Expand Down Expand Up @@ -73,7 +75,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_facilities: '["ewr1"]'
TF_VAR_facility: ewr1
TF_VAR_public_key_path: ""
TF_VAR_operating_system: ubuntu_16_04

Expand All @@ -88,7 +90,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_facilities: '["ams1"]'
TF_VAR_facility: ams1
TF_VAR_public_key_path: ""
TF_VAR_operating_system: ubuntu_18_04

Expand Down
8 changes: 4 additions & 4 deletions contrib/terraform/packet/kubespray.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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}"
facilities = "${var.facilities}"
facilities = ["${var.facility}"]
operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}"
Expand All @@ -28,7 +28,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}"
facilities = "${var.facilities}"
facilities = ["${var.facility}"]
operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}"
Expand All @@ -41,7 +41,7 @@ resource "packet_device" "k8s_etcd" {
count = "${var.number_of_etcd}"
hostname = "${var.cluster_name}-etcd-${count.index+1}"
plan = "${var.plan_etcd}"
facilities = "${var.facilities}"
facilities = ["${var.facility}"]
operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}"
Expand All @@ -54,7 +54,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}"
facilities = "${var.facilities}"
facilities = ["${var.facility}"]
operating_system = "${var.operating_system}"
billing_cycle = "${var.billing_cycle}"
project_id = "${var.packet_project_id}"
Expand Down
2 changes: 1 addition & 1 deletion contrib/terraform/packet/sample-inventory/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packet_project_id = "Example-API-Token"
public_key_path = "~/.ssh/id_rsa.pub"

# cluster location
facilities = ["ewr1"]
facility = "ewr1"

# standalone etcds
number_of_etcd = 0
Expand Down
4 changes: 2 additions & 2 deletions contrib/terraform/packet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ variable "billing_cycle" {
default = "hourly"
}

variable "facilities" {
default = ["dfw2"]
variable "facility" {
default = "dfw2"
}

variable "plan_k8s_masters" {
Expand Down
1 change: 0 additions & 1 deletion contrib/terraform/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def packet_device(resource, tfvars=None):
}

# add groups based on attrs
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'])
Expand Down

0 comments on commit 696d481

Please sign in to comment.