-
Notifications
You must be signed in to change notification settings - Fork 75
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
VPC: Create basic types for VPC #1670
base: main
Are you sure you want to change the base?
Conversation
Hi @cjschaef. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
8351ca8
to
03f81ed
Compare
03f81ed
to
7b12dfe
Compare
/ok-to-test |
lgtm |
7b12dfe
to
f3e9c57
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cjschaef 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 |
api/v1beta2/types.go
Outdated
Name string `json:"name"` | ||
|
||
// id is the ID of the COS instance. | ||
// +optional | ||
ID *string `json:"id,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.
do we really need both Name and ID field?
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.
We usually have both Name and ID fields for resources, just incase want to speed up the look up when ID is known.
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 remove, I simply copied the COSInstance from PowerVS code, as is.
If you have found you don't need name, I will remove it here as well.
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.
Looks like the current PowerVS has no ID's, I kind of favor Id's over names and currently expect CAPI will not be creating COS Instances or resources....so I will see about using Id's over names ATM.
Will update.
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 dropped Name
for now.
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.
We cannot drop Name as thats the only way user can specify the Name of COSInstance.
Also It wont be good to add VPCResource to COSInstance as both are two different entities in IBM Cloud. May be if we would rename VPCResource to something else to more appropriate as its just represents ID and Name in general, then only we can do.
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.
My expectation at this time, is that the controller will not be creating COS resources, but it may be expected to create a VPC Custom Image, using a qcow2 file in a COS bucket, hence the need for this COS struct. I could rely only on a COS bucket CRN, but if this resource can be re-used, I expected Name/ID would be more beneficial, fields set depending on the requirements (PowerVS vs. VPC, etc.)
However, this is my best assumption on the workflow, as limitations may require changes and I am unsure if PowerVS creates COS resources (bucket maybe?) for the VSI Image. So now I wonder if VPC should deviate from the flow PowerVS uses.
It is early on in development, so I can mirror the flow PowerVS uses, for consistency, which would mean I follow similar field requirements (Name's)?
Perhaps you have an opinion on whether VPC should follow similar processes/expectations as PowerVS, when it makes sense. I am not opposed to relying on the controller to create COS resources if necessary, but I had expected the controller to rely on an existing COS Instance and Bucket and ideally the qcow2 Object holding the RHCOS image, and not be responsible for creating it.
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 this is what causing confusion, There are two things
-
In PowerVS we create cos instance and bucket to upload the ignition data as a object and pass the object URL as userdata while creating machine.
-
We have ibmpowervs_image_controller which takes care of importing the RHCOS image from respective COS bucket to where redhat will push the image into the PowerVS service instance.
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.
The question I guess I still have is, do the COS instance and bucket need to be created as a prerequisite? I hadn't seen anything in the CAPI code that creates the instance and the bucket (only the Object/File), but I certainly could have missed that.
If this is the case, and I would follow the same flow as PowerVS (create the COS instance and bucket outside CAPI), that will influence what values I want, although I have seen I am limited by the IBM COS SDK, as far as values as well.
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.
We do create COS instance and bucket as a part of IBMPowerVSCluster reconciler
cluster-api-provider-ibmcloud/controllers/ibmpowervscluster_controller.go
Lines 200 to 203 in 2a0c281
if err := clusterScope.ReconcileCOSInstance(); err != nil { | |
conditions.MarkFalse(powerVSCluster, infrav1beta2.COSInstanceReadyCondition, infrav1beta2.COSInstanceReconciliationFailedReason, capiv1beta1.ConditionSeverityError, err.Error()) | |
return reconcile.Result{}, err | |
} |
api/v1beta2/types.go
Outdated
BucketName *string `json:"bucketName,omitempty"` | ||
|
||
// bucketID is the IBM Cloud COS bucket ID. | ||
// +optional | ||
BucketID *string `json:"bucketID,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.
same comment as cos (do we really need both Name and ID field?)
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.
Same as above, I can remove if you have found both to be unnecessary.
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.
Same update as above, will try only relying on ID's
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 dropped BucketName for now.
api/v1beta2/types.go
Outdated
Name string `json:"name"` | ||
|
||
// id is the ID of the COS instance. | ||
// +optional | ||
ID *string `json:"id,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.
We usually have both Name and ID fields for resources, just incase want to speed up the look up when ID is known.
api/v1beta2/types.go
Outdated
Name *string `json:"name,omitempty"` | ||
|
||
// type is the type of VPC resource. | ||
Type *ResourceType `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.
Would like to understand how this will be used. any example?
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.
A VPCResource can be any kind of VPC resource (VSI, LB, SG, SGR, etc.).
Since I would only have a name or ID, it is helpful to have additional details as to what type of resource it is, IMHO.
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 dropped Type for now.
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.
same comments as above, if you have a plan on how to use that ID in controller that might help us in understanding this better.
f3e9c57
to
7afea68
Compare
api/v1beta2/types.go
Outdated
// bucketID is the IBM Cloud COS bucket ID. | ||
// +optional | ||
BucketID *string `json:"bucketID,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.
So if we want to reuse the same struct for PowerVS as well then lets add BucketName and Name here.
So this allows us to create and use the COSinstance and Bucket with user provided name.
Just for clarification, In PowerVS we create these resources to upload the ignition data.
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 plan to handle the process for VSI Custom Image using a VPC unique type instead, and since Ignition data management is expected to occur elsewhere, I don't think COS details like this are necessary. I will divert from the PowerVS path in respect to COS.
I will be removing this COSInstanceReference
type as I don't expect to need it for VPC based on my findings.
api/v1beta2/types.go
Outdated
|
||
// bucketID is the IBM Cloud COS bucket ID. | ||
// +optional | ||
BucketID *string `json:"bucketID,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.
I need to swap back to BucketName, I don't think the IBM COS SDK provides additional details I want to use this.
Regardless of whether I expect CAPI to create COS instances and buckets.
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.
@cjschaef I think we are mixing 2 things here - COS bucket for the image import and the ignition data. I recommend you @Karthik-K-N @Prajyot-Parab and @cjschaef please setup a meeting offline to discuss on the spec considering the amount of time we are left with for the implementation.
Sure, We can do this if there are still confusions on the workflow. |
@mkumatag @Karthik-K-N
Based on my discoveries, I have decided to drop COS altogether for VPC related support. References to any necessary COS resources will be handled as needed, using ObjectURL's, and not referencing Instances, Buckets, etc. |
7afea68
to
1e11e0a
Compare
@Karthik-K-N ptal, lets merge if all okay |
api/v1beta2/types.go
Outdated
@@ -396,3 +396,17 @@ type VPCEndpoint struct { | |||
// +optional | |||
LBID *string `json:"loadBalancerIPID,omitempty"` | |||
} | |||
|
|||
// VPCResource represents a specific VPC resource. | |||
// +kubebuilder:validation:XValidation:rule="!has(self.id) && !has(self.name)",message="an id or name must be provided" |
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 validation is written inversely, I will correct it.
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.
fixed.
Create a basic VPC resource type that VPC definitions will use.
1e11e0a
to
dc4e223
Compare
Create a basic VPC resource type that VPC definitions will use.
What this PR does / why we need it: VPC updates will need references to generic VPC resources. This could be shared with PowerVS, if they wish to adopt them.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes # N/A
Special notes for your reviewer: Replaces #1668
/area provider/ibmcloud
Release note: