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

Update to CAPI 1.5 #342

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Update to CAPI 1.5 #342

wants to merge 6 commits into from

Conversation

hrak
Copy link
Contributor

@hrak hrak commented Feb 6, 2024

Issue #, if available:

#285
#253

Description of changes:

This PR updates the cluster-api dependency to v1.5.5. It also updates to Go 1.20, updates golang-ci and addresses lint issues caught by the new version (mostly unused variables in function definitions)

Testing performed:

make test
test with kind

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 6, 2024
@hrak hrak marked this pull request as draft February 6, 2024 15:07
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 6, 2024
Copy link

netlify bot commented Feb 6, 2024

Deploy Preview for kubernetes-sigs-cluster-api-cloudstack ready!

Name Link
🔨 Latest commit 3c0fa55
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-cloudstack/deploys/66217253e287780008b8b2e8
😎 Deploy Preview https://deploy-preview-342--kubernetes-sigs-cluster-api-cloudstack.netlify.app
📱 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 configuration.

@codecov-commenter
Copy link

Codecov Report

Attention: 37 lines in your changes are missing coverage. Please review.

Comparison is base (7fd4146) 25.45% compared to head (6838e34) 25.38%.

❗ Current head 6838e34 differs from pull request most recent head dcdf474. Consider uploading reports for the commit dcdf474 to get more accurate results

Files Patch % Lines
controllers/cloudstackmachine_controller.go 58.33% 11 Missing and 4 partials ⚠️
controllers/cloudstackcluster_controller.go 37.50% 4 Missing and 1 partial ⚠️
api/v1beta3/cloudstackcluster_webhook.go 57.14% 3 Missing ⚠️
api/v1beta3/cloudstackmachine_webhook.go 57.14% 3 Missing ⚠️
api/v1beta3/cloudstackmachinetemplate_webhook.go 57.14% 3 Missing ⚠️
api/v1beta1/conversion.go 0.00% 2 Missing ⚠️
api/v1beta1/cloudstackaffinitygroup_conversion.go 0.00% 1 Missing ⚠️
...pi/v1beta1/cloudstackisolatednetwork_conversion.go 0.00% 1 Missing ⚠️
api/v1beta1/cloudstackmachine_conversion.go 0.00% 1 Missing ⚠️
...pi/v1beta1/cloudstackmachinetemplate_conversion.go 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
- Coverage   25.45%   25.38%   -0.08%     
==========================================
  Files          59       59              
  Lines        5555     5535      -20     
==========================================
- Hits         1414     1405       -9     
+ Misses       4002     3990      -12     
- Partials      139      140       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hrak hrak marked this pull request as ready for review February 7, 2024 09:25
@hrak hrak changed the title [WIP] Update to CAPI 1.5 Update to CAPI 1.5 Feb 7, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 7, 2024
@rohityadavcloud
Copy link
Member

I haven't tested it, but in theory we must upgrade to CAPI 1.5 or whatever may be the latest. I would want to see an easily v0.5 release.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 8, 2024
@rohityadavcloud
Copy link
Member

cc @shwstppr we'll need that CI fixed soon 🙏

@g-gaston
Copy link
Contributor

g-gaston commented Feb 8, 2024

/run-e2e -c 4.18
let's see if we get anything

@g-gaston
Copy link
Contributor

g-gaston commented Feb 8, 2024

/retest

@blueorangutan
Copy link

@g-gaston Invalid command: /run-e2e -c 4.18
let's see if we get anything

  • Unsupported CloudStack version: 4.18
    let's

The command to run e2e test for CAPC.

Usage: /run-e2e [-k Kubernetes_Version] [-c CloudStack_Version] [-h Hypervisor] [-i Template/Image] [-f Kubernetes_Version_Upgrade_From] [-t Kubernetes_Version_Upgrade_To]

  • Supported Kubernetes versions are: ['1.27.2', '1.26.5', '1.25.10', '1.24.14', '1.23.3', '1.22.6']. The default value is '1.27.2'.
  • Supported CloudStack versions are: ['4.18', '4.17', '4.16']. If it is not set, an existing environment will be used.
  • Supported hypervisors are: ['kvm', 'vmware', 'xen']. The default value is 'kvm'.
  • Supported templates are: ['ubuntu-2004-kube', 'rockylinux-8-kube']. The default value is 'ubuntu-2004-kube'.
  • By default it tests Kubernetes upgrade from version '1.26.5' to '1.27.2'.

Examples:

  • /run-e2e
  • /run-e2e -k 1.27.2 -h kvm -i ubuntu-2004-kube
  • /run-e2e -k 1.27.2 -c 4.18 -h kvm -i ubuntu-2004-kube -f 1.26.5 -t 1.27.2

@rohityadavcloud
Copy link
Member

/run-e2e -c 4.18

@blueorangutan
Copy link

@rohityadavcloud a jenkins job has been kicked to run test with following paramaters:

  • kubernetes version: 1.27.2
  • CloudStack version: 4.18
  • hypervisor: kvm
  • template: ubuntu-2004-kube
  • Kubernetes upgrade from: 1.26.5 to 1.27.2

@pokearu
Copy link

pokearu commented Feb 14, 2024

/test capi-provider-cloudstack-presubmit-e2e-smoke-test

@pokearu
Copy link

pokearu commented Feb 16, 2024

Hi @g-gaston @rohityadavcloud I ran the e2e suit manually to test the CAPI changes. And got a successful run ✅

Not sure why the presubmit is failing, make run-e2e-smoke works for me locally just fine.

@rohityadavcloud
Copy link
Member

/test capi-provider-cloudstack-presubmit-e2e-smoke-test

@rohityadavcloud
Copy link
Member

/run-e2e -c 4.18

@blueorangutan
Copy link

@rohityadavcloud a jenkins job has been kicked to run test with following paramaters:

  • kubernetes version: 1.27.2
  • CloudStack version: 4.18
  • hypervisor: kvm
  • template: ubuntu-2004-kube
  • Kubernetes upgrade from: 1.26.5 to 1.27.2

@rohityadavcloud
Copy link
Member

Thanks for testing @pokearu, @g-gaston @hrak is this ready for merging or need further review/testing? There was also an idea to skip and move to CAPI 1.6 ?

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2024
@@ -182,6 +183,7 @@ func (r *CloudStackMachineReconciliationRunner) SetFailureDomainOnCSMachine() (r
name = *r.CAPIMachine.Spec.FailureDomain
r.ReconciliationSubject.Spec.FailureDomainName = *r.CAPIMachine.Spec.FailureDomain
} else { // Not a control plane machine. Place randomly.
rand := rand.New(rand.NewSource(time.Now().Unix())) // #nosec G404 -- weak crypt rand doesn't matter here.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: should we make this a field in the reconciler? It helps with testing

if err != nil {
r.Log.Error(err, "GetOrCreateVMInstance returned error")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we log the error if we are already returning it? Is it being silenced somewhere?

@@ -298,6 +301,9 @@ func (r *CloudStackMachineReconciliationRunner) AddToLBIfNeeded() (retRes ctrl.R
// GetOrCreateMachineStateChecker creates or gets CloudStackMachineStateChecker object.
func (r *CloudStackMachineReconciliationRunner) GetOrCreateMachineStateChecker() (retRes ctrl.Result, reterr error) {
checkerName := r.ReconciliationSubject.Spec.InstanceID
if checkerName == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good addition. However, i would prefer if we only included in this pr changes that are strictly required for the capi upgrade. Else, it makes very difficult to keep track of the rationale behind changes once the review context of this pr fades away.

@@ -298,6 +301,9 @@ func (r *CloudStackMachineReconciliationRunner) AddToLBIfNeeded() (retRes ctrl.R
// GetOrCreateMachineStateChecker creates or gets CloudStackMachineStateChecker object.
func (r *CloudStackMachineReconciliationRunner) GetOrCreateMachineStateChecker() (retRes ctrl.Result, reterr error) {
checkerName := r.ReconciliationSubject.Spec.InstanceID
if checkerName == nil {
return ctrl.Result{}, errors.New(CSMachineStateCheckerCreationFailed)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we return an error that actually says that instance id is nil?

WithEventFilter(
predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
// Avoid reconciling if the event triggering the reconciliation is related to incremental status updates
// for CloudStackMachine resources only
if _, ok := e.ObjectOld.(*infrav1.CloudStackMachine); !ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this new code or coming from somewhere else? I can't find it sorry
Asking bc i don't really understand why is this needed

K8sClient client.Client
CSClient cloud.Client
Recorder record.EventRecorder
WatchFilterValue string
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this new field for?
if it's not used by the base reconciler, can we put it where it's used?


// CloudStackClusterToCloudStackMachines is a handler.ToRequestsFunc to be used to enqeue requests for reconciliation
// of CloudStackMachines.
func CloudStackClusterToCloudStackMachines(c client.Client, obj runtime.Object, scheme *runtime.Scheme, log logr.Logger) (handler.MapFunc, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add unit test for these 2 new methods?

@rohityadavcloud
Copy link
Member

Hi @hrak - @g-gaston has advised me to try to get this PR in the next release, could you help rebase/address conflicts and any outstanding review remarks? Thanks.

@chrisdoherty4
Copy link
Member

/uncc @chrisdoherty4

@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 18, 2024
hrak and others added 6 commits April 18, 2024 21:19
Signed-off-by: Hans Rakers <h.rakers@global.leaseweb.com>
Signed-off-by: Hans Rakers <h.rakers@global.leaseweb.com>
Signed-off-by: Hans Rakers <h.rakers@global.leaseweb.com>
Signed-off-by: Hans Rakers <h.rakers@global.leaseweb.com>
Signed-off-by: Hans Rakers <h.rakers@global.leaseweb.com>
@hrak
Copy link
Contributor Author

hrak commented Apr 18, 2024

PR updated for CAPI v1.5.8. Sorry for the delay.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 18, 2024
if err != nil {
return errors.Wrap(err, "failed to create CloudStackClusterToCloudStackMachines mapper")
}
//requeueCloudStackMachinesForUnpausedCluster := reconciler.requeueCloudStackMachinesForUnpausedCluster(ctx)
Copy link
Member

Choose a reason for hiding this comment

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

Remove commented code.

@vishesh92
Copy link
Member

@hrak there are some unresolved comments by @g-gaston. Can you please address/resolve them?

@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 24, 2024
@vishesh92
Copy link
Member

This PR has some conflicts and some comments needs to be addressed/resolved. Changing milestone for this PR to v0.6.0 for now.

@vishesh92 vishesh92 modified the milestones: v0.5.0, v0.6 May 31, 2024
@hrak
Copy link
Contributor Author

hrak commented Jul 8, 2024

Hi, I'm sorry I haven't been able to dedicate much time on this lately cause I'm swamped in launching our k8s product at work. I will update the PR when i have some time.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release:must-have size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CAPI v1.5.0-beta.0 has been released and is ready for testing
10 participants