-
Notifications
You must be signed in to change notification settings - Fork 325
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
CNI File watcher and pre applying rules setup #1345
Conversation
e6b21d4
to
f9c2da9
Compare
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.
First pass with some initial comments! More for me to read and do!
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.
Leaving my comments so far. I didn't get to review the tests yet! Will continue reviewing later today.
control-plane/cni/main.go
Outdated
return fmt.Errorf("annotation %s does not exist yet", annotation) | ||
} | ||
return err | ||
}, backoff.WithMaxRetries(backoff.NewConstantBackOff(1*time.Second), retries)) |
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 function will wait for 10 seconds for the annotation if I'm reading this correctly. Is this enough? I think on some clouds and depending on your pod, it might definitely take more than that to provision a pod and for endpoints controller to add this annotation.
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.
You were correct. The backoff is constant and would last 10 seconds total. I have set this to 30 retries (ie 30 seconds). We could do an ExponentialBackoff (it is a cool package) to slow down the retries but I think being responsive is better.
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.
need to remove
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.
Removed retries.
ad2d7e9
to
6fa5393
Compare
c876bb7
to
480a3f2
Compare
89105d7
to
760f472
Compare
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.
👍🏻
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.
Amazing work Curt!! You did such a great job on testing! I had a few suggestions in-line
control-plane/cni/main.go
Outdated
return types.PrintResult(result, cfg.CNIVersion) | ||
} | ||
|
||
pod.Annotations[keyTransparentProxyStatus] = waiting |
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 change it to waiting?
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 a simple way to show some sort of status that the CNI plugin is working. I have added a simple updateTransparentProxyStatusAnnotation
function to clean it up a bit so that we can have:
consul.hashicorp.com/transparent-proxy-status = waiting
and consul.hashicorp.com/transparent-proxy-status = complete
annotations on the pod.
Please let me know if you have better or more consistent status names.
control-plane/cni/main.go
Outdated
return fmt.Errorf("annotation %s does not exist yet", annotation) | ||
} | ||
return err | ||
}, backoff.WithMaxRetries(backoff.NewConstantBackOff(1*time.Second), retries)) |
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.
need to remove
time.Sleep(50 * time.Millisecond) | ||
// Filewatcher should have detected change, fixed and appended to the config file. Make sure | ||
// files match. | ||
require.Equal(t, string(expected), string(actual)) |
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.
time.Sleep(50 * time.Millisecond) | |
// Filewatcher should have detected change, fixed and appended to the config file. Make sure | |
// files match. | |
require.Equal(t, string(expected), string(actual)) | |
// Filewatcher should have detected change, fixed and appended to the config file. Make sure | |
// files match. | |
retry.Run(t, func(r *retry.R) { | |
require.Equal(r, string(expected), string(actual)) | |
}) |
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 added this to a few places that I thought were relevant.
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.
Looks good!! Just one minor suggestion.
Approving, assuming unit and acceptance tests are fixed before merge. For acceptance, you might need to rebase to get latest peering fixes.
* Get structure in place and CNI installer & plugin building
Add helm charts for CNI installer
* Get structure in place and CNI installer & plugin building
increase limits for CNI plugin so that it runs on GKE add annotations for transparent proxy status (enabled, waiting) Initial setup (CNI_ARGS) for getting information to the CNI plugin file watcher for config file changes and for when the config file does not exists added wait for annotation to be used before applying ipconfig traffic redirection Co-Authored-By: Thomas Eckert <[email protected]>
Co-authored-by: Iryna Shustava <[email protected]>
59dab7c
to
2a6759f
Compare
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
* Add file watcher to CNI installer to watch for config file changes and repair breakages. * Wait for CNI config file to show up on the host file system before attempting to install consul-cni configuration. * Add some code to get ready for the next PR that applying iptables rules * Unit tests for installer and plugin scenarios
Changes proposed in this PR:
How I've tested this PR:
How I expect reviewers to test this PR:
Or you can clone my cni-demo repo and run:
cd consul-cni-on-kind; make create-cluster deploy-calico deploy-consul hashicups
Note: the consul-cni will crashloop as I need to add the file watcher to it.
Checklist: