Add PowerVS platform support#1225
Conversation
✅ Deploy Preview for hypershift-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mkumatag The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/cc @dharaneeshvrd |
|
@mkumatag: GitHub didn't allow me to request PR reviews from the following users: dharaneeshvrd. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn 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. |
e486d63 to
b9c13ea
Compare
Co-authored-by: Dharaneeshwaran Ravichandran <dharanish185@gmail.com>
|
/retest |
|
@mkumatag: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/cc @enxebre |
|
/assign |
| @@ -139,6 +139,7 @@ func applyPlatformSpecificsValues(ctx context.Context, exampleOptions *apifixtur | |||
| PowerVSCloudConnection: opts.PowerVSPlatform.PowerVSCloudConnection, | |||
| // PowerVSPlatformSpec defines IBMCloud PowerVS specific settings for components | ||
| type PowerVSPlatformSpec struct { | ||
| // ResourceGroup is the IBMCloud Resource Group in which the cluster resides. If not | ||
| // specified then default resource group of the account will be used. |
There was a problem hiding this comment.
// specified then default resource group of the account will be used.
I don't see this default implemented in the controller so I assume is how ibm cloud behaves?
I see this is omitempty but Can we also add the +optional to be more explicit?
There was a problem hiding this comment.
we initially thought will do this but this value is required for setting up the CCM, so will make this required.
There was a problem hiding this comment.
unless marked as optional (omitempty / //optional) it's required so just need to change that and verify in the CRD generation.
| // Zone is the availability zone where control plane cloud resources are | ||
| // created. | ||
| // | ||
| // +immutable |
There was a problem hiding this comment.
there's omitempty here, can we add +optional tag too consistently everywhere is optional?
There was a problem hiding this comment.
Again we need this value required as well for CCM code, will make this required.
| // Subnet is the subnet to use for control plane cloud resources. | ||
| // | ||
| // +optional | ||
| Subnet *PowerVSResourceReference `json:"subnet,omitempty"` |
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
Actually I can't see where this is consumed, is it used anywhere?
There was a problem hiding this comment.
you are right, these can't be optional. This is not used anywhere because we are using Subnet from PowerVSNodePoolPlatform for the machines, but we need this in the future to create new nodepool(will submit a follow up PR)
| Subnet *PowerVSResourceReference `json:"subnet,omitempty"` | ||
|
|
||
| // ServiceInstanceID is the ServiceInstance to use for control plane cloud resources. | ||
| ServiceInstanceID string `json:"serviceInstanceID,omitempty"` |
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
Again, can't be optional.
| // plane. | ||
| // | ||
| // +immutable | ||
| VPC *PowerVSVPC `json:"vpc,omitempty"` |
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
| // TODO(dan): document the "cloud controller policy" | ||
| // | ||
| // +immutable | ||
| KubeCloudControllerCreds corev1.LocalObjectReference `json:"kubeCloudControllerCreds"` |
There was a problem hiding this comment.
I brought this up in the past: I wonder if both KubeCloudControllerCreds and NodePoolManagementCreds should belong to the generic spec.
| // on IBMCloud PowerVS platform. | ||
| type PowerVSNodePoolPlatform struct { | ||
| // ServiceInstanceID is the ServiceInstance to use for control plane cloud resources. | ||
| ServiceInstanceID string `json:"serviceInstanceID"` |
There was a problem hiding this comment.
which "control plane cloud resources" does this refer to?
There was a problem hiding this comment.
oops, this should be NodePool
|
|
||
| // ProcType (dedicated, shared, capped) | ||
| // +optional | ||
| ProcType string `json:"procType,omitempty"` |
There was a problem hiding this comment.
please add open api enum validation tag
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
we have a web hook in the capibm controller to set some of these value default, rightnow I'm not deploying that part of the deployment(future plan is to add support).
So my next question is how are we dealing with other providers?
There was a problem hiding this comment.
I don't think that should make any difference, I see webhooks as an additional UX layer. The API need to be solid even nevertheless. If a ProcType is necessary for the controller to work, then the field must be mark as required not optional (or alternative optional and use openAPI crd defaulting, but I rather do the former to avoid surprising opinions/assumptions for consumers). Then in the CLI we can give it a happy path/convenience value by default if we want to.
There was a problem hiding this comment.
sure, I will make enum and default.
|
|
||
| // Memory specifies the amount of memory specified in GBs | ||
| // +optional | ||
| Memory string `json:"memory,omitempty"` |
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
I would love to build api accepts value only in GiB format, I'm afraid that user won't be able to take advantage of resource quantity
| ProcType string `json:"procType,omitempty"` | ||
|
|
||
| // Processors specifies the number of processors allocated | ||
| // +optional |
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
again, setting defaults in the capibm webhook
|
|
||
| // Image used for deploying the nodes | ||
| // +optional | ||
| Image *PowerVSResourceReference `json:"image,omitempty"` |
There was a problem hiding this comment.
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
In hypershift we create IBMPowerVSImage resource to onboard the image from release artefacts, but if user wants to test with a different image which is already onboarded into the service then this field is useful, place we are overriding it here: https://github.com/mkumatag/hypershift/blob/1e9207ea17296fca53960b1d5dd44b37c6b3ba45/hypershift-operator/controllers/nodepool/nodepool_controller.go#L519:L537
|
|
||
| // StorageType for the image and nodes | ||
| // +optional | ||
| StorageType string `json:"storageType,omitempty"` |
There was a problem hiding this comment.
will add the enum and default
| // Subnet is the subnet to use for control plane cloud resources. | ||
| // | ||
| // +optional | ||
| Subnet *PowerVSResourceReference `json:"subnet,omitempty"` |
There was a problem hiding this comment.
which control plane resources does this refer to?
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
typical copy/paste error, need to be required
| // DeletePolicy for the image | ||
| // | ||
| // +optional | ||
| DeletePolicy string `json:"deletePolicy,omitempty"` |
There was a problem hiding this comment.
is this enum type validation?
How can this be optional, what happens if it's not set?
There was a problem hiding this comment.
will add the enum and default
| func NewCreateCommand(opts *core.CreateOptions) *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "powervs", | ||
| Short: "Creates basic functional HostedCluster resources on PowerVS PowerVS", |
| } | ||
|
|
||
| cmd.Flags().StringVar(&opts.PowerVSPlatform.ResourceGroup, "resource-group", "", "IBM Cloud Resource group") | ||
| cmd.Flags().StringVar(&opts.PowerVSPlatform.PowerVSRegion, "powervs-region", opts.PowerVSPlatform.PowerVSRegion, "IBM Cloud PowerVS region") |
There was a problem hiding this comment.
none of this needs the "powervs-" prefix since this is the powervs subcommand already.
| hcluster *hyperv1.HostedCluster, | ||
| controlPlaneNamespace string, | ||
| apiEndpoint hyperv1.APIEndpoint) (client.Object, error) { | ||
| if hcluster.Spec.Platform.IBMCloud != nil && hcluster.Spec.Platform.IBMCloud.ProviderType == configv1.IBMCloudProviderTypeUPI { |
There was a problem hiding this comment.
given IBMCloud.ProviderType is a discriminator union PowerVS definition should live there
type IBMCloudPlatformSpec struct {
// ProviderType is a specific supported infrastructure provider within IBM Cloud.
ProviderType configv1.IBMCloudProviderType `json:"providerType,omitempty"`
PowerVS PowerVSPlatformSpec
}
There was a problem hiding this comment.
This is just a copy/paste error from ibmcloud, this is not required.
| } | ||
| } | ||
|
|
||
| func ibmPowerVSMachineTemplateSpec(nodePool *hyperv1.NodePool, ami string) *capipowervs.IBMPowerVSMachineTemplateSpec { |
There was a problem hiding this comment.
In PowerVS it is called BootImage or just Image
|
Thanks @mkumatag! this is great work. For the sake of doing reasonable reviews and moving small chunks faster I suggest we split this in multiple PRs: |
|
closing in favour of #1255 |
|
@enxebre: Closed this PR. DetailsIn 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. |
What this PR does / why we need it:
Add PowerVS platform support, reference to the openshift enhancement proposal for platform addition.
Which issue(s) this PR fixes (optional, use
fixes #<issue_number>(, fixes #<issue_number>, ...)format, where issue_number might be a GitHub issue, or a Jira story:Fixes #
Checklist