Skip to content

Commit d941c02

Browse files
committed
configure static ip for master VMs
before we got the loadbalancer working, we need to set master VMs with static ip with a ip pool starting from 192.168.1.101. then set NAT at VMC, it statically link public ip with 192.168.1.101 and expose the public ip as apiserver endpoint.
1 parent e505965 commit d941c02

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

master_templates-v1.10.0/master.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ storage:
280280
inline: |
281281
${ dns_dhcp }
282282
283+
283284
passwd:
284285
users:
285286
- name: core

vsphere/input.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ variable "cluster_domain" { default = "cluster.local" }
4747
variable "pod_cidr" { default = "100.96.0.0/11" }
4848
variable "service_cidr" { default = "100.64.0.0/13" }
4949
variable "non_masquerade_cidr" { default = "100.64.0.0/10" }
50-
variable "dns_service_ip" { default = "100.64.0.10" }
50+
variable "dns_service_ip" { default = "18.236.33.106" }
5151

5252
# Deployment Artifact Versions
5353
variable "etcd_artifact" { default = "https://storage.googleapis.com/etcd/v3.2.8/etcd-v3.2.8-linux-amd64.tar.gz" }

vsphere/modules/master/data_sources.tf

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ data "template_file" "virtual_machine_network_content" {
3535

3636
vars = {
3737
address = "${cidrhost(var.virtual_machine_network_address, var.virtual_machine_ip_address_start + count.index)}"
38-
mask = "${ element(split("/", var.virtual_machine_network_address), count.index) }"
38+
mask = "${ element(split("/", var.virtual_machine_network_address), 1) }"
3939
gateway = "${var.virtual_machine_gateway}"
4040
dns = "${join("\n", formatlist("DNS=%s", var.virtual_machine_dns_servers))}"
4141
}
@@ -49,23 +49,10 @@ data "ignition_networkd_unit" "virtual_machine_network_unit" {
4949
content = "${data.template_file.virtual_machine_network_content.*.rendered[count.index]}"
5050
}
5151

52-
// virtual_machine_hostname_file defines the content of the system
53-
// hostname file, in other words, it sets the hostname.
54-
data "ignition_file" "virtual_machine_hostname_file" {
55-
count = "${ var.count }"
56-
filesystem = "root"
57-
path = "/etc/hostname"
58-
mode = "420"
59-
60-
content {
61-
content = "${var.virtual_machine_name_prefix}${count.index}.${var.virtual_machine_domain}"
62-
}
63-
}
6452

6553
// ignition_config creates the CoreOS Ignition config for use on the virtual machines.
6654
data "ignition_config" "ignition_config" {
6755
count = "${ var.count }"
68-
files = ["${data.ignition_file.virtual_machine_hostname_file.*.id[count.index]}"]
6956
networkd = ["${data.ignition_networkd_unit.virtual_machine_network_unit.*.id[count.index]}"]
7057
}
7158

@@ -75,4 +62,6 @@ data "ct_config" "master" {
7562
content = "${ element(split("`", var.cloud_init), count.index) }"
7663
platform = "custom"
7764
pretty_print = false
65+
66+
snippets = ["${data.ignition_config.ignition_config.*.rendered[count.index]}",]
7867
}

0 commit comments

Comments
 (0)