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

Create webhook to trim messages from the status object #57

Closed
5 tasks
jpkrohling opened this issue Sep 23, 2020 · 4 comments
Closed
5 tasks

Create webhook to trim messages from the status object #57

jpkrohling opened this issue Sep 23, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@jpkrohling
Copy link
Member

jpkrohling commented Sep 23, 2020

As part of #55, we added a new array of messages to the Status object. For long lived instances, this might potentially become a big list of messages, so, we might want to consider trimming it to the last N messages.

Questions:

  • should this be a webhook? This is what makes more sense to me.
  • should we add a timestamp to the message?
  • should we remove by date, or by number of messages?
  • what would be a good age/number to keep?
  • should we add another message, saying that older messages have been removed?
@jpkrohling jpkrohling added the enhancement New feature or request label Sep 23, 2020
@objectiser
Copy link
Contributor

Rather than webhook, can't we just trim at the point a new message is added (i.e. have a common function that appends the messages to the status object and cleans up when necessary)? Think restricting by number may be adequate initially, as it shouldn't happen that often - although I guess it will depend upon how many messages are reported per version upgrade. May be start with 20?

@VineethReddy02
Copy link
Contributor

VineethReddy02 commented Jun 17, 2021

Rather creating a webhook for this. I think we can add a check in reconcillation flow i.e opentelemetry Self(). If Messages array size is > 10, then drop the oldest messages i.e.

if len(messages) > 10 {
  diff := len(messages) - 10
  messages = messages[diff:]
}

WDYT @jpkrohling

@jpkrohling
Copy link
Member Author

The problem with doing it at the reconciliation is that it will trigger an object update, which will trigger another reconciliation routine. It's not bad per se, but a webhook would probably be cleaner.

Another thing to consider is using events instead of this. We have this pattern introduced recently: #215 (comment)

More on this: https://book-v1.book.kubebuilder.io/beyond_basics/creating_events.html

@jpkrohling
Copy link
Member Author

I'm closing this, as I think we should instead be recording events instead of adding messages for this type of content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants