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 force-pushed the konnect-use-sdk-interface branch from 3498087 to ea21971 Compare August 20, 2024 19:47
@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
@pmalek pmalek force-pushed the konnect-use-sdk-interface branch from ec51bfc to e97b1b4 Compare August 23, 2024 17:11
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 <[email protected]>

* feat(cli): cleanup code per review

Removed unnecessary variable assignments.

Signed-off-by: Arpad Kunszt <[email protected]>

* feat(cli): add CHANGELOG entry

Signed-off-by: Arpad Kunszt <[email protected]>

* feat(cli): unit tests handle new arguments

Signed-off-by: Arpad Kunszt <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Signed-off-by: Arpad Kunszt <[email protected]>

* 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] <[email protected]>
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] <[email protected]>

* chore: go mod tidy

---------

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

* `KongPluginBinding` reconciler (#513)

* feat: KongPluginBinding reconciler

Signed-off-by: Mattia Lavacca <[email protected]>

* chore: fix linter

Signed-off-by: Mattia Lavacca <[email protected]>

* chore: CHANGELOG updated

Signed-off-by: Mattia Lavacca <[email protected]>

* Update controller/konnect/ops_kongpluginbinding.go

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

---------

Signed-off-by: Mattia Lavacca <[email protected]>
Co-authored-by: Grzegorz Burzyński <[email protected]>

* 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] <[email protected]>
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] <[email protected]>
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 <[email protected]>

* 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] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update golangci configuration

---------

Signed-off-by: Arpad Kunszt <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Mattia Lavacca <[email protected]>
Co-authored-by: akunszt <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jakub Warczarek <[email protected]>
Co-authored-by: Mattia Lavacca <[email protected]>
Co-authored-by: Grzegorz Burzyński <[email protected]>
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