Skip to content

Commit

Permalink
Add server metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Hros <[email protected]>
  • Loading branch information
chess-knight committed Jun 14, 2024
1 parent 930b47d commit 4cc4718
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions terraform/files/template/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ spec:
template:
spec:
flavor: ${OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR}
serverMetadata: ${OPENSTACK_CONTROL_PLANE_MACHINE_METADATA}
serverGroupID: ${OPENSTACK_SRVGRP_CONTROLLER}
image: ${OPENSTACK_IMAGE_NAME}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
Expand All @@ -345,6 +346,7 @@ spec:
name: ${CLUSTER_NAME}-cloud-config
kind: Secret
flavor: ${OPENSTACK_NODE_MACHINE_FLAVOR}
serverMetadata: ${OPENSTACK_NODE_MACHINE_METADATA}
serverGroupID: ${OPENSTACK_SRVGRP_WORKER}
image: ${OPENSTACK_IMAGE_NAME}
sshKeyName: ${OPENSTACK_SSH_KEY_NAME}
Expand Down
4 changes: 4 additions & 0 deletions terraform/files/template/clusterctl.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ DEPLOY_FLUX: ${deploy_flux}
# deploy metrics service
DEPLOY_METRICS: ${deploy_metrics}

# OpenStack instance additional metadata
OPENSTACK_CONTROL_PLANE_MACHINE_METADATA: "{ %{ for metadata_key, metadata_value in controller_metadata ~} ${metadata_key}: ${metadata_value}, %{ endfor ~} }"
OPENSTACK_NODE_MACHINE_METADATA: "{ %{ for metadata_key, metadata_value in worker_metadata ~} ${metadata_key}: ${metadata_value}, %{ endfor ~} }"

# OpenStack flavors and machine count
OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR: ${controller_flavor}
CONTROL_PLANE_MACHINE_COUNT: ${controller_count}
Expand Down
4 changes: 3 additions & 1 deletion terraform/mgmtcluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ resource "terraform_data" "mgmtcluster_bootstrap_files" {
cloud_provider = var.cloud_provider,
controller_count = var.controller_count,
controller_flavor = var.controller_flavor,
controller_metadata = var.controller_metadata,
deploy_cert_manager = var.deploy_cert_manager,
deploy_cindercsi = var.deploy_cindercsi,
deploy_flux = var.deploy_flux,
Expand All @@ -340,7 +341,8 @@ resource "terraform_data" "mgmtcluster_bootstrap_files" {
calico_version = var.calico_version,
use_ovn_lb_provider = var.use_ovn_lb_provider,
worker_count = var.worker_count,
worker_flavor = var.worker_flavor
worker_flavor = var.worker_flavor,
worker_metadata = var.worker_metadata
})
destination = "/home/${var.ssh_username}/cluster-defaults/clusterctl.yaml"
}
Expand Down
12 changes: 12 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ variable "worker_flavor" {
default = "SCS-2V-4-20s"
}

variable "controller_metadata" {
description = "additional metadata for instances running the k8s management nodes"
type = map(string)
default = {}
}

variable "worker_metadata" {
description = "additional metadata for instances running the k8s worker nodes"
type = map(string)
default = {}
}

variable "availability_zone" {
description = "availability zone for openstack resources"
type = string
Expand Down

0 comments on commit 4cc4718

Please sign in to comment.