Skip to content

Commit ce21314

Browse files
committed
Merge branch 'next'
2 parents 82cdf47 + 61d0c07 commit ce21314

File tree

15 files changed

+159
-71
lines changed

15 files changed

+159
-71
lines changed

CHANGELOG.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,59 @@
11
# Table of Contents
22

3+
- [0.2.0](#020-20180921)
34
- [0.1.0](#010-20180817)
45
- [0.0.5](#005---20180602)
56
- [0.0.4 and prior](#004-and-prior)
67

78

9+
## [0.2.0] - 2018/09/21
10+
11+
#### Breaking Changes
12+
13+
- :warning: Support for Kong 0.13.x has been dropped in favor of 0.14.x
14+
15+
#### Deprecated
16+
17+
- :warning: Configuring plugins in Kong using `<plugin-name>.plugin.konghq.com`
18+
annotation is now deprecated and will be removed in a future release.
19+
Please use `plugins.konghq.com` annotation instead.
20+
21+
#### Added
22+
23+
- **Support for Kong 0.14.x** The supported version of Kong 0.14.x
24+
has been introduced. Kong 0.14.x introduced breaking changes to a few
25+
Admin API endpoints which have been updated in the Ingress Controller.
26+
[#101](https://github.com/Kong/kubernetes-ingress-controller/pull/101)
27+
- **Global Plugins** Plugins can be configured to run globally in Kong
28+
using a "global" label on `KongPlugin` resource.
29+
[#112](https://github.com/Kong/kubernetes-ingress-controller/pull/112)
30+
- A new property `plugin` has been introduced in `KongPlugin` resource
31+
which ties the configuration to be used and the type of the plugin.
32+
[#122](https://github.com/Kong/kubernetes-ingress-controller/pull/122)
33+
- Multiple plugins can be configured for an Ingress or a Service in k8s
34+
using `plugins.konghq.com` annotation.
35+
[#124](https://github.com/Kong/kubernetes-ingress-controller/pull/124)
36+
- `KongPlugin` resources do not need to be duplicated any more.
37+
The same `KongPlugin` resource can be used across
38+
multiple Ingress/Service resources.
39+
[#121](https://github.com/Kong/kubernetes-ingress-controller/pull/121)
40+
- The custom resource definitions now have a shortname for all the
41+
CRDs, making it easy to interract with `kubectl`.
42+
[#120](https://github.com/Kong/kubernetes-ingress-controller/pull/120)
43+
44+
#### Fixed
45+
46+
- Avoid issuing unnecessary PATCH requests on Services in Kong during the
47+
reconcillation loop, which lead to unnecessary Router rebuilds inside Kong.
48+
[#107](https://github.com/Kong/kubernetes-ingress-controller/pull/107)
49+
- Fixed the diffing logic for plugin configuration between KongPlugin
50+
resource in k8s and plugin config in Kong to avoid false positives.
51+
[#106](https://github.com/Kong/kubernetes-ingress-controller/pull/106)
52+
- Correctly format IPv6 address for Targets in Kong.
53+
Thanks @NixM0nk3y for the patch!
54+
[#118](https://github.com/Kong/kubernetes-ingress-controller/pull/118)
55+
56+
857
## [0.1.0] - 2018/08/17
958

1059
#### Breaking Changes
@@ -45,6 +94,7 @@
4594
- The initial versions rapidly were iterated delivering
4695
a working ingress controller.
4796

97+
[0.2.0]: https://github.com/kong/kubernetes-ingress-controller/compare/0.1.0...0.2.0
4898
[0.1.0]: https://github.com/kong/kubernetes-ingress-controller/compare/v0.0.5...0.1.0
4999
[v0.0.5]: https://github.com/kong/kubernetes-ingress-controller/compare/v0.0.4...v0.0.5
50100
[v0.0.4]: https://github.com/kong/kubernetes-ingress-controller/compare/7866a27f268c32c5618fba546da2c73ba74d4a46...v0.0.4

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ all: all-container
1818
BUILDTAGS=
1919

2020
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
21-
TAG?=0.1.0
21+
TAG?=0.2.0
2222
REGISTRY?=kong-docker-kubernetes-ingress-controller.bintray.io
2323
GOOS?=linux
2424
DOCKER?=docker

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repository contains an Ingress controller for Kubernetes that works by depl
88

99
- Tested with Kubernetes clusters running version `1.8` through `1.10`.
1010
- The Ingress Controller supports the following versions of Kong:
11-
- Kong Community Edition(CE) `0.13.x`
11+
- Kong Community Edition(CE) `0.14.x`
1212
- Kong Enterprise Edition(EE) `0.32.x`
1313
- Kong Enterprise Edition(EE) `0.33.x`
1414

deploy/manifests/ingress-controller.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
serviceAccountName: kong-serviceaccount
4545
initContainers:
4646
- name: kong-migration
47-
image: kong:0.13.1-centos
47+
image: kong:0.14.1-centos
4848
env:
4949
- name: KONG_PG_PASSWORD
5050
value: kong
@@ -53,7 +53,7 @@ spec:
5353
command: [ "/bin/sh", "-c", "kong migrations up" ]
5454
containers:
5555
- name: admin-api
56-
image: kong:0.13.1-centos
56+
image: kong:0.14.1-centos
5757
env:
5858
- name: KONG_PG_PASSWORD
5959
value: kong
@@ -109,7 +109,7 @@ spec:
109109
fieldRef:
110110
apiVersion: v1
111111
fieldPath: metadata.namespace
112-
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.1.0
112+
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.2.0
113113
imagePullPolicy: IfNotPresent
114114
livenessProbe:
115115
failureThreshold: 3

deploy/manifests/kong.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
spec:
1717
containers:
1818
- name: kong-proxy
19-
image: kong:0.13.1-centos
19+
image: kong:0.14.1-centos
2020
env:
2121
- name: KONG_PG_PASSWORD
2222
value: kong

deploy/single/all-in-one-postgres.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ spec:
324324
serviceAccountName: kong-serviceaccount
325325
initContainers:
326326
- name: kong-migration
327-
image: kong:0.13.1-centos
327+
image: kong:0.14.1-centos
328328
env:
329329
- name: KONG_PG_PASSWORD
330330
value: kong
@@ -333,7 +333,7 @@ spec:
333333
command: [ "/bin/sh", "-c", "kong migrations up" ]
334334
containers:
335335
- name: admin-api
336-
image: kong:0.13.1-centos
336+
image: kong:0.14.1-centos
337337
env:
338338
- name: KONG_PG_PASSWORD
339339
value: kong
@@ -389,7 +389,7 @@ spec:
389389
fieldRef:
390390
apiVersion: v1
391391
fieldPath: metadata.namespace
392-
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.1.0
392+
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.2.0
393393
imagePullPolicy: IfNotPresent
394394
livenessProbe:
395395
failureThreshold: 3
@@ -449,7 +449,7 @@ spec:
449449
spec:
450450
containers:
451451
- name: kong-proxy
452-
image: kong:0.13.1-centos
452+
image: kong:0.14.1-centos
453453
env:
454454
- name: KONG_PG_PASSWORD
455455
value: kong

deploy/single/kong-resources-openshift.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ spec:
260260
fieldRef:
261261
apiVersion: v1
262262
fieldPath: metadata.namespace
263-
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.1.0
263+
image: kong-docker-kubernetes-ingress-controller.bintray.io/kong-ingress-controller:0.2.0
264264
imagePullPolicy: IfNotPresent
265265
livenessProbe:
266266
failureThreshold: 3
@@ -338,7 +338,7 @@ spec:
338338
privileged: true
339339
containers:
340340
- name: kong
341-
image: kong:0.13.1-centos
341+
image: kong:0.14.1-centos
342342
env:
343343
- name: KONG_PG_PASSWORD
344344
value: kong
@@ -400,7 +400,7 @@ spec:
400400
spec:
401401
containers:
402402
- name: kong-migration-0130
403-
image: kong:0.13.1-centos
403+
image: kong:0.14.1-centos
404404
env:
405405
- name: KONG_NGINX_DAEMON
406406
value: 'off'

docs/annotations.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
11
# Kubernetes annotations
22

3-
To configure Kong plugins, credentials and consumers the ingress controller uses annotations to create a mapping between the Ingress and the [custom types][0].
4-
The prefix of the annotation shows which plugin we are trying to set up. For instance, the next code shows we want to configure the `rate-limiting` plugin:
3+
`KongPlugin` and `KongIngress` resources need to be associated with an Ingress resource
4+
for it to take effect, since these resources add value to your routing.
5+
6+
# KongPlugin
7+
8+
## `plugins.konghq.com` Annotation
9+
`KongPlugin` resource can be configured using the `plugins.konghq.com` annotation.
10+
This annotation was introduced in Kong Ingress Controller version 0.2.0.
11+
12+
Following is an example on how to use the annotation:
13+
14+
```yaml
15+
plugins.konghq.com: high-rate-limit, docs-site-cors
16+
```
17+
18+
Here, `high-rate-limit` and `docs-site-cors` are the name of the KongPlugin resources which
19+
need to be applied to the Ingress.
20+
21+
This annotation can be applied to a Service in Kubernetes as well, which
22+
will result in the plugin being executed at Service in Kong, meaning the plugin will be
23+
executed for every request that is proxied, no matter which Route it came from.
24+
25+
## DEPRECATED `<name>.plugin.konghq.com` Annotation
26+
27+
Before version 0.2.0, a different annotation was used to configure plugins,
28+
which is now deprecated.
29+
30+
The annotation can be used as follows:
531

632
```yaml
733
rate-limiting.plugin.konghq.com: |
@@ -24,8 +50,5 @@ Setting annotations in Ingress rules set ups plugins in `Kong Routes`. Sometimes
2450

2551
**Rules:**
2652

27-
- If the Ingress and Kubernetes service contains the same annotation, only the defined in the service will be used.
28-
- When there is no overlap of plugins in Ingress and Services annotations both plugins will be configured.
29-
3053
[0]: custom-types.md
3154
[1]: https://konghq.com/blog/kong-ce-0-13-0-released/

docs/custom-types.md

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
11
# Custom Resource Definitions
22

3-
Kong relies on several [Custom Resource Definition object][0] to declare the additional information to Ingress rules and synchronize configuration with the Kong admin API
3+
Kong relies on several [Custom Resource Definitions][0] to declare
4+
additional information to Ingress rules and synchronize configuration with the Kong admin API.
45

5-
This new types are:
6+
The custom resource names are:
67

7-
- kongconsumer
8-
- kongcredential
9-
- kongplugin
10-
11-
Each one of this new object in Kubernetes have a one-to-one relation with a Kong resource:
12-
13-
- [Consumer][1]
14-
- [Plugin][2]
15-
- Credential created in each authentication plugin.
16-
17-
Using this Kubernetes feature allows us to add additional commands to [kubectl][3] which improves the user experience:
18-
19-
```bash
20-
$ kubectl get kongplugins
21-
NAME AGE
22-
add-ratelimiting-to-route 5h
23-
http-svc-consumer-ratelimiting 5h
24-
```
8+
- **KongConsumer**: These resources map to [Consumer][1] entities in Kong.
9+
- **KongCredential**: These resources map to credentials (key-auth, basic-auth, etc) that belong to consumers.
10+
- **KongPlugin**: These resources belong to [Plugin][2] entities in Kong.
2511

2612
### KongPlugin
2713

28-
This object allows the configuration of Kong plugins in the same way we [add plugins using the admin API][4]
14+
This resource allows the configuration of Kong plugins in the same way we [add plugins using the admin API][4]
2915

3016
```yaml
3117
apiVersion: configuration.konghq.com/v1
3218
kind: KongPlugin
3319
metadata:
3420
name: <object name>
3521
namespace: <object namespace>
36-
consumerRef: <name of an existing consumer>
37-
disabled: <boolean>
22+
labels:
23+
global: "true" # optional, please note the quotes around true
24+
consumerRef: <optional, name of an existing consumer> # optional
25+
disabled: <boolean> # optional
3826
config:
3927
key: value
28+
plugin: <name-of-plugin>
4029
```
4130
42-
- The field `consumerRef` implies the plugin will be used for a particular consumer.
43-
- The value of the field must reference an existing consumer in the same namespace.
44-
- When `consumerRef` is empty it implies the plugin is global. This means, all the requests will use the plugin.
45-
- The field `config` contains a list of `key` and `value` required to configure the plugin.
46-
- The field `disabled` allows us to change the state of the plugin in Kong.
47-
48-
**Important:** the validation of the fields is left to the user. Setting invalid fields avoid the plugin configuration.
31+
- `consumerRef`, an optional field, implies the plugin will be used for a particular consumer only.
32+
The value of the field must reference an existing consumer in the same namespace.
33+
If specified, the plugin will execute for the specific consumer only.
34+
- `config` contains a list of `key` and `value` required to configure the plugin.
35+
All configuration values specific to the type of plugin go in here.
36+
Please read the documentation of the plugin being configured to set values
37+
in here.
38+
- `disabled` if set to true, disables the plugin in Kong (but not delete it).
39+
- `plugin` field determines the name of the plugin in Kong.
40+
This field was introduced in Kong Ingress Controller 0.2.0.
41+
- Setting a label `global` to `"true"` will result in the plugin being
42+
applied globally in Kong, meaning it will be executed for every
43+
request that is proxied via Kong.
44+
45+
**Important:** validation of the configuration fields is left to the user.
46+
Setting invalid fields will result in errors in the Ingress Controller.
47+
This behavior is set to improve in future.
48+
49+
The plugins can be associated with Ingress resources using `plugins.konghq.com` annotation.
4950

5051
*Example:*
5152

@@ -57,11 +58,12 @@ metadata:
5758
namespace: default
5859
config:
5960
key: value
61+
plugin: my-plugin
6062
```
6163

6264
### KongConsumer
6365

64-
Definition:
66+
*Definition:*
6567

6668
```yaml
6769
apiVersion: configuration.konghq.com/v1
@@ -73,16 +75,15 @@ username: <user name>
7375
custom_id: <custom ID>
7476
```
7577

76-
*Example:*
77-
78-
To set up a consumer, first we need a plugin and a credential:
78+
This resource allows configuring Consumers in Kong
7979

8080
```yaml
8181
apiVersion: configuration.konghq.com/v1
8282
kind: KongConsumer
8383
metadata:
8484
name: consumer-team-x
8585
username: team-X
86+
custom_id: my_team_x # optional and not recommended, please use `username`
8687

8788
---
8889

@@ -106,20 +107,29 @@ config:
106107
hour: 1000
107108
limit_by: ip
108109
second: 100
110+
plugin: rate-limiting
109111
```
110112
111113
### KongIngress
112114
113-
This option allows us to configure setting from kong related to the [Upstream][5], [Service][6] and [routes][7] that are defined in the Kubernetes Ingress specification.
115+
Ingress resource spec in Kubernetes can define routing policies based on HTTP Host header and paths.
116+
While this is sufficient in most cases, sometimes, users may want more control over routing at the Ingress level.
117+
`KongIngress` works in conjunction with existing Ingress resource and extends it. It is not meant as a replacement to the
118+
`Ingress` resource in Kubernetes.
119+
Using `KongIngress`, all properties of [Upstream][5], [Service][6] and [Route][7] entitise in Kong related to an Ingress resource
120+
can be modified.
114121

115-
*There are two ways of activating this feature:*
116-
- We can create a `KongIngress` object in the same namespace of the Ingress rule using the same name. With this convention we can avoid an additional annotation in the Ingress. This is useful but requires one `KongIngress` definition per Ingress, which could become hard to maintain when have multiple rules.
122+
Once a `KongIngress` resource is created, it can be associated with `Ingress` resource in two ways:
123+
- Create a `KongIngress` object in the same namespace as that of the Ingress rule using the same name.
124+
This avoids a need of additional annotation in Ingress oresource.
125+
On the other hand, this approach requires a `KongIngress` resource per Ingress, which becomes hard to maintain with multiple Ingresses.
117126

118-
- (Alternatively) To simplify maintenance, by reusing the same KongIngress on multiple Ingress resources, we can create just one or more `KongIngress` object and map which one should be used using the annotation `configuration.konghq.com: <name>`.
127+
- Create an `KongIngress` resource and then using the annotation `configuration.konghq.com: <KongIngress-resource-name>`,
128+
associate it with one or more Ingress resources. This approach allows you to reuse the same `KongIngress`.
119129

120130
*Note:* Is not required to define the complete object, we can define the `upstream`, `proxy` or `route` sections
121131

122-
Example:
132+
Following is a complete spec example:
123133

124134
```yaml
125135
apiVersion: configuration.konghq.com/v1
@@ -180,10 +190,10 @@ route:
180190
```
181191

182192
[0]: https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/
183-
[1]: https://getkong.org/docs/0.13.x/admin-api/#consumer-object
184-
[2]: https://getkong.org/docs/0.13.x/admin-api/#plugin-object
193+
[1]: https://getkong.org/docs/0.14.x/admin-api/#consumer-object
194+
[2]: https://getkong.org/docs/0.14.x/admin-api/#plugin-object
185195
[3]: https://kubernetes.io/docs/reference/kubectl/overview/
186-
[4]: https://getkong.org/docs/0.13.x/admin-api/#add-plugin
187-
[5]: https://getkong.org/docs/0.13.x/admin-api/#upstream-objects
188-
[6]: https://getkong.org/docs/0.13.x/admin-api/#service-object
189-
[7]: https://getkong.org/docs/0.13.x/admin-api/#route-object
196+
[4]: https://getkong.org/docs/0.14.x/admin-api/#add-plugin
197+
[5]: https://getkong.org/docs/0.14.x/admin-api/#upstream-objects
198+
[6]: https://getkong.org/docs/0.14.x/admin-api/#service-object
199+
[7]: https://getkong.org/docs/0.14.x/admin-api/#route-object

0 commit comments

Comments
 (0)