Skip to content

fix(deploy): skip kubectl flag validation for configs with no deploy section - #10111

Open
aniskhan001 wants to merge 3 commits into
GoogleContainerTools:mainfrom
aniskhan001:fix/10071-no-deploy-section-kubectl-flags-conflict
Open

fix(deploy): skip kubectl flag validation for configs with no deploy section#10111
aniskhan001 wants to merge 3 commits into
GoogleContainerTools:mainfrom
aniskhan001:fix/10071-no-deploy-section-kubectl-flags-conflict

Conversation

@aniskhan001

@aniskhan001 aniskhan001 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

What changed

When using skaffold apply with a multi-config project where a dependency config has no deploy section (e.g. it only provides resourceSelector), the default deployer would incorrectly treat the zero-value KubectlFlags{} as conflicting with the parent config's kubectl flags (e.g. --server-side).

Root Cause

In getDefaultDeployer, validateKubectlFlags was called for every pipeline config regardless of whether d.KubectlDeploy was nil. A nil KubectlDeploy produced a zero-value KubectlFlags{} that did not contain the parent's flags, causing a false conflict error.

Fix

Moved the validateKubectlFlags call and the DefaultNamespace conflict check inside the existing if d.KubectlDeploy != nil block. Configs without a kubectl deploy section are now skipped entirely.

Testing

  • Added regression test: TestGetDefaultDeployer/parent_config_with_kubectl_flags_and_dependency_config_with_no_deploy_section_should_not_conflict in pkg/skaffold/runner/deployer_test.go
  • All existing TestGetDefaultDeployer subtests pass

Fixes #10071

…section

When using skaffold apply with a multi-config project where a dependency
config has no deploy section (e.g. only resourceSelector), the default
deployer would incorrectly treat the zero-value KubectlFlags as
conflicting with the parent config's flags.

Move the validateKubectlFlags call and namespace check inside the
existing if d.KubectlDeploy != nil block so configs without a kubectl
deploy section are skipped entirely.

Fixes GoogleContainerTools#10071

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request resolves an issue where dependency configurations without a deploy section were incorrectly treated as having conflicting kubectl deploy flags. The fix refactors getDefaultDeployer to only process kubectl flags and namespaces when d.KubectlDeploy is not nil, and includes a regression test. Feedback on the changes suggests a performance optimization in deployer.go to reference &d.KubectlDeploy.Flags directly, which avoids copying the struct to a block-local variable and prevents unnecessary heap allocations.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pkg/skaffold/runner/deployer.go Outdated
@aniskhan001
aniskhan001 marked this pull request as ready for review June 20, 2026 12:04
@aniskhan001
aniskhan001 requested a review from a team as a code owner June 20, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skaffold apply rejects deploy flags when dependency config creates implicit deployer

1 participant