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

refactor(konnect): add SDK interface types and theirs mocks #507

Merged
merged 8 commits into from
Sep 5, 2024

Conversation

pmalek
Copy link
Member

@pmalek pmalek commented Aug 20, 2024

What this PR does / why we need it:

This PR will allow UTs for entity focused functions when mocks for those are introduced.

This PR does reorganize the konnect package a bit to solve the import cycles between konnect and newly added ops package.

Mocks are generated using mockery and generate.mocks makefile target. The config that configures which interfaces to generate mocks for is .mockery.yaml.

The tests that are added in this PR are in

  • controller/konnect/ops/ops_controlplane_test.go
  • controller/konnect/ops/ops_kongservice_test.go

More will follow after this PR gets reviewed and merged.

Which issue this PR fixes

Part of #447

Special notes for your reviewer:

@pmalek pmalek added this to the KGO v1.4.x milestone Aug 20, 2024
@pmalek pmalek self-assigned this Aug 20, 2024
@pmalek pmalek added the blocked label Aug 20, 2024
@pmalek pmalek force-pushed the konnect-use-sdk-interface branch 4 times, most recently from d5b2c5c to 0bd41c3 Compare August 22, 2024 12:46
@pmalek pmalek changed the title Konnect use sdk interface refactor(konnect): add SDK interface types and theirs mocks Aug 22, 2024
@pmalek pmalek force-pushed the konnect-use-sdk-interface branch 2 times, most recently from ebb03b2 to ec51bfc Compare August 22, 2024 13:18
@pmalek pmalek marked this pull request as ready for review August 22, 2024 13:25
@pmalek pmalek requested a review from a team as a code owner August 22, 2024 13:25
@mlavacca mlavacca self-requested a review August 23, 2024 09:33
Copy link
Member

@programmer04 programmer04 left a comment

Choose a reason for hiding this comment

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

Overall LGTM

.golangci.yaml Outdated Show resolved Hide resolved
randmonkey and others added 5 commits September 3, 2024 12:31
…theirs mocks"(#507) (#542)

* feat(cli): configurable certgen images (#516)

* feat(cli): configurable certgen images

Add two new command line options to the manager.

  -webhook-certificate-config-base-image string
    	The base image for the certgen Jobs. (default "registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0")
  -webhook-certificate-config-shell-image string
    	The shell image for the certgen Jobs. (default "busybox")

Those are optional. If you omit them the defaults will be used which are
the previous hard coded values.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* feat(cli): cleanup code per review

Removed unnecessary variable assignments.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* feat(cli): add CHANGELOG entry

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* feat(cli): unit tests handle new arguments

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* feat(cli): move new configuration into Config

Also created a constant for the shell image, so it is no more a hard
coded string hidden in the code.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* feat(cli): added UT for the new arguments

The new unit test tests only if the command line arguments are set in
the configuration. The other cases, the default configuration, the
environmental variable handling are already tested in previous cases.

The test does not cover if the values from the configuration are
actually used but at the moment there are no tests for that part of the
code at all.

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

---------

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>

* chore(deps): bump github.com/kong/kubernetes-configuration (#523)

Bumps [github.com/kong/kubernetes-configuration](https://github.com/kong/kubernetes-configuration) from 0.0.8 to 0.0.9.
- [Commits](Kong/kubernetes-configuration@v0.0.8...v0.0.9)

---
updated-dependencies:
- dependency-name: github.com/kong/kubernetes-configuration
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/kong/kubernetes-ingress-controller/v3 from 3.2.4 to 3.3.0 (#531)

* chore(deps): bump github.com/kong/kubernetes-ingress-controller/v3

Bumps [github.com/kong/kubernetes-ingress-controller/v3](https://github.com/kong/kubernetes-ingress-controller) from 3.2.4 to 3.3.0.
- [Release notes](https://github.com/kong/kubernetes-ingress-controller/releases)
- [Changelog](https://github.com/Kong/kubernetes-ingress-controller/blob/main/CHANGELOG.md)
- [Commits](Kong/kubernetes-ingress-controller@v3.2.4...v3.3.0)

---
updated-dependencies:
- dependency-name: github.com/kong/kubernetes-ingress-controller/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: go mod tidy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>

* `KongPluginBinding` reconciler (#513)

* feat: KongPluginBinding reconciler

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>

* chore: fix linter

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>

* chore: CHANGELOG updated

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>

* Update controller/konnect/ops_kongpluginbinding.go

Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>

---------

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>

* chore(deps): update kong/kubernetes-ingress-controller docker tag to v3.3.0 (#532)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update kong/kubernetes-ingress-controller docker tag to v3.3.1 (#534)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add watch for KongPlugin and KongClusterPlugin in KongPluginBinding controller (#535)

* chore(deps): bump github.com/kong/kubernetes-ingress-controller/v3 (#536)

Bumps [github.com/kong/kubernetes-ingress-controller/v3](https://github.com/kong/kubernetes-ingress-controller) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/kong/kubernetes-ingress-controller/releases)
- [Changelog](https://github.com/Kong/kubernetes-ingress-controller/blob/main/CHANGELOG.md)
- [Commits](Kong/kubernetes-ingress-controller@v3.3.0...v3.3.1)

---
updated-dependencies:
- dependency-name: github.com/kong/kubernetes-ingress-controller/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/Masterminds/sprig/v3 in /hack/generators (#539)

Bumps [github.com/Masterminds/sprig/v3](https://github.com/Masterminds/sprig) from 3.2.3 to 3.3.0.
- [Release notes](https://github.com/Masterminds/sprig/releases)
- [Changelog](https://github.com/Masterminds/sprig/blob/master/CHANGELOG.md)
- [Commits](Masterminds/sprig@v3.2.3...v3.3.0)

---
updated-dependencies:
- dependency-name: github.com/Masterminds/sprig/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): update dependency kubernetes-sigs/controller-tools to v0.16.2 (#538)

* chore(deps): update dependency kubernetes-sigs/controller-tools to v0.16.2

* chore: regenerate

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>

* chore(deps): bump github.com/gruntwork-io/terratest (#541)

Bumps [github.com/gruntwork-io/terratest](https://github.com/gruntwork-io/terratest) from 0.47.0 to 0.47.1.
- [Release notes](https://github.com/gruntwork-io/terratest/releases)
- [Commits](gruntwork-io/terratest@v0.47.0...v0.47.1)

---
updated-dependencies:
- dependency-name: github.com/gruntwork-io/terratest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update golangci configuration

---------

Signed-off-by: Arpad Kunszt <akunszt@hiya.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Co-authored-by: akunszt <32456696+akunszt@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jakub Warczarek <jakub.warczarek@konghq.com>
Co-authored-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Co-authored-by: Grzegorz Burzyński <czeslavo@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
.mockery.yaml Show resolved Hide resolved
@randmonkey randmonkey merged commit a3b231e into main Sep 5, 2024
20 checks passed
@randmonkey randmonkey deleted the konnect-use-sdk-interface branch September 5, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants