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
[Federation] Add simple upgrade test #43500
[Federation] Add simple upgrade test #43500
Conversation
fbc75b8
to
b1f6bc9
Compare
b1f6bc9
to
3665749
Compare
19c10a7
to
6282955
Compare
This is admittedly too big even excluding #42025's commits, and it might be easier to review each commit separately. What's the timeline on upgrade testing, and will it be able to merge before master is opened back up? |
76121b6
to
0418044
Compare
@marun Do you want me to start reviewing this yet? Are you planning to do something to make it easier to review, or should I review the three commits you mentioned? |
0418044
to
16af4f5
Compare
@perotinus I'm happy to break this up into separate PRs if that makes sense to you, but if you're willing to tackle it as is please do. |
@perotinus I think the separate commits are at least coherent. The 2 big ones are just refactor, nothing new is being implemented. |
/assign @shashidharatd |
federation/BUILD
Outdated
@@ -26,6 +26,7 @@ filegroup( | |||
"//federation/cmd/genfeddocs:all-srcs", | |||
"//federation/cmd/kubefed:all-srcs", | |||
"//federation/develop:all-srcs", | |||
"//federation/pkg/crud:all-srcs", |
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.
Naming nit: crudmachinery? crudtestmachinery? I worry that crud isn't a descriptive enough name, and could be mistaken for something that deals with CRUD operations in federation production code rather than as a test harness.
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.
Or, is part of this change reconceptualizing the CRUD machinery as something to use in production code?
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.
Yes.
federation/pkg/crud/resource.go
Outdated
// type for which an implementation of this interface exists. | ||
// | ||
// TODO reuse resource adapters defined for use with a generic controller as per | ||
// https://github.com/kubernetes/kubernetes/pull/41050 | ||
type ResourceAdapter interface { |
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.
As long as you're moving this, perhaps it's worth documenting the methods in the interface?
federation/pkg/crud/secret.go
Outdated
@@ -0,0 +1,93 @@ | |||
/* |
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.
Didn't this code exist somewhere else already? I thought I reviewed this previously. Is there something you can base this off of?
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 goal of this refactor commit is separating the integration-specific stuff from the stuff that can be reused in integration/e2e/controllers. This is the stuff that can be reused.
// federated types via the Federation API and validates that the | ||
// results of those operations are propagated to clusters that are | ||
// members of a federation. | ||
type CRUDHelper struct { |
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.
CRUDOperationExerciser? CRUDOperationValidator?
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.
Done
@@ -0,0 +1,215 @@ | |||
/* |
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 too. Can you base this off of something else?
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.
ditto. This was moved from test/integration/federation/framework. Are you not seeing the code being moved from there to here?
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.
No, I'm not. I'm seeing a new file rather than a diff from the old file. Lots of green, and St. Patrick's Day is over now.
|
||
type ClusterMap map[string]*Cluster | ||
|
||
// cluster keeps track of the assorted objects and state related to each cluster |
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.
Cluster
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.
Done
@@ -0,0 +1,164 @@ | |||
/* |
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.
Is it worth basing this off of the file that has much of its source? It would be nice not to lose the history.
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.
As per our discussion online, git doesn't support 'forking' a file with history.
} | ||
} | ||
|
||
func ClusterIsReadyOrFail(f *Framework, context *E2EContext) { |
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.
Can you document this while you're here?
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.
Done
@@ -388,7 +388,6 @@ staging/src/k8s.io/kube-aggregator/pkg/client/listers/apiregistration/v1alpha1 | |||
staging/src/k8s.io/sample-apiserver |
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 you need to rebase your commit? Looks like this should follow through from where it was added.
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 don't follow. All I'm doing here is disabling linting for test/e2e_federation/upgrade so it's possible to dot import ginkgo for the upgrade test.
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.
Ah, OK. I assumed this some sort of automagically-generated updated that didn't get propagated.
@@ -0,0 +1,44 @@ | |||
/* |
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.
Does this belong in this commit?
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 allows the crud helper to be used for the upgrade test.
) | ||
|
||
// GenericUpgradeTest validates that a federated resource remains | ||
// propagated before and after a controlplane upgrade |
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.
control plane
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.
Done
} | ||
|
||
// Setup creates a resource and validates its propagation to member clusters | ||
func (t *GenericUpgradeTest) Setup(f *fedframework.Framework) { |
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.
SetUp
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.
While your logic regarding SetUp vs Setup may be sound, I'm just being consistent with the interface I'm implementing:
The federation upgrade interface is based on the kubernetes one:
} | ||
|
||
// Test validates that a resource remains propagated post-upgrade | ||
func (t *GenericUpgradeTest) Test(f *fedframework.Framework, done <-chan struct{}, upgrade FederationUpgradeType) { |
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.
Why isn't the client responsible for waiting on the channel?
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'm not sure what you mean. As per the documentation for the kube upgrade framework, the Test method is intended to support validating behavior during the upgrade and afterwards, with the done channel providing the signal for when the upgrade has been completed. In the case of federation, there goal is currently only to test after the upgrade has been completed, as indicated by the closing of the channel.
} | ||
|
||
// Teardown cleans up remaining resources | ||
func (t *GenericUpgradeTest) Teardown(f *fedframework.Framework) { |
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.
TearDown
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.
ditto - implementing an interface.
Review status: 0 of 44 files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. test/e2e_federation/upgrades/generic.go, line 31 at r1 (raw file): Previously, perotinus (Jonathan MacMillan) wrote…
Done. test/e2e_federation/upgrades/generic.go, line 39 at r1 (raw file): Previously, perotinus (Jonathan MacMillan) wrote…
While your logic regarding SetUp vs Setup may be sound, I'm just being consistent with the interface I'm implementing: The federation upgrade interface is based on the kubernetes one: test/e2e_federation/upgrades/generic.go, line 50 at r1 (raw file): Previously, perotinus (Jonathan MacMillan) wrote…
I'm not sure what you mean. As per the documentation for the kube upgrade framework, the test/e2e_federation/upgrades/generic.go, line 57 at r1 (raw file): Previously, perotinus (Jonathan MacMillan) wrote…
ditto - implementing an interface. Comments from Reviewable |
ugh, reviewable fail |
c1e763d
to
ea103db
Compare
ea103db
to
d2ae2b2
Compare
rebased |
@k8s-bot bazel test this |
d2ae2b2
to
a32936b
Compare
rebased @k8s-bot pull-kubernetes-federation-e2e-gce test this |
a32936b
to
d146cb5
Compare
Updated bazel @k8s-bot pull-kubernetes-federation-e2e-gce test this |
d146cb5
to
73abdb4
Compare
rebased @k8s-bot pull-kubernetes-federation-e2e-gce test this |
@shashidharatd Thoughts? |
@@ -25,7 +25,7 @@ import ( | |||
. "github.com/onsi/ginkgo" | |||
) | |||
|
|||
var upgradeTests = []upgrades.Test{} | |||
var upgradeTests = upgrades.SimpleUpgradeTests() |
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.
Since we will be adding upgrade tests for more than simple types, please add SimpleUpgradeTests to the upgradeTests slice instead assigning.
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.
YAGNI - whoever ends up adding more types tests can figure out how best to add to the slice.
Also, I'm calling it 'simple' for now, but I anticipate being able to perform upgrade tests generically on all resources by the end of 1.7.
|
||
// SecretUpgradeTest validates that a secret remains propagated before | ||
// and after a controlplane upgrade | ||
func SimpleUpgradeTests() []Test { |
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.
comment not matching function
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.
Done.
@marun, a couple of minor issues, otherwise LGTM |
73abdb4
to
8d0386f
Compare
} | ||
|
||
// SecretUpgradeTests collects simple upgrade tests for registered federated types | ||
func SimpleUpgradeTests() []Test { |
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.
SecretUpgradeTests should have been SimpleUpgradeTests in comment
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.
Oops. Done.
8d0386f
to
9dc74d6
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: marun, shashidharatd
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue |
This PR adds a simple upgrade test that targets all registered federated types.
cc: @kubernetes/sig-federation-pr-reviews @perotinus