Skip to content

Molecule fails to run when Kustomize 4.0 is on the system #4597

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

Closed
aaronmcohen opened this issue Mar 3, 2021 · 4 comments
Closed

Molecule fails to run when Kustomize 4.0 is on the system #4597

aaronmcohen opened this issue Mar 3, 2021 · 4 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/ansible Issue is related to an Ansible operator project lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Milestone

Comments

@aaronmcohen
Copy link

aaronmcohen commented Mar 3, 2021

Bug Report

What did you do?

Steps:

  • mkdir operator-test
  • cd operator-test
  • operator-sdk init --plugins "ansible.sdk.operatorframework.io/v1"
  • operator-sdk create api --group=apps --version=v1alpha1 --kind=AppService --generate-role
  • make kustomize
  • molecule test -s kind

What did you expect to see?

Molecule to run to completion.

What did you see instead? Under which circumstances?

TASK [Set pull policy] *********************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["kustomize", "edit", "add", "patch", "pull_policy/Never.yaml"], "delta": "0:00:00.035723", "end": "2021-03-03 10:50:49.916568", "msg": "non-zero return code", "rc": 1, "start": "2021-03-03 10:50:49.880845", "stderr": "Error: must provide either patch or path\nUsage:\n  kustomize edit add patch [flags]\n\nExamples:\n\n\t\tadd patch --path {filepath} --group {target group name} --version {target version}\n\nFlags:\n      --annotation-selector string   annotationSelector in patch target\n      --group string                 API group in patch target\n  -h, --help                         help for patch\n      --kind string                  Resource kind in patch target\n      --label-selector string        labelSelector in patch target\n      --name string                  Resource name in patch target\n      --namespace string             Resource namespace in patch target\n      --patch string                 Literal string of patch content. Cannot be used with --path at the same time.\n      --path string                  Path to the patch file. Cannot be used with --patch at the same time.\n      --version string               API version in patch target\n\nGlobal Flags:\n      --stack-trace   print a stack-trace on error", "stderr_lines": ["Error: must provide either patch or path", "Usage:", "  kustomize edit add patch [flags]", "", "Examples:", "", "\t\tadd patch --path {filepath} --group {target group name} --version {target version}", "", "Flags:", "      --annotation-selector string   annotationSelector in patch target", "      --group string                 API group in patch target", "  -h, --help                         help for patch", "      --kind string                  Resource kind in patch target", "      --label-selector string        labelSelector in patch target", "      --name string                  Resource name in patch target", "      --namespace string             Resource namespace in patch target", "      --patch string                 Literal string of patch content. Cannot be used with --path at the same time.", "      --path string                  Path to the patch file. Cannot be used with --patch at the same time.", "      --version string               API version in patch target", "", "Global Flags:", "      --stack-trace   print a stack-trace on error"], "stdout": "", "stdout_lines": []}
    
    PLAY RECAP *********************************************************************
    localhost                  : ok=1    changed=1    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0
    
ERROR:

Environment

Operator type:

/language ansible

Kubernetes cluster type:

$ operator-sdk version

operator-sdk version: "v1.4.2", commit: "4b083393be65589358b3e0416573df04f4ae8d9b", kubernetes version: "v1.19.4", go version: "go1.15.8", GOOS: "darwin", GOARCH: "amd64"

$ go version (if language is Go)

go version go1.15.8 darwin/amd64

$ kubectl version

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0+e405995", GitCommit:"e40599583c035332dc295d9ea2c52e7635d48a6e", GitTreeState:"clean", BuildDate:"2021-02-05T01:23:59Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

$ kustomize version
{Version:kustomize/v4.0.1 GitCommit:516ff1fa56040adc0173ff6ece66350eb4ed78a9 BuildDate:2021-02-14T05:58:54+00:00 GoOs:darwin GoArch:amd64}

Possible Solution

  1. force Kustomize to download in the Makefile
  2. Change the molecule.yml file to always use the project Kustomize
kustomize: ${MOLECULE_PROJECT_DIRECTORY}/bin/kustomize

Additional context

@openshift-ci-robot openshift-ci-robot added the language/ansible Issue is related to an Ansible operator project label Mar 3, 2021
@estroz
Copy link
Member

estroz commented Mar 5, 2021

The kustomize edit add patch CLI changed between v3 and v4 (instead of a path positional arg, --path is required, amongst other changes). The version scaffolded by operator-sdk for ansible is v3.5.4, effectively saying "v3 is supported, other major versions are use-at-your-own-risk".

One way to fix this is by enforcing major/minor version constraints so breakages like this don't happen, i.e. force download of the correct major/minor version if not present locally as you mentioned @aaronmcohen.

@jberkhahn jberkhahn added the kind/bug Categorizes issue or PR as related to a bug. label Mar 8, 2021
@jberkhahn jberkhahn added this to the Backlog milestone Mar 8, 2021
@estroz
Copy link
Member

estroz commented Mar 8, 2021

This issue affects kubebuilder as well, will link the relevant issue there once created so the changes can be replicated for ansible (and helm).

@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 6, 2021
@estroz
Copy link
Member

estroz commented Jun 9, 2021

See #4975 and #4976.

@estroz estroz closed this as completed Jun 9, 2021
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. language/ansible Issue is related to an Ansible operator project lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

5 participants