-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add kubectl config flag to disable validation #3512
Add kubectl config flag to disable validation #3512
Conversation
pkg/skaffold/schema/latest/config.go
Outdated
@@ -392,6 +392,10 @@ type KubectlDeploy struct { | |||
// RemoteManifests lists Kubernetes manifests in remote clusters. | |||
RemoteManifests []string `yaml:"remoteManifests,omitempty"` | |||
|
|||
// DisableValidation passes the `--valdiate=false` flag to supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate
pkg/skaffold/schema/latest/config.go
Outdated
// DisableValidation passes the `--valdiate=false` flag to supported | ||
// `kubectl` commands when enabled. | ||
DisableValidation bool `yaml:"validate,omitempty"` | ||
|
||
// Flags are additional flags passed to `kubectl`. | ||
Flags KubectlFlags `yaml:"flags,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if DisableValidation
could be under KubectlFlags
somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want it under KubectlFlags
, because those flags are applied for any kubectl
command we run, and --validate
is only a valid option on some commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant, could we add a DisableValidation
field to KubectlFlags
and apply that to supported kubectl
commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. That makes a lot of sense!
Codecov Report
|
pkg/skaffold/deploy/kubectl.go
Outdated
CLI: kubectl.NewFromRunContext(runCtx), | ||
Flags: runCtx.Cfg.Deploy.KubectlDeploy.Flags, | ||
ForceDeploy: runCtx.Opts.Force, | ||
DisableValidation: runCtx.Cfg.Deploy.KubectlDeploy.Flags.DisableValidation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not required, now
pkg/skaffold/deploy/kubectl/cli.go
Outdated
ForceDeploy bool | ||
previousApply ManifestList | ||
ForceDeploy bool | ||
DisableValidation bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is included in Flags
pkg/skaffold/deploy/kubectl/cli.go
Outdated
@@ -62,6 +63,10 @@ func (c *CLI) Apply(ctx context.Context, out io.Writer, manifests ManifestList) | |||
args = append(args, "--force", "--grace-period=0") | |||
} | |||
|
|||
if c.DisableValidation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c. Flags. DisableValidation
pkg/skaffold/deploy/kubectl/cli.go
Outdated
@@ -77,6 +82,10 @@ func (c *CLI) ReadManifests(ctx context.Context, manifests []string) (ManifestLi | |||
} | |||
|
|||
args := c.args([]string{"--dry-run", "-oyaml"}, list...) | |||
if c.DisableValidation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c. Flags. DisableValidation
pkg/skaffold/schema/latest/config.go
Outdated
|
||
// DisableValidation passes the `--validate=false` flag to supported | ||
// `kubectl` commands when enabled. | ||
DisableValidation bool `yaml:"validate,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making all the changes!
One more problem and we should be good to go:
DisableValidation
can't be called validate
in the yaml. The first one is a negation. disableValidation
seems an ok name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review and patience as I try to squeeze this in my mornings :-)
Oh, I'm sorry @zmb3, we released the |
@zmb3 Should be ready for a rebase |
Thanks @dgageot, that was fast for not before Monday! |
\o/ |
Fixes #3222
Relates to n/a
Should merge before : n/a
Should merge after : n/a
Description
Add config flag to disable validation when using the kubectl deployer.
When enabled,
--validate=false
is passed to thekubectl apply
andkubectl create
commands.User facing changes
n/a
Before
n/a
After
n/a
Next PRs.
n/a
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
Reviewer Notes
Release Notes