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

Well-defined vars never replaced changed output stream in 5.0.0 #5039

Closed
mcclellanmj opened this issue Feb 8, 2023 · 3 comments · Fixed by #5048
Closed

Well-defined vars never replaced changed output stream in 5.0.0 #5039

mcclellanmj opened this issue Feb 8, 2023 · 3 comments · Fixed by #5048
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@mcclellanmj
Copy link

What happened?

My project had a warning about well-defined vars never replaced. In 5.0.0 it appears that the stream which was used to write out that error changed from stderr to stdout. I was redirecting my output to a yaml file to be used later and this changed causes malformed yaml.

The error message looks like so
2023/02/08 08:28:59 well-defined vars that were never replaced: MY_PROJECT/ENV

What did you expect to happen?

Same behavior as 4.5.7 where the warning was written out to stderr.

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

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml
# resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: test-object
data:
  placeholder: data

Expected output

Actual output

Kustomize version

5.0.0

Operating system

Linux

@mcclellanmj mcclellanmj added the kind/bug Categorizes issue or PR as related to a bug. label Feb 8, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 8, 2023
@cailyn-codes
Copy link
Contributor

/triage accepted
/kind regression

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/regression Categorizes issue or PR as related to a regression from a prior release. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 16, 2023
@cailyn-codes
Copy link
Contributor

cailyn-codes commented Feb 16, 2023

I was able to reproduce this issue with the following setup:

# file: kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml
namePrefix: sample-
vars:
  - name: SERVICE_ONE
    objref:
      kind: Service
      name: backendOne
      apiVersion: v1
  - name: SERVICE_UNUSED
    objref:
      kind: Service
      name: backendTwo
      apiVersion: v1
# file: resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: test-object
data:
  placeholder: data
  what: how
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: deploy1
spec: 
  template:
    spec:
      containers:
        command:
        - myserver
        - --somebackendService $(SERVICE_ONE)
---
apiVersion: v1
kind: Service
name: SERVICE_ONE
metadata:
  name: backendOne
---
apiVersion: v1
kind: Service
name: SERVICE_UNUSED
metadata:
  name: backendTwo

If you run kustomize build 2> err.yaml the warning will be piped but the log remains in the output.
I've identified the issue and will get a fix up soon.

@cailyn-codes
Copy link
Contributor

/assign

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. kind/regression Categorizes issue or PR as related to a regression from a prior release. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants