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

KUBESAW-170: Replace custom ksctl adm restart logic with the one from kubectl rollout #70

Closed
wants to merge 4 commits into from

Conversation

fbm3307
Copy link
Contributor

@fbm3307 fbm3307 commented Aug 26, 2024

This is to replace the custom ksctl adm restart logic with the one from "kubectl rollout" command, so that there is no down-time that was introduced by the current custom logic.

Copy link
Contributor

@MatousJobanek MatousJobanek left a comment

Choose a reason for hiding this comment

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

I've noticed that you dropped the unit test of the restart target. Let's recover it and have some sanity checks - you can take a look at the already existing kubectl wrappers for an inspiration on how to do it.

}
return true, nil
return kubectl.SetUpKubectlCmd(func(factory cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
return kubectlrollout.NewCmdRolloutRestart(factory, ioStreams)
Copy link
Contributor

Choose a reason for hiding this comment

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

as I mentioned in our call and also in the jira story, the command should also wait until the rollout is complete

Comment on lines +73 to +86
kubeConfigFlags := genericclioptions.NewConfigFlags(true).WithDeprecatedPasswordFlag()
hFactory := cmdutil.NewFactory(cmdutil.NewMatchVersionFlags(kubeConfigFlags))
ioStreams := genericclioptions.IOStreams{
In: nil, // Not to forward the Standard Input
Out: os.Stdout,
ErrOut: os.Stderr,
}

hArgs := []string{"", "deployments",
"--namespace", hostConfig.OperatorNamespace,
"--server", hostConfig.ServerAPI,
"--token", hostConfig.Token}

o := kubectlrollout.NewRolloutRestartOptions(ioStreams)
Copy link
Contributor

Choose a reason for hiding this comment

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

this seem to be very similar to what we already have in base_kubectl.go, let's try to reuse the already existing code if possible.
and as I mentioned in the other comment, it would be nice to wait.

Comment on lines +69 to +70
return restartHostOperator(hostClusterConfig)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

btw, have you considered using PostRun field?

@fbm3307
Copy link
Contributor Author

fbm3307 commented Sep 13, 2024

closing in favour of #79

@fbm3307 fbm3307 closed this Sep 13, 2024
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.

3 participants