Skip to content

fix: validate --source flag in create kustomization command#5798

Merged
matheuscscp merged 1 commit intofluxcd:mainfrom
gma1k:fix/create-kustomization-source-validation
Mar 30, 2026
Merged

fix: validate --source flag in create kustomization command#5798
matheuscscp merged 1 commit intofluxcd:mainfrom
gma1k:fix/create-kustomization-source-validation

Conversation

@gma1k
Copy link
Copy Markdown
Contributor

@gma1k gma1k commented Mar 30, 2026

Problem

Running flux create kustomization without --source silently accepts the command and forwards a broken Kustomization to the API server with empty sourceRef fields. The API server then returns:
A user seeing this has no indication that --source is the missing flag. The error refers to an internal API field they never set directly.

Fix

Validate --source before generating or applying the resource:
source is required

Follows the same pattern used in create helmrelease.

Testing

Added TestCreateKustomization covering the missing --source scenario.

Signed-off-by: Ghassan Malke <gmalke@shiftbase.com>
Copy link
Copy Markdown
Member

@matheuscscp matheuscscp left a comment

Choose a reason for hiding this comment

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

Thanks!

@matheuscscp matheuscscp added the backport:release/v2.8.x To be backported to release/v2.8.x label Mar 30, 2026
@matheuscscp matheuscscp merged commit c432d38 into fluxcd:main Mar 30, 2026
7 checks passed
@fluxcdbot
Copy link
Copy Markdown
Member

Successfully created backport PR for release/v2.8.x:

@gma1k gma1k deleted the fix/create-kustomization-source-validation branch March 30, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:release/v2.8.x To be backported to release/v2.8.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants