Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: mirror tectonicClusterID as openshiftClusterID #817

Merged
merged 1 commit into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions data/data/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module "bootstrap" {

tags = "${merge(map(
"Name", "${var.cluster_name}-bootstrap",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.aws_extra_tags)}"
}

Expand Down Expand Up @@ -127,6 +128,7 @@ resource "aws_route53_zone" "int" {
tags = "${merge(map(
"Name", "${var.cluster_name}_int",
"KubernetesCluster", "${var.cluster_name}",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.aws_extra_tags)}"
}
4 changes: 3 additions & 1 deletion data/data/aws/master/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ resource "aws_instance" "master" {
"Name", "${var.cluster_name}-master-${count.index}",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}",
"clusterid", "${var.cluster_name}"
), var.extra_tags)}"

Expand All @@ -109,7 +110,8 @@ resource "aws_instance" "master" {
volume_tags = "${merge(map(
"Name", "${var.cluster_name}-master-${count.index}-vol",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down
15 changes: 10 additions & 5 deletions data/data/aws/vpc/master-elb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ resource "aws_lb" "api_internal" {

tags = "${merge(map(
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand All @@ -26,7 +27,8 @@ resource "aws_lb" "api_external" {

tags = "${merge(map(
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand All @@ -42,7 +44,8 @@ resource "aws_lb_target_group" "api_internal" {

tags = "${merge(map(
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"

health_check {
Expand All @@ -66,7 +69,8 @@ resource "aws_lb_target_group" "api_external" {

tags = "${merge(map(
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"

health_check {
Expand All @@ -88,7 +92,8 @@ resource "aws_lb_target_group" "services" {

tags = "${merge(map(
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"

health_check {
Expand Down
6 changes: 4 additions & 2 deletions data/data/aws/vpc/sg-elb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ resource "aws_security_group" "api" {
tags = "${merge(map(
"Name", "${var.cluster_name}_api_sg",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down Expand Up @@ -44,7 +45,8 @@ resource "aws_security_group" "console" {
tags = "${merge(map(
"Name", "${var.cluster_name}_console_sg",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down
3 changes: 2 additions & 1 deletion data/data/aws/vpc/sg-etcd.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ resource "aws_security_group" "etcd" {
tags = "${merge(map(
"Name", "${var.cluster_name}_etcd_sg",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down
3 changes: 2 additions & 1 deletion data/data/aws/vpc/sg-master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ resource "aws_security_group" "master" {
tags = "${merge(map(
"Name", "${var.cluster_name}_master_sg",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down
3 changes: 2 additions & 1 deletion data/data/aws/vpc/sg-worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ resource "aws_security_group" "worker" {
tags = "${merge(map(
"Name", "${var.cluster_name}_worker_sg",
"kubernetes.io/cluster/${var.cluster_name}", "owned",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down
4 changes: 3 additions & 1 deletion data/data/aws/vpc/vpc-private.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ resource "aws_route_table" "private_routes" {
tags = "${merge(map(
"Name","${var.cluster_name}-private-${local.new_worker_subnet_azs[count.index]}",
"kubernetes.io/cluster/${var.cluster_name}", "shared",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down Expand Up @@ -34,6 +35,7 @@ resource "aws_subnet" "worker_subnet" {
"kubernetes.io/cluster/${var.cluster_name}","shared",
"kubernetes.io/role/internal-elb", "",
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
),
var.extra_tags)}"
}
Expand Down
13 changes: 9 additions & 4 deletions data/data/aws/vpc/vpc-public.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ resource "aws_internet_gateway" "igw" {
tags = "${merge(map(
"Name", "${var.cluster_name}-igw",
"kubernetes.io/cluster/${var.cluster_name}", "shared",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand All @@ -17,6 +18,7 @@ resource "aws_route_table" "default" {
"Name", "${var.cluster_name}-public",
"kubernetes.io/cluster/${var.cluster_name}", "shared",
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand Down Expand Up @@ -47,7 +49,8 @@ resource "aws_subnet" "master_subnet" {
tags = "${merge(map(
"Name", "${var.cluster_name}-master-${local.new_master_subnet_azs[count.index]}",
"kubernetes.io/cluster/${var.cluster_name}", "shared",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}

Expand All @@ -62,7 +65,8 @@ resource "aws_eip" "nat_eip" {
vpc = true

tags = "${merge(map(
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"

# Terraform does not declare an explicit dependency towards the internet gateway.
Expand All @@ -77,6 +81,7 @@ resource "aws_nat_gateway" "nat_gw" {
subnet_id = "${aws_subnet.master_subnet.*.id[count.index]}"

tags = "${merge(map(
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}
3 changes: 2 additions & 1 deletion data/data/aws/vpc/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ resource "aws_vpc" "new_vpc" {
tags = "${merge(map(
"Name", "${var.cluster_name}.${var.base_domain}",
"kubernetes.io/cluster/${var.cluster_name}", "shared",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.extra_tags)}"
}
3 changes: 2 additions & 1 deletion data/data/openstack/bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ resource "openstack_compute_instance_v2" "bootstrap" {
Name = "${var.cluster_name}-bootstrap"

# "kubernetes.io/cluster/${var.cluster_name}" = "owned"
tectonicClusterID = "${var.cluster_id}"
tectonicClusterID = "${var.cluster_id}"
openshiftClusterID = "${var.cluster_id}"
}
}
3 changes: 2 additions & 1 deletion data/data/openstack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ resource "openstack_objectstorage_container_v1" "container" {
metadata = "${merge(map(
"Name", "${var.cluster_name}-ignition-master",
"KubernetesCluster", "${var.cluster_name}",
"tectonicClusterID", "${var.cluster_id}"
"tectonicClusterID", "${var.cluster_id}",
"openshiftClusterID", "${var.cluster_id}"
), var.openstack_extra_tags)}"
}
7 changes: 4 additions & 3 deletions data/data/openstack/masters/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ resource "openstack_compute_instance_v2" "master_conf" {
}

metadata {
Name = "${var.cluster_name}-master"
owned = "kubernetes.io/cluster/${var.cluster_name}"
tectonicClusterID = "${var.cluster_id}"
Name = "${var.cluster_name}-master"
owned = "kubernetes.io/cluster/${var.cluster_name}"
tectonicClusterID = "${var.cluster_id}"
openshiftClusterID = "${var.cluster_id}"
}
}
12 changes: 6 additions & 6 deletions data/data/openstack/topology/private-network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ locals {
resource "openstack_networking_network_v2" "openshift-private" {
name = "openshift"
admin_state_up = "true"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_subnet_v2" "masters" {
name = "masters"
cidr = "${local.new_master_cidr_range}"
ip_version = 4
network_id = "${openstack_networking_network_v2.openshift-private.id}"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_subnet_v2" "workers" {
name = "worker"
cidr = "${local.new_worker_cidr_range}"
ip_version = 4
network_id = "${openstack_networking_network_v2.openshift-private.id}"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_port_v2" "masters" {
Expand All @@ -32,7 +32,7 @@ resource "openstack_networking_port_v2" "masters" {
admin_state_up = "true"
network_id = "${openstack_networking_network_v2.openshift-private.id}"
security_group_ids = ["${openstack_networking_secgroup_v2.master.id}"]
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]

fixed_ip {
"subnet_id" = "${openstack_networking_subnet_v2.masters.id}"
Expand All @@ -45,7 +45,7 @@ resource "openstack_networking_port_v2" "bootstrap_port" {
admin_state_up = "true"
network_id = "${openstack_networking_network_v2.openshift-private.id}"
security_group_ids = ["${openstack_networking_secgroup_v2.master.id}"]
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]

fixed_ip {
"subnet_id" = "${openstack_networking_subnet_v2.masters.id}"
Expand All @@ -61,7 +61,7 @@ resource "openstack_networking_router_v2" "openshift-external-router" {
name = "openshift-external-router"
admin_state_up = true
external_network_id = "${data.openstack_networking_network_v2.external_network.id}"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_router_interface_v2" "masters_router_interface" {
Expand Down
6 changes: 3 additions & 3 deletions data/data/openstack/topology/sg-lb.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "openstack_networking_secgroup_v2" "mcs" {
name = "mcs"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_secgroup_rule_v2" "mcs_https" {
Expand All @@ -15,7 +15,7 @@ resource "openstack_networking_secgroup_rule_v2" "mcs_https" {

resource "openstack_networking_secgroup_v2" "api" {
name = "api"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_secgroup_rule_v2" "api_https" {
Expand All @@ -30,7 +30,7 @@ resource "openstack_networking_secgroup_rule_v2" "api_https" {

resource "openstack_networking_secgroup_v2" "console" {
name = "console"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_secgroup_rule_v2" "console_http" {
Expand Down
2 changes: 1 addition & 1 deletion data/data/openstack/topology/sg-master.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "openstack_networking_secgroup_v2" "master" {
name = "master"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_secgroup_rule_v2" "master_mcs" {
Expand Down
2 changes: 1 addition & 1 deletion data/data/openstack/topology/sg-worker.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "openstack_networking_secgroup_v2" "worker" {
name = "worker"
tags = ["${format("tectonicClusterID=%s", var.cluster_id)}"]
tags = ["tectonicClusterID=${var.cluster_id}", "openshiftClusterID=${var.cluster_id}"]
}

resource "openstack_networking_secgroup_rule_v2" "worker_ingress_icmp" {
Expand Down
3 changes: 3 additions & 0 deletions pkg/asset/cluster/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ func Metadata(config *types.InstallConfig) *aws.Metadata {
{
"tectonicClusterID": config.ClusterID,
},
{
"openshiftClusterID": config.ClusterID,
},
{
fmt.Sprintf("kubernetes.io/cluster/%s", config.ObjectMeta.Name): "owned",
},
Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/cluster/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ func Metadata(config *types.InstallConfig) *openstack.Metadata {
Region: config.Platform.OpenStack.Region,
Cloud: config.Platform.OpenStack.Cloud,
Identifier: map[string]string{
"tectonicClusterID": config.ClusterID,
"tectonicClusterID": config.ClusterID,
"openshiftClusterID": config.ClusterID,
},
}
}
1 change: 1 addition & 0 deletions pkg/asset/machines/aws/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func provider(clusterID, clusterName string, platform *aws.Platform, mpool *aws.
func tagsFromUserTags(clusterID, clusterName string, usertags map[string]string) ([]awsprovider.TagSpecification, error) {
tags := []awsprovider.TagSpecification{
{Name: "tectonicClusterID", Value: clusterID},
{Name: "openshiftClusterID", Value: clusterID},
{Name: fmt.Sprintf("kubernetes.io/cluster/%s", clusterName), Value: "owned"},
}
forbiddenTags := sets.NewString()
Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/machines/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func (m *Master) Generate(dependencies asset.Parents) error {
}

tags := map[string]string{
"tectonicClusterID": ic.ClusterID,
"tectonicClusterID": ic.ClusterID,
"openshiftClusterID": ic.ClusterID,
}
config.Tags = tags

Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/machines/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ func (w *Worker) Generate(dependencies asset.Parents) error {
}

tags := map[string]string{
"tectonicClusterID": ic.ClusterID,
"tectonicClusterID": ic.ClusterID,
"openshiftClusterID": ic.ClusterID,
}
config.Tags = tags

Expand Down
Loading