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

Kustomize considers apiVersion a part of object ID, but it is not #5843

Open
chlunde opened this issue Jan 15, 2025 · 1 comment
Open

Kustomize considers apiVersion a part of object ID, but it is not #5843

chlunde opened this issue Jan 15, 2025 · 1 comment
Labels
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.

Comments

@chlunde
Copy link
Contributor

chlunde commented Jan 15, 2025

What happened?

I think the ID of a object is the tuple (apiGroup/kind/metadata.name/metadata.namespace). The apiVersion is just the current schema version used to represent the object on disk or in transit.

If someone has the same apiGroup/kind/metadata.name/metadata.namespace twice, kustomize will rightfully complain. It does not complain now if the apiVersion differs.

What did you expect to happen?

Kustomize build should fail

How can we reproduce it (as minimally and precisely as possible)?

# a.yaml 
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
  name: a
spec: {}
# b.yaml 
apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
  name: a
spec: {}
# kustomization.yaml 
resources:
- a.yaml
- b.yaml

Expected output

Error: accumulating resources: accumulation err='merging resources from 'b.yaml': may not add resource with an already registered id: AuthorizationPolicy.v1.security.istio.io/a.[noNs]':

Actual output

apiVersion: security.istio.io/v1
kind: AuthorizationPolicy
metadata:
  name: a
spec: {}
---
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
  name: a
spec: {}

Kustomize version

master as of 2025-01-15

Operating system

Linux

@chlunde chlunde added the kind/bug Categorizes issue or PR as related to a bug. label Jan 15, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 15, 2025
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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

2 participants