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

Feat/global plugins #112

Merged
merged 4 commits into from
Sep 10, 2018
Merged

Feat/global plugins #112

merged 4 commits into from
Sep 10, 2018

Conversation

hbagdi
Copy link
Member

@hbagdi hbagdi commented Aug 31, 2018

There are cases where a plugin(s) should be executed for all proxied
requests. In order to do this with the existing model, it becomes
cumbersome to configure it for 100s of different services and would make
sense to configure globally for all services. This feature is already
supported by Kong.

With this change, all KongPlugin resources that have a label of
"global" : "true" will be setup as global plugins in Kong
by the Ingress controller.

hbagdi added 3 commits August 30, 2018 16:35
This is part of a patchset for enabling global plugins to be created in
Kong via the ingress controller.
This is part of a patchset introducing support for global plugins in
Kong via the ingress controller.
This is a backwards compatible change.

This commit will have long-term effects in how plugins are configured
via Ingress and custom resources as explained below:

Currently, to apply a plugin to one has to add an annotation of the
form:
```
rate-limiting.plugin.konghq.com: plugin-conf
```
where `rate-limiting` is the name of the plugin that needs to be
created while `plugin-conf` is the plugin conf that should be used for
that plugin.

This is not as user-friendly as it should be, especially considering
that different kinds of plugins in Kong have different configuration
objects.

This allows us to keep configuration and plugin names together and in
future the annotations could be much more compact and easier to pass
around:
```
plugin.konghq.com: plugin-conf1,plugin-conf2
```
@codecov-io
Copy link

codecov-io commented Aug 31, 2018

Codecov Report

Merging #112 into master will decrease coverage by 2.72%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
- Coverage   32.09%   29.37%   -2.73%     
==========================================
  Files          33       33              
  Lines        2891     3183     +292     
==========================================
+ Hits          928      935       +7     
- Misses       1850     2135     +285     
  Partials      113      113
Impacted Files Coverage Δ
internal/ingress/controller/store/store.go 49.2% <0%> (-2.12%) ⬇️
internal/ingress/controller/kong.go 1.61% <0%> (+0.38%) ⬆️

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 a8838ab...5c5ccb6. Read the comment docs.

}
if _, ok := targetPluginMap[name]; ok {
glog.Error("Multiple KongPlugin definitions found with 'global' annotation for :", name,
", the plugin will not be applied")
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the behavior here is to not load all plugins with the same name (as in L147-150, if i understand if correctly), should we also put that into the error log (and further more in the doc)?
Something like Multiple KongPlugin definitions with same name found with 'global' annotation, all plugin defined with name '", name, "' will not be loaded

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the current error message makes sense as it conveys the essence of the error.
I'll be putting in docs later in a separate PR.

Copy link
Contributor

@fffonion fffonion left a comment

Choose a reason for hiding this comment

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

👍

There are cases where a plugin(s) should be executed for all proxied
requests. In order to do this with the existing model, it becomes
cumbersome to configure it for 100s of different services and would make
sense to configure globally for all services. This feature is already
supported by Kong.

With this change, all KongPlugin resources that have a label of
`"global" : "true"` will be setup as global plugins in Kong
by the Ingress controller.
@hbagdi hbagdi force-pushed the feat/global-plugins branch from 36053e9 to 5c5ccb6 Compare September 10, 2018 15:45
@hbagdi hbagdi merged commit 2c99413 into master Sep 10, 2018
@hbagdi hbagdi deleted the feat/global-plugins branch September 10, 2018 17:25
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.

3 participants