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

K0sControlPlane admission webhook #807

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

makhov
Copy link
Contributor

@makhov makhov commented Nov 12, 2024

A simple admission webhook that declines clusters in single mode and update strategy "Recreate"

@makhov makhov force-pushed the admission-hook branch 2 times, most recently from 2195d6b to db4c512 Compare December 4, 2024 09:32
@makhov makhov force-pushed the admission-hook branch 7 times, most recently from 2295e3f to 3e28593 Compare December 17, 2024 11:32
Signed-off-by: Alexey Makhov <[email protected]>
@makhov makhov force-pushed the admission-hook branch 2 times, most recently from 01a1cfa to d11ab59 Compare December 17, 2024 12:22
Signed-off-by: Alexey Makhov <[email protected]>
@makhov makhov changed the title Admission webhook K0sControlPlane admission webhook Dec 17, 2024
@makhov makhov marked this pull request as ready for review December 17, 2024 14:01
@makhov makhov requested a review from a team as a code owner December 17, 2024 14:01
Comment on lines +90 to +100
if kcp.Spec.UpdateStrategy == v1beta1.UpdateRecreate {

// If the cluster is running in single mode, we can't use the Recreate strategy
if kcp.Spec.K0sConfigSpec.Args != nil {
for _, arg := range kcp.Spec.K0sConfigSpec.Args {
if arg == "--single" {
return fmt.Errorf("UpdateStrategy Recreate strategy is not allowed when the cluster is running in single mode")
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this block from machine scale reconciliation?

@apedriza
Copy link
Contributor

I am trying to test the webhook by deploying the development version but it doesn't seem to run, even though I force an error with Recreate+--single arg. Do I need something additional? I think it doesn't run in CI either. At least locally following the usual flow I have not been able to. Maybe I am forgetting something

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

Successfully merging this pull request may close these issues.

2 participants