Skip to content

🌱 Deduplicate AdoptMachinePorts and AdoptBastionPorts #1944

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

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

mdbooth
Copy link
Contributor

@mdbooth mdbooth commented Mar 12, 2024

Both of these methods rely on ReferencedMachineResources and DependentMachineResources, so they can be easily refactored to have a common implementation.

Fixes: #1942

This PR is based on #1941, so we should merge that first.

TODO:

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 12, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mdbooth

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 12, 2024
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 12, 2024
Copy link

netlify bot commented Mar 12, 2024

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

Name Link
🔨 Latest commit 750af59
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65f95c4513caf0000898d7ab
😎 Deploy Preview https://deploy-preview-1944--kubernetes-sigs-cluster-api-openstack.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.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 15, 2024
@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 15, 2024

/test pull-cluster-api-provider-openstack-e2e-full-test

@EmilienM
Copy link
Contributor

/test pull-cluster-api-provider-openstack-e2e-full-test

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2024
@EmilienM
Copy link
Contributor

/test pull-cluster-api-provider-openstack-e2e-full-test

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 16, 2024
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 16, 2024
@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 16, 2024

/test pull-cluster-api-provider-openstack-e2e-full-test

@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 16, 2024

/test pull-cluster-api-provider-openstack-e2e-full-test

@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 18, 2024

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 18, 2024
@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 18, 2024

#1954 was the root cause of most of the full-test CI failures in this PR. This PR includes a change, which we needed to make anyway, which avoids the issue in most cases: we don't need to re-reconcile if we only adopted. However, the underlying issue remains. I'll push a separate PR to fix that.

@@ -25,7 +25,7 @@ import (
func AdoptDependentMachineResources(scope *scope.WithLogger, baseName string, referencedResources *infrav1.ReferencedMachineResources, dependentResources *infrav1.DependentMachineResources) error {
networkingService, err := networking.NewService(scope)
if err != nil {
return false, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this change should be in a different commit? It's syntax error otherwise.

@dulek
Copy link
Contributor

dulek commented Mar 18, 2024

Alright, I only found one issue with a change done in the last commit, when it should be done in the middle one. Let's fix that so that reverts would be possible? Or just squash the commits.

@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 19, 2024

Alright, I only found one issue with a change done in the last commit, when it should be done in the middle one. Let's fix that so that reverts would be possible? Or just squash the commits.

Thanks. I'll tidy them up but keep them separate, as I've been trying to make smaller, functional commits. When you look at the next one in this series, though, you'll see how that's going 😟

mdbooth added 3 commits March 19, 2024 09:27
Both of these methods rely on ReferencedMachineResources and
DependentMachineResources, so they can be easily refactored to have a
common implementation.
Unlike referenced resources, which specify a future intent, adoption
only affects resources which have already been created. Successive
executions will produce the same output, so there is no need to
re-reconcile if we found orphaned resources.

Also we seem to be hitting this a lot in practise, most likely due to
the controller-runtime read-after-write cache inconsistency issue.
We can't resolve machine resources until the cluster is initialised.
@mdbooth
Copy link
Contributor Author

mdbooth commented Mar 19, 2024

I've cleaned that up and re-run the non-e2e tests against each commit individually. I also rebased on to main to pick up #1955, which is important for this series.

@dulek
Copy link
Contributor

dulek commented Mar 19, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 19, 2024
@k8s-ci-robot k8s-ci-robot merged commit 27b3cef into kubernetes-sigs:main Mar 19, 2024
@pierreprinetti pierreprinetti deleted the issue1942 branch October 16, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Deduplicate port adoption code between machines and bastion
4 participants