Skip to content

add service controller for identity registry support#1951

Merged
istio-merge-robot merged 2 commits intoistio:masterfrom
crazytan:registry
Dec 4, 2017
Merged

add service controller for identity registry support#1951
istio-merge-robot merged 2 commits intoistio:masterfrom
crazytan:registry

Conversation

@crazytan
Copy link
Copy Markdown
Contributor

@crazytan crazytan commented Dec 1, 2017

What this PR does / why we need it:
It adds a service controller, that is similar to secret controller and listens for events related to Service objects. Therefore another goroutine is started in CA which does nothing currently. service_test.go demonstrates how a very simple registry should work with the controller.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes istio/old_auth_repo#293

Special notes for your reviewer:
I also removed unreachable code at the end of main().

Release note:

NONE

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Extra blank line

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this WIP as all the handlers are empty?

Also it'd be strange if eventually all the handlers are defined here in main.go.

Copy link
Copy Markdown
Contributor Author

@crazytan crazytan Dec 1, 2017

Choose a reason for hiding this comment

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

I want to submit controller and registry in two PRs so I added an empty controller here.

Yes it is. In next PR registry will be created in its own package and the handlers will be defined there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just curious why this change is needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I felt it's better to change it because the last line is unreachable. stopCh passed to cache controller is actually expected to be called by main(), not the controller. So <-stopCh here causes main to block forever, but I think it's clearer to just use select {} here to prevent future confusion about the stopCh usage. See https://github.com/kubernetes/client-go/blob/master/tools/cache/controller.go#L97:8

Copy link
Copy Markdown
Contributor

@wattli wattli left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What value does the stopCh expect? And how to send that value?

Copy link
Copy Markdown
Contributor Author

@crazytan crazytan Dec 1, 2017

Choose a reason for hiding this comment

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

An empty struct (struct{}{}) would suffice. Whoever is calling the Run can send the value to stopCh so that the underlying controllers are stopped. See original doc https://github.com/kubernetes/client-go/blob/master/tools/cache/controller.go#L97:8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add some comments here to explain what it does? And if possible, please do the similar thing to the above NewSecretController as well, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will do!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The docs are at the struct definition for both controllers.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 1, 2017

Codecov Report

Merging #1951 into master will decrease coverage by 0.31%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1951      +/-   ##
==========================================
- Coverage   82.08%   81.77%   -0.32%     
==========================================
  Files         198      191       -7     
  Lines       16320    15565     -755     
==========================================
- Hits        13397    12728     -669     
+ Misses       2480     2383      -97     
- Partials      443      454      +11
Flag Coverage Δ
#broker 47.27% <ø> (ø) ⬆️
#mixer 83.28% <ø> (-0.41%) ⬇️
#pilot 80.78% <ø> (+0.2%) ⬆️
#security 92.03% <ø> (ø) ⬆️
Impacted Files Coverage Δ
mixer/adapter/prometheus/prometheus.go 75.24% <0%> (-3.79%) ⬇️
mixer/adapter/denier/denier.go 88.88% <0%> (-3.22%) ⬇️
mixer/pkg/config/validator.go 89.38% <0%> (-0.62%) ⬇️
mixer/pkg/aspect/descriptors.go 100% <0%> (ø) ⬆️
mixer/adapter/memquota/rollingWindow.go 100% <0%> (ø) ⬆️
mixer/pkg/runtime/init.go
mixer/pkg/runtime/resourceType.go
mixer/pkg/runtime/env.go
mixer/pkg/runtime/resolver.go
mixer/pkg/runtime/dispatcher.go
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6889c52...1c12625. Read the comment docs.

@wattli
Copy link
Copy Markdown
Contributor

wattli commented Dec 4, 2017

/lgtm
/approve
Thanks for doing this.

@istio-merge-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wattli

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

Details 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

@istio-merge-robot
Copy link
Copy Markdown

/test all [submit-queue is verifying that this PR is safe to merge]

@istio-merge-robot
Copy link
Copy Markdown

Automatic merge from submit-queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add identity registry support

6 participants