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

fix(controllers): object not committed properly #550

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

byashimov
Copy link
Contributor

@byashimov byashimov commented Nov 21, 2023

This PR:

  • fixes object updates lose during reconciliation
  • sets error conditions on basic controller level

@byashimov byashimov force-pushed the byashimov-refactor-conditions branch from f244b5e to 1a25287 Compare November 22, 2023 10:31
@tkaesserfm
Copy link

@byashimov yes, you were right! 😆

@byashimov
Copy link
Contributor Author

byashimov commented Nov 27, 2023

@byashimov yes, you were right! 😆

Hey. You mean the RUNNING status? I'm fixing it right now. But it is a hard one.

@tkaesserfm
Copy link

@byashimov yes, but i only see the issue for KafkaACL.
We're only using kafka-related stuff though. What works is ServiceUser and KafkaTopic.

@byashimov
Copy link
Contributor Author

@tkaesserfm it is actually there for every kind.
When this line is triggered, it changes the resource version by creating a secret. Then events are not attached to the resource.
Next time you change it, it goes through the loop, but no new secret is attached. That's how you get the last event.
Currently I'm fighting this to get all events in one run as it is expected.

@tkaesserfm
Copy link

Ah i see, i was talking "Status Conditions" so different thing but the symptom seems the same.

@byashimov byashimov force-pushed the byashimov-refactor-conditions branch 18 times, most recently from 6db78a4 to ccc4ad1 Compare November 30, 2023 19:39
@byashimov byashimov changed the title refactor(controllers): set conditions on top level fix(controllers): object not committed properly Nov 30, 2023
@byashimov
Copy link
Contributor Author

Hey @tkaesserfm
I think, I have fixed it:

Status:
  Conditions:
    Last Transition Time:  2023-11-29T22:22:24Z
    Message:               failed to create service: 400: {"errors":[{"message":"Plan 'startup-24' for service type ServiceType.kafka is not available in cloud 'google-europe-west1'","status":400}],"message":"Plan 'startup-24' for service type ServiceType.kafka is not available in cloud 'google-europe-west1'"} - 
    Reason:                CreateOrUpdate
    Status:                Unknown
    Type:                  Error

The only thing is that I have narrowed down the list of reasons. It's good to have a verbose state machine, but unfortunately our controllers have just one CreateOrUpdate command for everything, and too many return statements.

That means that every return statement with an error has to have a "set a reason" line behind.
So I've left just CreateOrUpdate and a few more that can be guaranteed to be compatible with all controllers:

errConditionDelete         errCondition = "Delete"
errConditionPreconditions  errCondition = "Preconditions"
errConditionCreateOrUpdate errCondition = "CreateOrUpdate"

Regarding to missing events: turns out that by default (and actually recommended way) events might be dropped out when there are too much of them. So events are unreliable. Thankfully, you use conditions.

Can you confirm this works for you?

@byashimov byashimov marked this pull request as ready for review November 30, 2023 19:41
@byashimov byashimov requested a review from a team November 30, 2023 19:41
@byashimov byashimov force-pushed the byashimov-refactor-conditions branch 2 times, most recently from b5207b5 to 33ce964 Compare November 30, 2023 19:47
@byashimov byashimov force-pushed the byashimov-refactor-conditions branch from 33ce964 to aac610b Compare November 30, 2023 19:47
@byashimov byashimov force-pushed the byashimov-refactor-conditions branch from aac610b to 8bae46c Compare November 30, 2023 19:50
Copy link
Contributor

@ivan-savciuc ivan-savciuc left a comment

Choose a reason for hiding this comment

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

LGTM

@byashimov byashimov merged commit 4ddde8f into main Dec 5, 2023
7 checks passed
@byashimov byashimov deleted the byashimov-refactor-conditions branch December 5, 2023 10:47
@Serpentiel Serpentiel added the bug Something isn't working label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants