Skip to content

fix: bools where nil is interpreted as true can't have omitempty#388

Open
davidgubler wants to merge 1 commit intodevelopfrom
default-true-vs-omitempty
Open

fix: bools where nil is interpreted as true can't have omitempty#388
davidgubler wants to merge 1 commit intodevelopfrom
default-true-vs-omitempty

Conversation

@davidgubler
Copy link
Member

@davidgubler davidgubler commented Jun 17, 2025

DeletionProtection is a pointer to boolean with "omitempty" and a default of "true". This combination is broken in case the bool is set to "false", because the YAML mapper thinks that "false" is the default, thus ommitting the field; but then k8s thinks that "true" is the default (since the field is omitted). The result is that this is is always true, and it's completely impossible to set this field to "false" via the YAML mapper.

This PR fixes this by removing the "omitempty", which will make the YAML serializer also include "false" values instead of nil.

Component PR: vshn/component-appcat#774

@davidgubler davidgubler added the bug Something isn't working label Jun 17, 2025
@davidgubler davidgubler changed the base branch from master to develop June 17, 2025 11:09
@davidgubler davidgubler force-pushed the default-true-vs-omitempty branch from bcba2b6 to f0a87b5 Compare June 17, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant