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
Bug 1820300: Extend oVirt's MachinePool #3399
Conversation
@rgolangh: This pull request references Bugzilla bug 1813741, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@rgolangh: This pull request references Bugzilla bug 1820300, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/bugzilla refresh |
@rgolangh: This pull request references Bugzilla bug 1820300, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/bugzilla refresh |
@rgolangh: This pull request references Bugzilla bug 1820300, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/bugzilla refresh |
@rgolangh: This pull request references Bugzilla bug 1820300, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/bugzilla refresh |
@rgolangh: This pull request references Bugzilla bug 1820300, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@rgolangh: This pull request references Bugzilla bug 1820300, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. There are just some docs issues that need to be fixed up. oVirt is missing a doc like this: https://github.com/openshift/installer/blob/master/docs/user/aws/customization.md and it should be added to give machinepool examples.
data/data/ovirt/masters/variables.tf
Outdated
type = string | ||
} | ||
|
||
variable "ovirt_master_cpu" { | ||
variable "ovirt_master_os_disk_size_gb" { | ||
type = string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no newline EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
variable "disk_size_gib" { | ||
type = number | ||
description = "The size of the template disk for worker/nodes in GiB." | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no new line EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i can still see the newline :P
data/data/ovirt/variables-ovirt.tf
Outdated
|
||
variable "ovirt_master_instance_type_id" { | ||
type = string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no new line EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
go.mod
Outdated
@@ -69,12 +69,12 @@ require ( | |||
github.com/openshift/cluster-api v0.0.0-20191129101638-b09907ac6668 | |||
github.com/openshift/cluster-api-provider-gcp v0.0.1-0.20200120152131-1b09fd9e7156 | |||
github.com/openshift/cluster-api-provider-libvirt v0.2.1-0.20191219173431-2336783d4603 | |||
github.com/openshift/cluster-api-provider-ovirt v0.1.1-0.20200128081049-840376ca5c09 | |||
github.com/openshift/cluster-api-provider-ovirt v0.1.1-0.20200402173228-4981fa21d0d7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes should be in the vendor commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// InstanceTypeID defines the VM instance type and overrides | ||
// the hardware parameters of the created VM, including cpu and memory. | ||
// If InstanceTypeID is passed, all memory and cpu variables will be ignored. | ||
InstanceTypeID string `json:"instanceTypeID,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mark these with +optional and kubebuilder default? See this for details https://github.com/openshift/installer/pull/3515/files#diff-ef5ad052319246b6e805b03c0221dcdcR34 and check out the whole PR for motivation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If InstanceTypeID is passed, all memory and cpu variables will be ignored.
I think we need validation that user doesn't set these conflicting values in install-config.yaml
// Set sets the values from `required` to `a`. | ||
func (l *MachinePool) Set(required *MachinePool) { | ||
if required == nil || l == nil { | ||
// Disk defines a VM disk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing period.
if required == nil || l == nil { | ||
// Disk defines a VM disk | ||
type Disk struct { | ||
// SizeGB size of the bootable disk in GiB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing is
pkg/types/ovirt/machinepool.go
Outdated
// be used for and this effects the instance parameters. | ||
// One of "desktop, server, high_performance" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
effects
-> affects
One of "desktop, server, high_performance"
-> One of: "desktop", "server", or "high_performance".
pkg/types/ovirt/machinepool.go
Outdated
VMType string `json:"type,omitempty"` | ||
} | ||
|
||
// CPU defines the VM cpu, made of (Sockets * Cores * Threads) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing period
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// CPU defines the VM cpu, made of (Sockets * Cores * Threads) | |
// CPU defines the VM's cpu, which is made of (Sockets * Cores * Threads) |
The sockets and cores are defined in this struct, while there is no mention of the threads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hiding threads for now, I don't want to expose this at the moment. I removed it from the comments as well.
pkg/types/ovirt/machinepool.go
Outdated
// CPU defines the VM cpu, made of (Sockets * Cores * Threads) | ||
type CPU struct { | ||
// Sockets is the number of sockets for a VM. | ||
// Total CPUs is (Sockets * Cores * Threads) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing period
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/asset/machines/master.go
Outdated
@@ -319,7 +319,11 @@ func (m *Master) Generate(dependencies asset.Parents) error { | |||
} | |||
case ovirttypes.Name: | |||
mpool := defaultOvirtMachinePoolPlatform() | |||
mpool.VMType = "high_performance" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: move this to defaultOvirtMachinePoolPlatform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or document why this is different from the default.
pkg/types/ovirt/machinepool.go
Outdated
// VMType defines the workload type the instance will | ||
// be used for and this effects the instance parameters. | ||
// One of "desktop, server, high_performance" | ||
VMType string `json:"type,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if these values are known, desktop, server, high_performance
, we should be using string enums like the publish
installer/pkg/types/installconfig.go
Lines 47 to 55 in 1a0bf0a
// PublishingStrategy is a strategy for how various endpoints for the cluster are exposed. | |
type PublishingStrategy string | |
const ( | |
// ExternalPublishingStrategy exposes endpoints for the cluster to the Internet. | |
ExternalPublishingStrategy PublishingStrategy = "External" | |
// InternalPublishingStrategy exposes the endpoints for the cluster to the private network only. | |
InternalPublishingStrategy PublishingStrategy = "Internal" | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also include validations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
data/data/ovirt/template/main.tf
Outdated
os { | ||
type = "rhcos_x64" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
name: "invalid instance type id", | ||
pool: &ovirt.MachinePool{ | ||
InstanceTypeID: "aaaaa-123"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InstanceTypeID: "aaaaa-123"}, | |
InstanceTypeID: "aaaaa-123", | |
}, |
_, err := con.SystemService(). | ||
InstanceTypesService().InstanceTypeService(machinePool.InstanceTypeID).Get().Send() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not big fan of mixed indentation here, one multi-line the rest is one-line. single line is better even for this imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me shorter lines (< 120) are preferred for the price of a bit of weirdness of go multi-line. Unfortunately ovirt sdk is more verbose than I'd wanted it to be (a lot of client code with builder probably)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me shorter lines (< 120) are preferred for the price of a bit of weirdness of go multi-line. Unfortunately ovirt sdk is quite verbose (a lot of client code are the same probably...)
If that's a code-base guideline that's fine by me. I don't want to repeat this over again.
allErrs = append(allErrs, field.Invalid(fldPath.Child("instanceTypeID"), p.InstanceTypeID, "mixing instanceTypeID and CPU is not supported")) | ||
} | ||
if p.MemoryMB > 0 { | ||
allErrs = append(allErrs, field.Invalid(fldPath.Child("instanceTypeID"), p.InstanceTypeID, "mixing instanceTypeID and Memory is not supported")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allErrs = append(allErrs, field.Invalid(fldPath.Child("instanceTypeID"), p.InstanceTypeID, "mixing instanceTypeID and Memory is not supported")) | |
allErrs = append(allErrs, field.Invalid(fldPath.Child("instanceTypeID"), p.InstanceTypeID, "mixing instanceTypeID and Memory is not supported")) |
Please update the godoc comments for the new fields in the machinepool as these are very sparse and incomplete feeling. With the addition of Make sure include the generated code using https://github.com/openshift/installer/blob/master/docs/dev/explain.md#generating-the-documentation also, there is missing documentation in docs/ovirt/customization.md that documents the fields and also provides some example install-config.yaml 's for various configurations for users. see https://github.com/openshift/installer/blob/master/docs/user/aws/customization.md for AWS as example. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Those items are now part of MachinePool - instance type - cpu (cores, sockets) - memory - os disk size - vm type With those we have controll on the way create worker/nodes, and we have proper defaults set in the machine pool definitions, one for the pkg/asset/machines/ master.go and worker.go. Default master pool: cpus: 4 mem: 16 GiB os disk: 120 GB VM type: high_performance Default worker pool: cpus: 4 mem: 16 GiB os disk: 120 GB VM type: server A compute pool snippet from the install-config.yaml may look like that: ```yaml compute: - architecture: amd64 hyperthreading: Enabled name: worker platform: ovirt: cpu: cores: 8 sockets: 1 instanceTypeID: memoryMB: 65536 osDisk: sizeGB: 120 vmType: high_performance replicas: 3 ``` Terraform now uses those values, and all the defaults in tf files are now deleted in favour of the machine-config ones. To support `osDisk` size which is differnt than the template master/main.tf has this block: block_device { interface = "virtio_scsi" size = var.ovirt_master_os_disk_size_gb } If needed TF will extend the disk size of the VM. Cluster-api-provider-ovirt also extends the disk of a VM if the definition in the machine spec is differnt than the template. Signed-off-by: Roy Golan <rgolan@redhat.com>
/test e2e-ovirt |
@rgolangh: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm |
@rgolangh: All pull requests linked via external trackers have merged: openshift/installer#3399. Bugzilla bug 1820300 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cherry-pick release-4.4 |
@rgolangh: #3399 failed to apply on top of branch "release-4.4":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The fix in openshift/installer#3399 adds the machine pool definition into install-config. This updated is needed from now on to make the CI use it. Signed-off-by: Roy Golan <rgolan@redhat.com>
Those items are now part of MachinePool
A compute pool snippet from the install-config.yaml may look like that:
Terraform now uses those values, and all the defaults in tf files are
now deleted in favour of the machine-config ones.