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 replaces null with "null" in case of repetetive component inclusion #5631

Open
vlasov-y opened this issue Mar 29, 2024 · 2 comments
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

@vlasov-y
Copy link

What happened?

Kustomize replaced null value with string null. So type change have happened because of component included twice.

It may be related to #5519

What did you expect to happen?

Idempotent behavior of the Component if I include it more than once.

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

Here is a script to create example stack.

mkdir null-example
cd null-example
mkdir app hr-timeout-2m

cat <<EOF >./kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- app
# - another-app
# - third-one
# It is a tenant stack that includes several applications
# Some of them have timeout, some of them - not...
components:
# ...so we include component to set timeout on tenant level...
# ...to be sure that all applications have it is set
- hr-timeout-2m
EOF

cat <<EOF >./app/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- hr.yaml
# This application already has a timeout set
components:
- ../hr-timeout-2m
EOF

cat <<EOF >./app/hr.yaml
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: test
spec:
  values:
    containerPorts:
      http: null
      https: 443
EOF

cat <<EOF >./hr-timeout-2m/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
patches:
- patch: |-
    apiVersion: helm.toolkit.fluxcd.io/v2beta2
    kind: HelmRelease
    metadata:
      name: _
    spec:
      interval: 5m
      timeout: 2m
  target:
    kind: HelmRelease
EOF

Expected output

apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: test
spec:
  interval: 5m
  timeout: 2m
  values:
    containerPorts:
      http: null
      https: 443

Actual output

apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: test
spec:
  interval: 5m
  timeout: 2m
  values:
    containerPorts:
      http: "null"
      https: 443

Kustomize version

5.3.0

Operating system

Linux

@vlasov-y vlasov-y added the kind/bug Categorizes issue or PR as related to a bug. label Mar 29, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 29, 2024
@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/test-infra repository.

@matthewhughes934
Copy link
Contributor

It may be related to #5519

👍 I believe that should fix this issue, but there's not yet a release including that commit. Running with your example (just checked out current master: 8fef99f):

$ go run ./kustomize/ build null-example/
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: test
spec:
  interval: 5m
  timeout: 2m
  values:
    containerPorts:
      http: null
      https: 443

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

3 participants