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

Strategic Merge Patch Silently Converts Overriding Value Type to Match Original Type of Value Getting Overriden #3286

Closed
Magnitus- opened this issue Nov 26, 2020 · 5 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@Magnitus-
Copy link

Files that can reproduce the issue

patch.yml:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: letsencrypt
spec:
  privateKey:
    algorithm: RSA
    encoding: PKCS1
    size: 4096

source.yml:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: letsencrypt
spec:
  privateKey:
    algorithm: __UNDEFINED__
    encoding: __UNDEFINED__
    size: __UNDEFINED__

kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - source.yml

patchesStrategicMerge:
  - patch.yml

In the directory with those files, run: kustomize build .

Expected output

Either:

  • Output a type mismatch error (if you want to enforce overriding values type matching the type of the value getting overriden)
  • Or output:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: letsencrypt
spec:
  privateKey:
    algorithm: RSA
    encoding: PKCS1
    size: 4096

Actual output

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: letsencrypt
spec:
  privateKey:
    algorithm: RSA
    encoding: PKCS1
    size: "4096"

Kustomize version

3.8.4 and 3.8.7.

The problem was not observable in 3.6.x, it got introduced later.

Platform

Linux

@Magnitus- Magnitus- changed the title Strategic Metch Patch Silently Converts Overriding Value Type to Match Original Type of Value Getting Overriden Strategic Merge Patch Silently Converts Overriding Value Type to Match Original Type of Value Getting Overriden Nov 26, 2020
@Shell32-Natsu Shell32-Natsu added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 30, 2020
@Shell32-Natsu Shell32-Natsu self-assigned this Nov 30, 2020
@Shell32-Natsu
Copy link
Contributor

Shell32-Natsu commented Nov 30, 2020

I suspect this is caused by a lot of conversions among Json/Yaml/Go struct. The type information is lost. Hopefully we can avoid this after #2506 and remove all these intermediate conversions.

@Shell32-Natsu Shell32-Natsu added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 30, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 28, 2021
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 30, 2021
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants