Skip to content

Commit

Permalink
feat: implement KongLicense controller and inject to translator (#5514)
Browse files Browse the repository at this point in the history
* init konglicense controller

* add status update

* add integration tests

* update KongLicense client

* add isolated integration tests

* add CHANGELOG

* fix lint

* wrap KongLicense controller with dynamic CRD controller

* move repick license to function

* Update internal/controllers/configuration/konglicense_controller.go

Co-authored-by: Grzegorz Burzyński <[email protected]>

* move setupLicense to a helper function

---------

Co-authored-by: Grzegorz Burzyński <[email protected]>
  • Loading branch information
randmonkey and czeslavo authored Feb 6, 2024
1 parent fe165ac commit cf99004
Show file tree
Hide file tree
Showing 25 changed files with 2,214 additions and 66 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,14 @@ Adding a new version? You'll need three changes:
sourced from a Secret (i.e. `configFrom` or `configPatches` is used).
[#5495](https:/Kong/kubernetes-ingress-controller/pull/5495)
- New CRD `KongLicense` to represent a Kong enterprise license to apply to
managed Kong gateway enterprise instances.
managed Kong gateway enterprise instances. The `Enabled` field of `KongLicense`
(set to `True` if not present) need to be set to true to get reconciled.
If there are multiple `KongLicense`s in the cluster, the newest one
(with latest `metadata.creationTimestamp`) is chosen. The `KongLicense`
controller is disabled when synchoroniztion of license with Konnect is turned
on. When sync license with Konnect is turned on, licenses from Konnect are used.
[#5487](https:/Kong/kubernetes-ingress-controller/pull/5487)
[#5514](https:/Kong/kubernetes-ingress-controller/pull/5514)

### Fixed

Expand Down
5 changes: 1 addition & 4 deletions config/crd/bases/configuration.konghq.com_konglicenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ spec:
name: Age
type: date
- description: Enabled to configure on Kong gateway instances
jsonPath: .Enabled
jsonPath: .enabled
name: Enabled
type: boolean
- jsonPath: .status.conditions[?(@.type=="Programmed")].status
name: Programmed
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down
1 change: 1 addition & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resources:
- bases/configuration.konghq.com_ingressclassparameterses.yaml
- bases/configuration.konghq.com_kongupstreampolicies.yaml
- bases/configuration.konghq.com_kongvaults.yaml
- bases/configuration.konghq.com_konglicenses.yaml
#+kubebuilder:scaffold:crdkustomizeresource

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
Expand Down
16 changes: 16 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ rules:
- get
- patch
- update
- apiGroups:
- configuration.konghq.com
resources:
- konglicenses
verbs:
- get
- list
- watch
- apiGroups:
- configuration.konghq.com
resources:
- konglicenses/status
verbs:
- get
- patch
- update
- apiGroups:
- configuration.konghq.com
resources:
Expand Down
1 change: 1 addition & 0 deletions docs/cli-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
| `--enable-controller-ingress-class-networkingv1` | `bool` | Enable the networking.k8s.io/v1 IngressClass controller. | `true` |
| `--enable-controller-ingress-class-parameters` | `bool` | Enable the IngressClassParameters controller. | `true` |
| `--enable-controller-ingress-networkingv1` | `bool` | Enable the networking.k8s.io/v1 Ingress controller. | `true` |
| `--enable-controller-kong-license` | `bool` | Enable the KongLicense controller. | `true` |
| `--enable-controller-kong-service-facade` | `bool` | Enable the KongServiceFacade controller. | `true` |
| `--enable-controller-kong-upstream-policy` | `bool` | Enable the KongUpstreamPolicy controller. | `true` |
| `--enable-controller-kong-vault` | `bool` | Enable the KongVault controller. | `true` |
Expand Down
Loading

0 comments on commit cf99004

Please sign in to comment.