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 plugin fails with deprecation warnings #639

Open
eriknelson opened this issue Jul 29, 2023 · 1 comment · May be fixed by #728
Open

Kustomize plugin fails with deprecation warnings #639

eriknelson opened this issue Jul 29, 2023 · 1 comment · May be fixed by #728
Labels
type/enhancement New feature or request

Comments

@eriknelson
Copy link

SUMMARY

Kustomize Version: 5.1.0

I'm attempting to use the kustomize plugin to render a manifest and getting the following error:

---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: metallb-system
resources:
  - github.com/metallb/metallb/config/native?ref=v0.13.10

Error output:

fatal: [localhost]: FAILED! => {
    "msg": "kustomize command failed with: # Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.\n# Warning: 'patchesJson6902' is deprecated. Please use 'patches' instead. Run 'kustomize edit fix' to update your Kustomization automatically.\n"
}

Stepping through the code, it looks like the deprecation warnings are present in stderr, and the plugin simply looks for the presence of the error without any additional nuance. I confirmed that out in this case actually contains the manifest that I'm looking for.

I think my expectation here would be to delegate to the user whether or not to treat deprecation warnings as errors maybe with a switch, with a stricter default of True, but at least that would give me a path to ignoring these.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Kustomize lookup plugin

ANSIBLE VERSION
ansible [core 2.15.0]
  config file = None
  configured module search path = ['/home/ernelson/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /git/nexus.workloads/.venv/lib/python3.11/site-packages/ansible
  ansible collection location = /home/ernelson/.ansible/collections:/usr/share/ansible/collections
  executable location = /git/nexus.workloads/.venv/bin/ansible
  python version = 3.11.4 (main, Jun  9 2023, 14:24:46) [GCC 13.1.1 20230429] (/git/nexus.workloads/.venv/bin/python)
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION

Affected collection version: 2.4.0

I'm also seeing this on main.

CONFIGURATION
CONFIG_FILE() = None
EDITOR(env: EDITOR) = nvim
PAGER(env: PAGER) = less
OS / ENVIRONMENT

Arch Linux

STEPS TO REPRODUCE
  • Create the manifest above in metallb/
  • Run a play with the following task:
- name: Set workload dir
  set_fact:
    workload_dir: "metallb"
- name: Render kustomize
  set_fact:
    manifest: "{{lookup('kubernetes.core.kustomize', dir=workload_dir)}}"
EXPECTED RESULTS

Expecting to have the contents of the manifest in the manifest var.

ACTUAL RESULTS

Error seen in summary

@gravesm
Copy link
Member

gravesm commented Aug 1, 2023

This is something that should ultimately be addressed at the kubectl/kustomize level. I would be hesitant to start parsing the output of kustomize to figure out what's an error and what's a warning. A quick search through the kustomize code shows deprecation messages don't follow a standard format. The work being done in https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/3104-introduce-kuberc would likely offer a way to suppress warnings.

We can keep this open and consider it, but I'm inclined to see whether KEP 3104 offers a better solution. As a workaround you could use errors='ignore' or errors='warn'.

@gravesm gravesm added the type/enhancement New feature or request label Aug 1, 2023
@qcu266 qcu266 linked a pull request May 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants