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

[installer] Add flag to configure strict config parsing #10343

Merged
merged 1 commit into from
May 31, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented May 30, 2022

Description

To make it possible to run config validation in non-strict mode. Internal context.

Related Issue(s)

Fixes #

How to test

$ cd installer/install
$ go run main.go init > config.yaml

# set domain
$ yq w -i config.yaml '.domain = "foo.bar"' 

$ echo "foo: bar" >> config.yaml

$ go run main.go validate config --config ./config.yaml
# expected failure, the current and default behaviour
Error: error loading config: error unmarshaling JSON: while decoding JSON: json: unknown field "foo"

$  go run main.go validate config --config ./config.yaml --strict-parse=false 
{
  "valid": true
}

Release Notes

[installer] Command line flag to configure strict config parsing

Documentation

NONE

@easyCZ easyCZ requested a review from a team May 30, 2022 09:41
@github-actions github-actions bot added the team: delivery Issue belongs to the self-hosted team label May 30, 2022
}

func init() {
rootCmd.PersistentFlags().StringVar(&rootOpts.VersionMF, "debug-version-file", "", "path to a version manifest - not intended for production use")
rootCmd.PersistentFlags().BoolVar(&rootOpts.StrictConfigParse, "strict-parse", true, "toggle strict configuration parsing")
Copy link
Member

Choose a reason for hiding this comment

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

nit: being more explicit of what "strict" or "non-strict" means would be nice. E.g. I had to look up the docs to learn that strict fails on a) unknown and b) double fields.

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

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

Tested and works. ✔️

@roboquat roboquat merged commit 4d9100e into main May 31, 2022
@roboquat roboquat deleted the mp/installer-strict-parse-flag branch May 31, 2022 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note size/S team: delivery Issue belongs to the self-hosted team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants