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

[Feature] CubeOptions need validation #23

Open
weilaaa opened this issue Aug 18, 2021 · 0 comments
Open

[Feature] CubeOptions need validation #23

weilaaa opened this issue Aug 18, 2021 · 0 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@weilaaa
Copy link
Member

weilaaa commented Aug 18, 2021

Why CubeOptions need validation?
Before running KubeCube, we are supposed to doing options validate, quick exit if validate failed.

	Start = func(c *cli.Context) error {
		if errs := flags.CubeOpts.Validate(); len(errs) > 0 {
			return utilerrors.NewAggregate(errs)
		}

		run(flags.CubeOpts, signals.SetupSignalHandler())

		return nil
	}

How to do it?
We had validate method but in fact doing nothing in each validate func, we need complete it.

// Validate verify options for every component
// todo(weilaaa): complete it
func (s *CubeOptions) Validate() []error {
	var errs []error

	errs = append(errs, s.APIServerOpts.Validate()...)
	errs = append(errs, s.ClientMgrOpts.Validate()...)
	errs = append(errs, s.CtrlMgrOpts.Validate()...)

	return errs
}
func (c *Config) Validate() []error {
	return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants