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

Modifiable action.Apply for when using k0sctl as a library #769

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

kke
Copy link
Contributor

@kke kke commented Sep 30, 2024

A bit crudelly crammed-in way to make the apply action's (can be replicated fro other actions if needed) phase list modifiable.

Before:

applyAction := &action.Apply{
   Force: false
}
err := applyAction.Run()

After:

applyAction := action.NewApply(action.ApplyOpts: {
   Force: false
})
validateFacts := &phase.ValidateFacts{} 
applyAction.Phases.InsertAfter(validateFacts.Title(), &myCustomPhase{})
err := applyAction.Run()

This allows adding custom phases or modifying/removing existing ones to the apply action without duplicating the action code.

While creating this it became obvious that there's plenty of room for improvement in the way the phase manager / actions are set up.

@kke kke added enhancement New feature or request chore Housekeeping / typo / code quality improvements labels Sep 30, 2024
@kke kke changed the title Modifiable action.Apply for use as a library Modifiable action.Apply for when using k0sctl as a library Oct 1, 2024
@kke kke merged commit b8a2fd0 into main Oct 1, 2024
39 checks passed
@kke kke deleted the modifiable-applyaction branch October 1, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Housekeeping / typo / code quality improvements enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant