Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Optionally remove the Status handler_id prefix #320

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lack
Copy link

@lack lack commented Mar 2, 2020

What do these changes do?

As proposed in issue #319, this introduces an optional status_prefix boolean that can be added to any resource handler definition. If set to True (or omitted), status returned by the handler is still placed beneath the handler_id in the resulting object's status subresource. If set to False, the status returned by the handler is use at the top-level of the status subresource.

Description

Fully implements the proposal in issue #319.

Issues/PRs

Issues: #319

Type of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • The code addresses only the mentioned problem, and this problem only
  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt

As proposed in issue zalando-incubator#319, this introduces an optional status_prefix boolean that can be added to any resource handler definition. If set to True (or omitted), status returned by the handler is still placed beneath the handler_id in the resulting object's status subresource. If set to False, the status returned by the handler is use at the top-level of the status subresource.

Default handler with status_prefix=True:
  @kopf.on.create('zalando.org', 'v1', 'kopfexamples')
  def create(...):
    return {'my': 'result}

Result:
  ...
  Status:
    Create:
      My: Result

Handler with status_prefix=False:
  @kopf.on.create('zalando.org', 'v1', 'kopfexamples', status_prefix=False)
  def create(...):
    return {'my': 'result}

Result:
  ...
  Status:
    My: Result
@lack lack requested a review from nolar as a code owner March 2, 2020 21:48
@zincr
Copy link

zincr bot commented Mar 2, 2020

🤖 zincr found 1 problem , 0 warnings

❌ Approvals
✅ Large Commits
✅ Specification
✅ Dependency Licensing

Details on how to resolve are provided below


Approvals

All proposed changes must be reviewed by project maintainers before they can be merged

Not enough people have approved this pull request - please ensure that 2 additional users, who have not contributed to this pull request approve the changes.

  • ❌ 2 additional approvals needed
     

@ps-jay
Copy link

ps-jay commented Aug 20, 2020

This would be a really nice feature to have

@psontag
Copy link

psontag commented Aug 22, 2020

Hey @lack,
is there any chance you would be willing to update this branch and move the PR to the new repository at https://github.com/nolar/kopf?

If you don't have time at the moment would it be ok if I pick this up based on the changes you already made?

@lack
Copy link
Author

lack commented Aug 22, 2020

@philipp-sontag-by : I'll try to redo this in the other repo, but I may not have time in the near future (starting a new job this week). I'd also be happy for you to carry this forward if you have time. Let me know here if you've got it in another PR so we don't duplicate effort.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants