Skip to content

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

@aaronmcohen

Description

@aaronmcohen

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

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.language/ansibleIssue is related to an Ansible operator projectlifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions