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

Use Kubernetes Ansible modules instead of embedding it into the shell #39

Open
crazyglasses opened this issue Oct 5, 2019 · 5 comments

Comments

@crazyglasses
Copy link

Is this a BUG REPORT or FEATURE REQUEST?

FEATURE REQUEST

What happened:
Observed that current experiments are written with kubectl commands embedded in the shell commands. Recommend replacing it with Ansible modules for kubernetes. Eg: https://docs.ansible.com/ansible/latest/modules/k8s_module.html#synopsis
What you expected to happen:
If modules are embedded in the image, easier development process for new experiments as well as cleaner ansible code.
How to reproduce it (as minimally and precisely as possible):
Source Code analysis

Anything else we need to know?:
It is a recommendation. Would be happy to take up and convert the existing scripts to include modules and bake it into the image as well.

@ksatchit
Copy link
Member

ksatchit commented Oct 5, 2019

Awesome @crazyglasses ! That would be great ! Moving to k8s & k8s_facts is on our roadmap - will be happy to accept contributions in that area.

@ksatchit
Copy link
Member

ksatchit commented Oct 5, 2019

Tagging @uditgaurav who has been working on a similar PR!

@uditgaurav
Copy link
Member

uditgaurav commented Oct 5, 2019

Thanks, @ksatchit for tagging me here @crazyglasses that's great I've been working on it and I have converted various shell commands into k8s and k8s_facts module. I have faced some issues in few commands explained below. I'll be happy to accept the contribution for such issues.
OPENSHIFT VERSION

[root@master-1554817485 deployers]# openshift version
openshift v3.10.127

ANSIBLE VERSION

[root@master-1554817485 deployers]# ansible --version
ansible 2.4.6.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Mar 26 2019, 22:13:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

SHELL COMMAND

            - name: Creating busybox-liveness job
              shell: kubectl create -f {{ busybox_liveness }}

USING K8S MODULE

    - name: Creating busybox-liveness job
      k8s:
        state: present
        src:  {{ busybox_liveness }}

PROBLEM STATEMENT

so what I think is k8s module is treating it as "kubectl apply -f " not "kubectl create -f "
it will be great if k8s module can work as "kubectl create -f" in any way.

@kmjayadeep
Copy link

litmuschaos/litmus#737

@uditgaurav Can you please share which all files you have refactored so far and which you are planning to work on?

I've started changing pod_failure_by_litmus file and planning to work on remaining yml files under chaoslib folder, if you haven't worked on those already.

@uditgaurav
Copy link
Member

@kmjayadeep You can carry on for remaining yml files under chaoslib. I've changed the yml files under /utils.

@ksatchit ksatchit transferred this issue from litmuschaos/litmus Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants