-
Notifications
You must be signed in to change notification settings - Fork 86
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
Data volume source image #751
Conversation
lgtm /hold additional testing |
Just a little confused. Don't we need to add a Basically now the GEP for aws and gcp now appear to have non similar behaviours. |
@elankath I think you are correct. The way it is setup now all dataVolumes would use the same sourceImage, which is clearly not what was intended. |
/needs rebase |
@elankath Could you please review again? :) |
return allErrs | ||
} | ||
|
||
func validateScratchDisk(volumeType string, workerConfig *gcp.WorkerConfig) field.ErrorList { |
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.
(apologies for delay in reviewing. was on sick leave.)
Just for confirmation: I assume this new validation routine was introduced since we didn't any validation before to enforce this section in the usage document:
"If you attach the disk with SCRATCH type, either an NVMe interface or a SCSI interface must be specified. It is only meaningful to provide this volume interface if only SCRATCH data volumes are used."
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.
Previously, the validation for the SCRATCH disk type was present and has now been slightly refined.
A new validation rule requires that the workerConfigDataVolume name must correspond to a dataVolume name.
@@ -296,8 +305,8 @@ func createDiskSpec(size string, boot bool, machineImage, volumeType *string, wo | |||
disk["labels"] = labels | |||
} | |||
|
|||
if machineImage != nil { | |||
disk["image"] = *machineImage | |||
if image != nil { |
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.
Do we need any changes in machine-controller-manager-provider-gcp
or just setting image
is good enough ? Just wondering why we decided to choose dataVolume.sourceImage
instead of simply dataVolume.image
?
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.
yes, nothing to change in the mcm.
we went for sourceImage
because that's how it is referred to by gcp client.
pkg/apis/gcp/validation/worker.go
Outdated
} | ||
|
||
for _, configDataVolume := range workerConfigDataVolumes { | ||
if !slices.Contains(dataVolumeNames, configDataVolume.Name) { |
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.
Minor: instead of constructing dataVolumeNames
slice can shorten by just using slices.ContainsFunc
if slices.ContainsFunc(workerConfigDataVolumes, func(volume gcp.DataVolume) bool {
return volume.Name == configDataVolume.Name
}) {
continue
}
allErrs = append(allErrs, field.Invalid(
dataVolumeFldPath,
configDataVolume.Name,
fmt.Sprintf("could not find dataVolume with name %s", configDataVolume.Name)))
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.
thanks for the PR.
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.
/lgtm
/unhold |
How to categorize this PR?
/area usability
/kind enhancement
/platform gcp
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #695
Special notes for your reviewer:
Release note: