mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-01 20:52:10 -04:00
cli: configurable state disk type on OpenStack (#1686)
This commit is contained in:
parent
ec1d5e9fb5
commit
c11a3f4460
9 changed files with 60 additions and 35 deletions
|
@ -381,8 +381,9 @@ func (c *Creator) createOpenStack(ctx context.Context, cl terraformClient, opts
|
|||
},
|
||||
Cloud: opts.Config.Provider.OpenStack.Cloud,
|
||||
AvailabilityZone: opts.Config.Provider.OpenStack.AvailabilityZone,
|
||||
FloatingIPPoolID: opts.Config.Provider.OpenStack.FloatingIPPoolID,
|
||||
FlavorID: opts.Config.Provider.OpenStack.FlavorID,
|
||||
FloatingIPPoolID: opts.Config.Provider.OpenStack.FloatingIPPoolID,
|
||||
StateDiskType: opts.Config.Provider.OpenStack.StateDiskType,
|
||||
ImageURL: opts.image,
|
||||
DirectDownload: *opts.Config.Provider.OpenStack.DirectDownload,
|
||||
OpenstackUserDomainName: opts.Config.Provider.OpenStack.UserDomainName,
|
||||
|
|
|
@ -169,6 +169,7 @@ module "instance_group_control_plane" {
|
|||
tags = local.tags
|
||||
uid = local.uid
|
||||
disk_size = var.state_disk_size
|
||||
state_disk_type = var.state_disk_type
|
||||
availability_zone = var.availability_zone
|
||||
network_id = openstack_networking_network_v2.vpc_network.id
|
||||
init_secret_hash = local.initSecretHash
|
||||
|
@ -189,6 +190,7 @@ module "instance_group_worker" {
|
|||
uid = local.uid
|
||||
security_groups = [openstack_compute_secgroup_v2.vpc_secgroup.id]
|
||||
disk_size = var.state_disk_size
|
||||
state_disk_type = var.state_disk_type
|
||||
availability_zone = var.availability_zone
|
||||
network_id = openstack_networking_network_v2.vpc_network.id
|
||||
init_secret_hash = local.initSecretHash
|
||||
|
|
|
@ -44,6 +44,7 @@ resource "openstack_compute_instance_v2" "instance_group_member" {
|
|||
source_type = "blank"
|
||||
destination_type = "volume"
|
||||
volume_size = var.disk_size
|
||||
volume_type = var.state_disk_type
|
||||
boot_index = 1
|
||||
delete_on_termination = true
|
||||
}
|
||||
|
|
|
@ -47,6 +47,11 @@ variable "disk_size" {
|
|||
description = "Disk size for the nodes, in GiB."
|
||||
}
|
||||
|
||||
variable "state_disk_type" {
|
||||
type = string
|
||||
description = "Disk/volume type to be used."
|
||||
}
|
||||
|
||||
variable "availability_zone" {
|
||||
type = string
|
||||
description = "The availability zone to deploy the nodes in."
|
||||
|
|
|
@ -26,6 +26,11 @@ variable "state_disk_size" {
|
|||
description = "The size of the state disk in GB."
|
||||
}
|
||||
|
||||
variable "state_disk_type" {
|
||||
type = string
|
||||
description = "Disk/volume type to be used."
|
||||
}
|
||||
|
||||
variable "availability_zone" {
|
||||
type = string
|
||||
description = "The availability zone to deploy the nodes in."
|
||||
|
|
|
@ -232,6 +232,8 @@ type OpenStackClusterVariables struct {
|
|||
FlavorID string
|
||||
// FloatingIPPoolID is the ID of the OpenStack floating IP pool to use for public IPs.
|
||||
FloatingIPPoolID string
|
||||
// StateDiskType is the OpenStack disk type to use for the state disk.
|
||||
StateDiskType string
|
||||
// ImageURL is the URL of the OpenStack image to use.
|
||||
ImageURL string
|
||||
// DirectDownload decides whether to download the image directly from the URL to OpenStack or to upload it from the local machine.
|
||||
|
@ -258,6 +260,7 @@ func (v *OpenStackClusterVariables) String() string {
|
|||
writeLinef(b, "floating_ip_pool_id = %q", v.FloatingIPPoolID)
|
||||
writeLinef(b, "image_url = %q", v.ImageURL)
|
||||
writeLinef(b, "direct_download = %t", v.DirectDownload)
|
||||
writeLinef(b, "state_disk_type = %q", v.StateDiskType)
|
||||
writeLinef(b, "openstack_user_domain_name = %q", v.OpenstackUserDomainName)
|
||||
writeLinef(b, "openstack_username = %q", v.OpenstackUsername)
|
||||
writeLinef(b, "openstack_password = %q", v.OpenstackPassword)
|
||||
|
|
|
@ -226,6 +226,9 @@ type OpenStackConfig struct {
|
|||
// Floating IP pool to use for the VMs. For details see: https://docs.openstack.org/ocata/user-guide/cli-manage-ip-addresses.html
|
||||
FloatingIPPoolID string `yaml:"floatingIPPoolID" validate:"required"`
|
||||
// description: |
|
||||
// Type of a node's state disk. The type influences boot time and I/O performance. Use `openstack volume type list` to get a list of available types.
|
||||
StateDiskType string `yaml:"stateDiskType" validate:"required"`
|
||||
// description: |
|
||||
// AuthURL is the OpenStack Identity endpoint to use inside the cluster.
|
||||
AuthURL string `yaml:"authURL" validate:"required"`
|
||||
// description: |
|
||||
|
|
|
@ -305,7 +305,7 @@ func init() {
|
|||
FieldName: "openstack",
|
||||
},
|
||||
}
|
||||
OpenStackConfigDoc.Fields = make([]encoder.Doc, 14)
|
||||
OpenStackConfigDoc.Fields = make([]encoder.Doc, 15)
|
||||
OpenStackConfigDoc.Fields[0].Name = "cloud"
|
||||
OpenStackConfigDoc.Fields[0].Type = "string"
|
||||
OpenStackConfigDoc.Fields[0].Note = ""
|
||||
|
@ -326,56 +326,61 @@ func init() {
|
|||
OpenStackConfigDoc.Fields[3].Note = ""
|
||||
OpenStackConfigDoc.Fields[3].Description = "Floating IP pool to use for the VMs. For details see: https://docs.openstack.org/ocata/user-guide/cli-manage-ip-addresses.html"
|
||||
OpenStackConfigDoc.Fields[3].Comments[encoder.LineComment] = "Floating IP pool to use for the VMs. For details see: https://docs.openstack.org/ocata/user-guide/cli-manage-ip-addresses.html"
|
||||
OpenStackConfigDoc.Fields[4].Name = "authURL"
|
||||
OpenStackConfigDoc.Fields[4].Name = "stateDiskType"
|
||||
OpenStackConfigDoc.Fields[4].Type = "string"
|
||||
OpenStackConfigDoc.Fields[4].Note = ""
|
||||
OpenStackConfigDoc.Fields[4].Description = "description: |\nAuthURL is the OpenStack Identity endpoint to use inside the cluster.\n"
|
||||
OpenStackConfigDoc.Fields[4].Comments[encoder.LineComment] = "description: |"
|
||||
OpenStackConfigDoc.Fields[5].Name = "projectID"
|
||||
OpenStackConfigDoc.Fields[4].Description = "Type of a node's state disk. The type influences boot time and I/O performance. Use `openstack volume type list` to get a list of available types."
|
||||
OpenStackConfigDoc.Fields[4].Comments[encoder.LineComment] = "Type of a node's state disk. The type influences boot time and I/O performance. Use `openstack volume type list` to get a list of available types."
|
||||
OpenStackConfigDoc.Fields[5].Name = "authURL"
|
||||
OpenStackConfigDoc.Fields[5].Type = "string"
|
||||
OpenStackConfigDoc.Fields[5].Note = ""
|
||||
OpenStackConfigDoc.Fields[5].Description = "ProjectID is the ID of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[5].Comments[encoder.LineComment] = "ProjectID is the ID of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[6].Name = "projectName"
|
||||
OpenStackConfigDoc.Fields[5].Description = "description: |\nAuthURL is the OpenStack Identity endpoint to use inside the cluster.\n"
|
||||
OpenStackConfigDoc.Fields[5].Comments[encoder.LineComment] = "description: |"
|
||||
OpenStackConfigDoc.Fields[6].Name = "projectID"
|
||||
OpenStackConfigDoc.Fields[6].Type = "string"
|
||||
OpenStackConfigDoc.Fields[6].Note = ""
|
||||
OpenStackConfigDoc.Fields[6].Description = "ProjectName is the name of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[6].Comments[encoder.LineComment] = "ProjectName is the name of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[7].Name = "userDomainName"
|
||||
OpenStackConfigDoc.Fields[6].Description = "ProjectID is the ID of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[6].Comments[encoder.LineComment] = "ProjectID is the ID of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[7].Name = "projectName"
|
||||
OpenStackConfigDoc.Fields[7].Type = "string"
|
||||
OpenStackConfigDoc.Fields[7].Note = ""
|
||||
OpenStackConfigDoc.Fields[7].Description = "UserDomainName is the name of the domain where a user resides."
|
||||
OpenStackConfigDoc.Fields[7].Comments[encoder.LineComment] = "UserDomainName is the name of the domain where a user resides."
|
||||
OpenStackConfigDoc.Fields[8].Name = "projectDomainName"
|
||||
OpenStackConfigDoc.Fields[7].Description = "ProjectName is the name of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[7].Comments[encoder.LineComment] = "ProjectName is the name of the project where a user resides."
|
||||
OpenStackConfigDoc.Fields[8].Name = "userDomainName"
|
||||
OpenStackConfigDoc.Fields[8].Type = "string"
|
||||
OpenStackConfigDoc.Fields[8].Note = ""
|
||||
OpenStackConfigDoc.Fields[8].Description = "ProjectDomainName is the name of the domain where a project resides."
|
||||
OpenStackConfigDoc.Fields[8].Comments[encoder.LineComment] = "ProjectDomainName is the name of the domain where a project resides."
|
||||
OpenStackConfigDoc.Fields[9].Name = "regionName"
|
||||
OpenStackConfigDoc.Fields[8].Description = "UserDomainName is the name of the domain where a user resides."
|
||||
OpenStackConfigDoc.Fields[8].Comments[encoder.LineComment] = "UserDomainName is the name of the domain where a user resides."
|
||||
OpenStackConfigDoc.Fields[9].Name = "projectDomainName"
|
||||
OpenStackConfigDoc.Fields[9].Type = "string"
|
||||
OpenStackConfigDoc.Fields[9].Note = ""
|
||||
OpenStackConfigDoc.Fields[9].Description = "description: |\nRegionName is the name of the region to use inside the cluster.\n"
|
||||
OpenStackConfigDoc.Fields[9].Comments[encoder.LineComment] = "description: |"
|
||||
OpenStackConfigDoc.Fields[10].Name = "username"
|
||||
OpenStackConfigDoc.Fields[9].Description = "ProjectDomainName is the name of the domain where a project resides."
|
||||
OpenStackConfigDoc.Fields[9].Comments[encoder.LineComment] = "ProjectDomainName is the name of the domain where a project resides."
|
||||
OpenStackConfigDoc.Fields[10].Name = "regionName"
|
||||
OpenStackConfigDoc.Fields[10].Type = "string"
|
||||
OpenStackConfigDoc.Fields[10].Note = ""
|
||||
OpenStackConfigDoc.Fields[10].Description = "Username to use inside the cluster."
|
||||
OpenStackConfigDoc.Fields[10].Comments[encoder.LineComment] = "Username to use inside the cluster."
|
||||
OpenStackConfigDoc.Fields[11].Name = "password"
|
||||
OpenStackConfigDoc.Fields[10].Description = "description: |\nRegionName is the name of the region to use inside the cluster.\n"
|
||||
OpenStackConfigDoc.Fields[10].Comments[encoder.LineComment] = "description: |"
|
||||
OpenStackConfigDoc.Fields[11].Name = "username"
|
||||
OpenStackConfigDoc.Fields[11].Type = "string"
|
||||
OpenStackConfigDoc.Fields[11].Note = ""
|
||||
OpenStackConfigDoc.Fields[11].Description = "Password to use inside the cluster. You can instead use the environment variable \"CONSTELL_OS_PASSWORD\"."
|
||||
OpenStackConfigDoc.Fields[11].Comments[encoder.LineComment] = "Password to use inside the cluster. You can instead use the environment variable \"CONSTELL_OS_PASSWORD\"."
|
||||
OpenStackConfigDoc.Fields[12].Name = "directDownload"
|
||||
OpenStackConfigDoc.Fields[12].Type = "bool"
|
||||
OpenStackConfigDoc.Fields[11].Description = "Username to use inside the cluster."
|
||||
OpenStackConfigDoc.Fields[11].Comments[encoder.LineComment] = "Username to use inside the cluster."
|
||||
OpenStackConfigDoc.Fields[12].Name = "password"
|
||||
OpenStackConfigDoc.Fields[12].Type = "string"
|
||||
OpenStackConfigDoc.Fields[12].Note = ""
|
||||
OpenStackConfigDoc.Fields[12].Description = "If enabled, downloads OS image directly from source URL to OpenStack. Otherwise, downloads image to local machine and uploads to OpenStack."
|
||||
OpenStackConfigDoc.Fields[12].Comments[encoder.LineComment] = "If enabled, downloads OS image directly from source URL to OpenStack. Otherwise, downloads image to local machine and uploads to OpenStack."
|
||||
OpenStackConfigDoc.Fields[13].Name = "measurements"
|
||||
OpenStackConfigDoc.Fields[13].Type = "Measurements"
|
||||
OpenStackConfigDoc.Fields[12].Description = "Password to use inside the cluster. You can instead use the environment variable \"CONSTELL_OS_PASSWORD\"."
|
||||
OpenStackConfigDoc.Fields[12].Comments[encoder.LineComment] = "Password to use inside the cluster. You can instead use the environment variable \"CONSTELL_OS_PASSWORD\"."
|
||||
OpenStackConfigDoc.Fields[13].Name = "directDownload"
|
||||
OpenStackConfigDoc.Fields[13].Type = "bool"
|
||||
OpenStackConfigDoc.Fields[13].Note = ""
|
||||
OpenStackConfigDoc.Fields[13].Description = "Measurement used to enable measured boot."
|
||||
OpenStackConfigDoc.Fields[13].Comments[encoder.LineComment] = "Measurement used to enable measured boot."
|
||||
OpenStackConfigDoc.Fields[13].Description = "If enabled, downloads OS image directly from source URL to OpenStack. Otherwise, downloads image to local machine and uploads to OpenStack."
|
||||
OpenStackConfigDoc.Fields[13].Comments[encoder.LineComment] = "If enabled, downloads OS image directly from source URL to OpenStack. Otherwise, downloads image to local machine and uploads to OpenStack."
|
||||
OpenStackConfigDoc.Fields[14].Name = "measurements"
|
||||
OpenStackConfigDoc.Fields[14].Type = "Measurements"
|
||||
OpenStackConfigDoc.Fields[14].Note = ""
|
||||
OpenStackConfigDoc.Fields[14].Description = "Measurement used to enable measured boot."
|
||||
OpenStackConfigDoc.Fields[14].Comments[encoder.LineComment] = "Measurement used to enable measured boot."
|
||||
|
||||
QEMUConfigDoc.Type = "QEMUConfig"
|
||||
QEMUConfigDoc.Comments[encoder.LineComment] = "QEMUConfig holds config information for QEMU based Constellation deployments."
|
||||
|
|
|
@ -188,7 +188,7 @@ func TestNewWithDefaultOptions(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
const defaultErrCount = 32 // expect this number of error messages by default because user-specific values are not set and multiple providers are defined by default
|
||||
const defaultErrCount = 33 // expect this number of error messages by default because user-specific values are not set and multiple providers are defined by default
|
||||
const azErrCount = 9
|
||||
const gcpErrCount = 6
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue