-
Notifications
You must be signed in to change notification settings - Fork 224
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
[WIP] test framework to test concurrent controllers with linearization #1713
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tkashem 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 |
13ddc2e
to
6f5bc99
Compare
729d0d1
to
fdab34a
Compare
@@ -183,7 +183,7 @@ func getValidityFromAnnotations(annotations map[string]string) (notBefore time.T | |||
|
|||
// setSigningCertKeyPairSecret creates a new signing cert/key pair and sets them in the secret | |||
func setSigningCertKeyPairSecret(signingCertKeyPairSecret *corev1.Secret, validity time.Duration) error { | |||
signerName := fmt.Sprintf("%s_%s@%d", signingCertKeyPairSecret.Namespace, signingCertKeyPairSecret.Name, time.Now().Unix()) | |||
signerName := fmt.Sprintf("%s_%s@%d", signingCertKeyPairSecret.Namespace, signingCertKeyPairSecret.Name, time.Now().UnixNano()) |
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.
That seems to be required for tests only, right? I don't think its suitable for production though, as it may grow too large?
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, for tests only, if we want to make sure the annotation changes as expected, otherwise we have to add sleep
to the test
pkg/testing/linearizer/linearizer.go
Outdated
) | ||
|
||
/* | ||
A controller has this sequence: Get, Create, and 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.
Create
here assumes "Delete and Create" on type change or its purely "Create" when the item doesn't exist?
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 is just an example to demonstrate how the framework generates the API call sequence, we could replace the Create/Delete with DoFoo/DoBar here
pkg/testing/linearizer/linearizer.go
Outdated
d *dispatcher | ||
} | ||
|
||
func (a actor) Start() <-chan 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.
Why do we have "start" as separate action? Its not a kube-apiserver request, so we don't need it on the graph
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.
it's so that we can linearize the startup logic as well, the test here doesn't instrument the lister logic and a controller can start with a get from the lister.
A lister reacts to the state of the storage, so as long as we linearize all the API invocations we are good, this also means that the startup logic must me linearized as well.
fdab34a
to
246c2d7
Compare
@tkashem: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
This may be useful in case we won't be able to avoid having a proper leader election for copies of the controller - or we find a resource managed by multiple controllers. |
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
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. |
No description provided.