Skip to content

Not able to test Ansible operator locally or on a k3s cluster #4530

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
soodpr opened this issue Feb 15, 2021 · 5 comments · Fixed by #4944
Closed

Not able to test Ansible operator locally or on a k3s cluster #4530

soodpr opened this issue Feb 15, 2021 · 5 comments · Fixed by #4944
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/ansible Issue is related to an Ansible operator project
Milestone

Comments

@soodpr
Copy link

soodpr commented Feb 15, 2021

Bug Report

What did you do?

I am trying to follow this doc:https://sdk.operatorframework.io/docs/building-operators/ansible/development-tips/ which creates ansible operator by using kubernetes collections to install configmap but when i am trying to run it locally via Ansible-runner or on cluster, i am not seeing any configmaps created

What did you expect to see?

configmaps get created via ansible operator

What did you see instead? Under which circumstances?

I am getting reconciler error when i am running make run command as shown below:
{"level":"error","ts":1613395806.9045317,"logger":"runner","msg":"Error symlinking latest artifacts","job":"7504504064263669287","name":"foo-sample","namespace":"default","error":"symlink /tmp/ansible-operator/runner/foo.example.com/v1alpha1/Foo/default/foo-sample/artifacts/7504504064263669287 /tmp/ansible-operator/runner/foo.example.com/v1alpha1/Foo/default/foo-sample/artifacts/latest: no such file or directory","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/pkg/mod/github.com/go-logr/[email protected]/zapr.go:132\ngithub.com/operator-framework/operator-sdk/internal/ansible/runner.(*runner).Run.func1\n\tinternal/ansible/runner/runner.go:284"}
{"level":"error","ts":1613395806.9107356,"logger":"reconciler","msg":"Failed to get ansible-runner stdout","job":"7504504064263669287","name":"foo-sample","namespace":"default","error":"open /tmp/ansible-operator/runner/foo.example.com/v1alpha1/Foo/default/foo-sample/artifacts/7504504064263669287/stdout: no such file or directory","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/pkg/mod/github.com/go-logr/[email protected]/zapr.go:132\ngithub.com/operator-framework/operator-sdk/internal/ansible/controller.(*AnsibleOperatorReconciler).Reconcile\n\tinternal/ansible/controller/reconcile.go:226\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:293\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:248\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.1\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.UntilWithContext\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:99"}
{"level":"error","ts":1613395806.910875,"logger":"controller-runtime.manager.controller.foo-controller","msg":"Reconciler error","name":"foo-sample","namespace":"default","error":"open /tmp/ansible-operator/runner/foo.example.com/v1alpha1/Foo/default/foo-sample/artifacts/7504504064263669287/stdout: no such file or directory","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/pkg/mod/github.com/go-logr/[email protected]/zapr.go:132\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:297\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:248\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1.1\n\t/home/travis/gopath/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:211\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext.func1\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:155\nk8s.io/apimachinery/pkg/util/wait.BackoffUntil\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:156\nk8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:133\nk8s.io/apimachinery/pkg/util/wait.JitterUntilWithContext\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:185\nk8s.io/apimachinery/pkg/util/wait.UntilWithContext\n\t/home/travis/gopath/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:99"}

Environment

Operator type:

/language ansible

Kubernetes cluster type:

k3s 1.19.4
$ operator-sdk version
operator-sdk version: "v1.4.0", commit: "67f9c8b888887d18cd38bb6fd85cf3cf5b94fd99", kubernetes version: "1.19.4", go version: "go1.15.5", GOOS: "linux", GOARCH: "amd64"

$ go version (if language is Go)

$ kubectl version

glcgadmin@gl1-seednode:~/foo-operator> kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4+k3s1", GitCommit:"2532c10faad43e2b6e728fdcc01662dc13d37764", GitTreeState:"clean", BuildDate:"2020-11-18T22:11:18Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4+k3s1", GitCommit:"2532c10faad43e2b6e728fdcc01662dc13d37764", GitTreeState:"clean", BuildDate:"2020-11-18T22:11:18Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}

Possible Solution

Based on documentation, it should work ideally. Since, I am new to operators, i am hoping to get this issue fixed here,

Additional context

I have installed ansible-runner v1.4.7 and ansible-runner-http v1.0.0 and installed requirements.txt via ansible-galaxy

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

hmm, that error would indicate that ansible-runner never ran, could you paste a full log?

@estroz
Copy link
Member

estroz commented Feb 15, 2021

Yeah it looks like a preceding error caused ansible-runner to fail. The runner will always try to symlink the artifact dir, so gating symlinking on artifact dir existence should prevent this particular error.

@soodpr
Copy link
Author

soodpr commented Feb 16, 2021

logs.txt
@fabianvf - i have attached the console output of "make run" command when i try to create Custom Resource instance via kubectl create -f config/samples/foo_v1alpha1_foo.yaml

@fabianvf
Copy link
Member

So the issue there is that we were not able to find the ansible-runner binary:

{"level":"error","ts":1613456939.4733825,"logger":"runner","msg":"","job":"6129484611666145821","name":"foo-sample","namespace":"default","error":"exec: \"ansible-runner\": executable file not found in $PATH","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/pkg/mod/github.com/go-logr/[email protected]/zapr.go:132\ngithub.com/operator-framework/operator-sdk/internal/ansible/runner.(*runner).Run.func1\n\tinternal/ansible/runner/runner.go:263"}

@fabianvf
Copy link
Member

fabianvf commented Feb 18, 2021

and 👍 to @estroz , if we're not finding the ansible-runner binary that should be the only error we report before aborting the run, the errors following that one are all red herrings

@estroz estroz added the kind/bug Categorizes issue or PR as related to a bug. label Feb 22, 2021
@estroz estroz added this to the v1.6.0 milestone Feb 22, 2021
@rashmigottipati rashmigottipati modified the milestones: v1.6.0, v1.7.0 Mar 16, 2021
@asmacdo asmacdo self-assigned this Apr 12, 2021
@rashmigottipati rashmigottipati modified the milestones: v1.7.0, v1.8.0 Apr 29, 2021
rashmigottipati added a commit to rashmigottipati/operator-sdk that referenced this issue May 25, 2021
rashmigottipati added a commit to rashmigottipati/operator-sdk that referenced this issue May 25, 2021
rashmigottipati added a commit to rashmigottipati/operator-sdk that referenced this issue May 25, 2021
rashmigottipati added a commit to rashmigottipati/operator-sdk that referenced this issue May 26, 2021
rashmigottipati added a commit to rashmigottipati/operator-sdk that referenced this issue May 26, 2021
…ocally or on k8s cluster

Signed-off-by: rashmigottipati <[email protected]>
rashmigottipati added a commit to rashmigottipati/operator-sdk that referenced this issue May 26, 2021
…ocally or on k8s cluster

Signed-off-by: rashmigottipati <[email protected]>
rashmigottipati added a commit that referenced this issue May 26, 2021
… cluster (#4944)

* Bugfix for #4530: unable to test ansible operator locally or on k8s cluster

Signed-off-by: rashmigottipati <[email protected]>
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants