Skip to content
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

Add PowerVS platform support #1225

Closed
wants to merge 4 commits into from
Closed

Conversation

mkumatag
Copy link
Member

@mkumatag mkumatag commented Apr 4, 2022

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

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

@netlify
Copy link

netlify bot commented Apr 4, 2022

Deploy Preview for hypershift-docs ready!

Name Link
🔨 Latest commit c804844
🔍 Latest deploy log https://app.netlify.com/sites/hypershift-docs/deploys/624aed9d9c253b000b8451a3
😎 Deploy Preview https://deploy-preview-1225--hypershift-docs.netlify.app/reference/api
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 4, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mkumatag
To complete the pull request process, please assign alvaroaleman after the PR has been reviewed.
You can assign the PR to them by writing /assign @alvaroaleman in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mkumatag
Copy link
Member Author

mkumatag commented Apr 4, 2022

/cc @dharaneeshvrd

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 4, 2022

@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.

In response to this:

/cc @dharaneeshvrd

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.

@mkumatag mkumatag force-pushed the powervs branch 2 times, most recently from e486d63 to b9c13ea Compare April 5, 2022 04:58
mkumatag and others added 4 commits April 5, 2022 10:33
Co-authored-by: Dharaneeshwaran Ravichandran <dharanish185@gmail.com>
@mkumatag
Copy link
Member Author

mkumatag commented Apr 5, 2022

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 5, 2022

@mkumatag: all tests passed!

Full PR test history. Your PR dashboard.

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.

@mkumatag
Copy link
Member Author

mkumatag commented Apr 7, 2022

/cc @enxebre

@openshift-ci openshift-ci bot requested a review from enxebre April 7, 2022 06:28
@enxebre
Copy link
Member

enxebre commented Apr 8, 2022

/assign

@@ -139,6 +139,7 @@ func applyPlatformSpecificsValues(ctx context.Context, exampleOptions *apifixtur
PowerVSCloudConnection: opts.PowerVSPlatform.PowerVSCloudConnection,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please conflate this commit with e10d67b

// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we initially thought will do this but this value is required for setting up the CCM, so will make this required.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's omitempty here, can we add +optional tag too consistently everywhere is optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"`
Copy link
Member

@enxebre enxebre Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, can't be optional.

// plane.
//
// +immutable
VPC *PowerVSVPC `json:"vpc,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't be optional.

// TODO(dan): document the "cloud controller policy"
//
// +immutable
KubeCloudControllerCreds corev1.LocalObjectReference `json:"kubeCloudControllerCreds"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which "control plane cloud resources" does this refer to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, this should be NodePool


// ProcType (dedicated, shared, capped)
// +optional
ProcType string `json:"procType,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add open api enum validation tag

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

@enxebre enxebre Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I will make enum and default.


// Memory specifies the amount of memory specified in GBs
// +optional
Memory string `json:"memory,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do this a resource quantity

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, setting defaults in the capibm webhook


// Image used for deploying the nodes
// +optional
Image *PowerVSResourceReference `json:"image,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this enum type validation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add the enum and default

// Subnet is the subnet to use for control plane cloud resources.
//
// +optional
Subnet *PowerVSResourceReference `json:"subnet,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which control plane resources does this refer to?
How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typical copy/paste error, need to be required

// DeletePolicy for the image
//
// +optional
DeletePolicy string `json:"deletePolicy,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this enum type validation?
How can this be optional, what happens if it's not set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo remove one "PowerVS"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix

}

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Member

@enxebre enxebre Apr 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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       
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a copy/paste error from ibmcloud, this is not required.

}
}

func ibmPowerVSMachineTemplateSpec(nodePool *hyperv1.NodePool, ami string) *capipowervs.IBMPowerVSMachineTemplateSpec {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is an ami in IBM?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PowerVS it is called BootImage or just Image

@enxebre
Copy link
Member

enxebre commented Apr 11, 2022

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:
1 - API
2 - Controllers
3 - CLI

@mkumatag mkumatag mentioned this pull request Apr 11, 2022
4 tasks
@mkumatag
Copy link
Member Author

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:
1 - API
2 - Controllers
3 - CLI

API Changes: #1255
Vendor updates: #1254

@enxebre
Copy link
Member

enxebre commented Apr 18, 2022

closing in favour of #1255
/close

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 18, 2022

@enxebre: Closed this PR.

In response to this:

closing in favour of #1255
/close

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.

@openshift-ci openshift-ci bot closed this Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants