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

KIM Integration - instances on runtimes endpoint decorated with Runtime CR #1061

Conversation

jaroslaw-pieszka
Copy link
Contributor

@jaroslaw-pieszka jaroslaw-pieszka commented Aug 26, 2024

Description

KEB endpoint runtimes is used by kcp CLI e.g. to get gardener configuration information (using --gardener-config switch), and this information is used quite often to assert in SKR tests. Getting gardener configuration requires communication with provisioner, so in case of KIM driven instances is pointless.
We need the way to base assertions on the spec fields of Runtime CR.

Changes proposed in this pull request:

  • adding new query parameter runtime-config
  • handling scenario when with --gardener-config flag we process instance not known to provisioner

Related issue(s)

#791
#905

@jaroslaw-pieszka jaroslaw-pieszka requested a review from a team as a code owner August 26, 2024 15:18
@jaroslaw-pieszka jaroslaw-pieszka self-assigned this Aug 26, 2024
@kyma-bot kyma-bot added cla: yes Indicates the PR's author has signed the CLA. labels Aug 26, 2024
@jaroslaw-pieszka jaroslaw-pieszka added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/enhancement Categorizes issue or PR as related to modifying or improving an existing feature and removed cla: yes Indicates the PR's author has signed the CLA. labels Aug 26, 2024
@kyma-bot kyma-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cla: yes Indicates the PR's author has signed the CLA. labels Aug 26, 2024
Copy link

Add one of following labels

- kind/feature -> Use it when you want to submit a new feature

- kind/enhancement -> Use it when you modify or improve an existing feature

- kind/bug -> Use it when you fix a bug

@kyma-bot kyma-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 26, 2024
@jaroslaw-pieszka jaroslaw-pieszka force-pushed the runtime-resource-returned-from-runtimes-endpoint branch from 0b65178 to bf91abe Compare August 26, 2024 18:07
@kyma-bot kyma-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 29, 2024
@jaroslaw-pieszka jaroslaw-pieszka force-pushed the runtime-resource-returned-from-runtimes-endpoint branch from f997c61 to 63235fe Compare August 29, 2024 10:26
@jaroslaw-pieszka jaroslaw-pieszka removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 29, 2024
Namespace: runtimeNamespaceName,
Name: runtimeResourceName,
}, runtimeResourceObject)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I think in case of "Not Found" error we will have a problem here.

Copy link
Member

Choose a reason for hiding this comment

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

If there is no runtime resource, let's do not throw any error, just leave the field empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We log Warning and return empty result.

Copy link
Member

Choose a reason for hiding this comment

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

handle NotFoundError -> log.Info, other error log as warn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the next commit/push.

if err != nil {
h.logger.Warn(fmt.Sprintf("unable to set optional attributes: %s", err.Error()))
httputil.WriteErrorResponse(w, http.StatusInternalServerError, err)
return
}

if runtimeResourceConfig && dto.RuntimeID != "" && instanceDrivenByKimOnly {
Copy link
Member

Choose a reason for hiding this comment

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

I think the instanceDrivenByKimOnly in not necessary here, I'd like to have a possibility to use kcp cli to get the runtime even if it is driven by Provisioner (in the phase when Provisioner is called and runtime resource is created).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the next commit/push.

@jaroslaw-pieszka jaroslaw-pieszka force-pushed the runtime-resource-returned-from-runtimes-endpoint branch 2 times, most recently from 4eb008f to 1c82851 Compare August 30, 2024 07:50
pass necessary data to handler

barebones

kim config moved to broker package

change package reference

change package reference again

redo

reredo

removing unused functions

fixes to fixes

initial stubs for handler tests

simplified tests setup

handling errors from provisioner (in a nasty way)

dto extended and set if RuntimeResource fetched

fake client extended, remarks and todos added

before test implementation

suite corrected

no scheme used and make fix run

let focus on one test case

failing new test cases

first passing test case (out of new ones)

test cases added

error handling for nested fields

fix for signature

setting workers in the fixture

additional assertion

review remark and conflict resolved

log level depending on k8s client error
@jaroslaw-pieszka jaroslaw-pieszka force-pushed the runtime-resource-returned-from-runtimes-endpoint branch from 9c02283 to 8d52691 Compare August 30, 2024 08:41
@kyma-bot kyma-bot added the lgtm Looks good to me! label Aug 30, 2024
@kyma-bot kyma-bot added the lgtm Looks good to me! label Aug 30, 2024
@kyma-bot kyma-bot merged commit f52a70a into kyma-project:main Aug 30, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA. kind/enhancement Categorizes issue or PR as related to modifying or improving an existing feature lgtm Looks good to me! size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants