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

k8s_status module is not recognized by Ansible #1055

Closed
angapov opened this issue Feb 4, 2019 · 5 comments
Closed

k8s_status module is not recognized by Ansible #1055

angapov opened this issue Feb 4, 2019 · 5 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. language/ansible Issue is related to an Ansible operator project

Comments

@angapov
Copy link

angapov commented Feb 4, 2019

Bug Report

I created a simple Ansible role with the following code:

# cat roles/foo/tasks/main.yml
---
- name: "msg {{name}} {{ state }}"
  debug:
    msg: "name is {{name}}, state is {{state}}"

- name: update status
  k8s_status:
    api_version: foo.example.com/v1alpha1
    kind: Foo
    name: "{{ meta.name }}"
    namespace: "{{ meta.namespace }}"
    status:
      foo: "state is {{state}}"

I expected CR status to be updated in accordance with doc. However in operator pod logs I see:

{"level":"error","ts":1549300629.0460052,"logger":"reconciler","msg":"ansible-playbook 2.7.6\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = [u'/usr/share/ansible/openshift']\r\n  ansible python module location = /usr/lib/python2.7/site-packages/ansible\r\n  executable location = /usr/bin/ansible-playbook\r\n  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]\r\nUsing /etc/ansible/ansible.cfg as config file\r\n\n/tmp/ansible-operator/runner/foo.example.com/v1alpha1/Foo/default/example-foo/inventory/hosts did not meet host_list requirements, check plugin documentation if this is unexpected\r\n/tmp/ansible-operator/runner/foo.example.com/v1alpha1/Foo/default/example-foo/inventory/hosts did not meet script requirements, check plugin documentation if this is unexpected\r\n\nERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.\r\n\r\nThe error appears to have been in '/opt/ansible/roles/foo/tasks/main.yml': line 6, column 3, but may\r\nbe elsewhere in the file depending on the exact syntax problem.\r\n\r\nThe offending line appears to be:\r\n\r\n\r\n- name: update status\r\n  ^ here\r\n\n","job":"3941574858415657653","name":"example-foo","namespace":"default","error":"did not receive playbook_on_stats event","stacktrace":"github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/vendor/github.com/go-logr/zapr/zapr.go:128\ngithub.com/operator-framework/operator-sdk/pkg/ansible/controller.(*AnsibleOperatorReconciler).Reconcile\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/pkg/ansible/controller/reconcile.go:175\ngithub.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:213\ngithub.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func1\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:158\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:133\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.JitterUntil\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:134\ngithub.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait.Until\n\t/home/travis/gopath/src/github.com/operator-framework/operator-sdk/vendor/k8s.io/apimachinery/pkg/util/wait/wait.go:88"}

That basically means that k8s_status module is not recognized by Ansible.

What did you do?
Created a simple Ansible operator to check status update by role.

What did you expect to see?
I expected to see the CR status update in Kubernetes

What did you see instead? Under which circumstances?
Status is not updated. Errors appear in logs instead.

Environment

  • operator-sdk version: 0.4.0

  • Kubernetes version information:

Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.2", GitCommit:"cff46ab41ff0bb44d8584413b598ad8360ec1def", GitTreeState:"clean", BuildDate:"2019-01-10T23:35:51Z", GoVersion:"go1.11.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.5-gke.5", GitCommit:"9aba9c1237d9d2347bef28652b93b1cba3aca6d8", GitTreeState:"clean", BuildDate:"2018-12-11T02:36:50Z", GoVersion:"go1.10.3b4", Compiler:"gc", Platform:"linux/amd64"}
  • Kubernetes cluster kind:

  • Are you writing your operator in ansible, helm, or go?
    Ansible

@shawn-hurley shawn-hurley added kind/bug Categorizes issue or PR as related to a bug. language/ansible Issue is related to an Ansible operator project labels Feb 4, 2019
@shawn-hurley shawn-hurley self-assigned this Feb 4, 2019
@shawn-hurley
Copy link
Member

@angapov Thanks for the bug report. This is fixed by #972.

We currently are waiting to do a release for 0.4.0 and I am sorry this, Could you attempt to use the master base image? To do this change the build/Dockerfile to use the image tagged with the master. We should have a new release by the end of the week I believe. @joelanford @hasbro17 is that correct?

I am going to close this as a duplicate, but if you have more questions or issues with the master base image please feel free to re-open or comment.

@angapov
Copy link
Author

angapov commented Feb 4, 2019

@shawn-hurley I used

FROM quay.io/operator-framework/ansible-operator:master

Still the same result.

@shawn-hurley
Copy link
Member

@angapov how are you running the operator?

@angapov
Copy link
Author

angapov commented Feb 4, 2019

@shawn-hurley sorry, my mistake, forgot to push image.

@shawn-hurley
Copy link
Member

No worries, sorry about this. We have CI jobs in place now to catch this before a release happens 😳

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

No branches or pull requests

2 participants