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

[Federation] Add simple upgrade test #43500

Merged
merged 1 commit into from Apr 19, 2017

Conversation

marun
Copy link
Contributor

@marun marun commented Mar 22, 2017

This PR adds a simple upgrade test that targets all registered federated types.

cc: @kubernetes/sig-federation-pr-reviews @perotinus

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 22, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-label-needed labels Mar 22, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 22, 2017
@marun marun changed the title Fed secret upgrade test WIP [Federation] Add upgrade test for secrets Mar 22, 2017
@marun marun force-pushed the fed-secret-upgrade-test branch 2 times, most recently from 19c10a7 to 6282955 Compare March 22, 2017 06:26
@marun
Copy link
Contributor Author

marun commented Mar 22, 2017

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?

@marun marun force-pushed the fed-secret-upgrade-test branch 2 times, most recently from 76121b6 to 0418044 Compare March 22, 2017 15:13
@perotinus
Copy link
Contributor

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

@marun
Copy link
Contributor Author

marun commented Mar 22, 2017

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

@marun
Copy link
Contributor Author

marun commented Mar 22, 2017

@perotinus I think the separate commits are at least coherent. The 2 big ones are just refactor, nothing new is being implemented.

@marun marun changed the title WIP [Federation] Add upgrade test for secrets [Federation] Add upgrade test for secrets Mar 22, 2017
@marun
Copy link
Contributor Author

marun commented Mar 22, 2017

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

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.

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

// 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 {
Copy link
Contributor

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?

@@ -0,0 +1,93 @@
/*
Copy link
Contributor

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?

Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

CRUDOperationExerciser? CRUDOperationValidator?

Copy link
Contributor Author

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 @@
/*
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Cluster

Copy link
Contributor Author

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 @@
/*
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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 @@
/*
Copy link
Contributor

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?

Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

control plane

Copy link
Contributor Author

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

SetUp

Copy link
Contributor Author

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

@marun marun Mar 24, 2017

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TearDown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto - implementing an interface.

@marun
Copy link
Contributor Author

marun commented Mar 24, 2017

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…

control plane

Done.


test/e2e_federation/upgrades/generic.go, line 39 at r1 (raw file):

Previously, perotinus (Jonathan MacMillan) wrote…

SetUp

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…

Why isn't the client responsible for waiting on the channel?

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.


test/e2e_federation/upgrades/generic.go, line 57 at r1 (raw file):

Previously, perotinus (Jonathan MacMillan) wrote…

TearDown

ditto - implementing an interface.


Comments from Reviewable

@marun
Copy link
Contributor Author

marun commented Mar 24, 2017

ugh, reviewable fail

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 24, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 13, 2017
@marun
Copy link
Contributor Author

marun commented Apr 13, 2017

rebased

@marun
Copy link
Contributor Author

marun commented Apr 13, 2017

@k8s-bot bazel test this

@marun
Copy link
Contributor Author

marun commented Apr 17, 2017

rebased

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@marun
Copy link
Contributor Author

marun commented Apr 17, 2017

Updated bazel

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@marun
Copy link
Contributor Author

marun commented Apr 17, 2017

rebased

@k8s-bot pull-kubernetes-federation-e2e-gce test this

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 17, 2017
@marun
Copy link
Contributor Author

marun commented Apr 17, 2017

@shashidharatd Thoughts?

@@ -25,7 +25,7 @@ import (
. "github.com/onsi/ginkgo"
)

var upgradeTests = []upgrades.Test{}
var upgradeTests = upgrades.SimpleUpgradeTests()

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.

Copy link
Contributor Author

@marun marun Apr 18, 2017

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 {

Choose a reason for hiding this comment

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

comment not matching function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@shashidharatd
Copy link

@marun, a couple of minor issues, otherwise LGTM

}

// SecretUpgradeTests collects simple upgrade tests for registered federated types
func SimpleUpgradeTests() []Test {

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. Done.

@shashidharatd
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 19, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 19, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit bdc2b20 into kubernetes:master Apr 19, 2017
@marun marun deleted the fed-secret-upgrade-test branch April 19, 2017 17:59
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. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants