add support for labels, fixes #246 (#249)

This commit is contained in:
Ludovico Magnocavallo 2021-05-22 18:08:49 +02:00 committed by GitHub
parent 7f7b2589ab
commit 2b84ac45bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 0 deletions

View File

@ -244,6 +244,10 @@ def manifests_edit(ctx=None):
data_v['projectID'] = tfvars['service_project']['project_id']
if not 'ocp-worker' in data_v['tags']:
data_v['tags'].append('ocp-worker')
if tfvars['install_config_params']['labels']:
data_v['labels'] = tfvars['install_config_params']['labels'].copy()
for i, d in enumerate(data_v['disks']):
d['labels'] = tfvars['install_config_params']['labels'].copy()
data_n = data_v['networkInterfaces'][0]
data_n['network'] = tfvars['host_project']['vpc_name']
data_n['subnetwork'] = tfvars['host_project']['workers_subnet_name']

View File

@ -75,6 +75,7 @@ resource "google_compute_instance" "bootstrap" {
})
VmDnsSetting = "GlobalDefault"
}
labels = var.install_config_params.labels
}
resource "google_compute_instance_group" "bootstrap" {

View File

@ -45,6 +45,7 @@ resource "google_compute_instance" "master" {
user-data = file("${local.fs_paths.config_dir}/master.ign"),
VmDnsSetting = "GlobalDefault"
}
labels = var.install_config_params.labels
}
resource "google_compute_instance_group" "master" {

View File

@ -58,6 +58,7 @@ variable "install_config_params" {
description = "OpenShift cluster configuration."
type = object({
disk_size = number
labels = map(string)
network = object({
cluster = string
host_prefix = number
@ -72,6 +73,7 @@ variable "install_config_params" {
})
default = {
disk_size = 16
labels = {}
network = {
cluster = "10.128.0.0/14"
host_prefix = 23