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

Test metallb-system namespace doesn't actually test to see if the namespace exists #350

Open
travellingtechie opened this issue Aug 17, 2023 · 0 comments
Labels
good first issue Good for newcomers

Comments

@travellingtechie
Copy link

While researching another issue, I realized the output of this command was just a long usage page, so in testing further I discovered that Test metallb-system namespace in k3s_server_post/tasks/metallb.yml always succeeds, even if the namespace doesn't exit

Expected Behavior

the command 'k3s kubectl -n metallb-system' should return a 1 if the namespace metallb-system doesn't exist

Current Behavior

it always returns 0, and just returns a usage page, doesn't actually test to see if the namespace exists

Steps to Reproduce

run k3s kubectl -n metallb-system from the command line, it doesn't check if the namespace exists, just returns usage.

Context (variables)

Operating system: Ubuntu 22.04

Hardware:

Variables Used

all.yml

NA

Possible Solution

I changed the task to:

- name: Test metallb-system namespace
  shell: >-
    k3s kubectl get namespaces | grep metallb-system
  changed_when: false
  with_items: "{{ groups[group_name_master | default('master')] }}"
  run_once: true

I had to change to shell from command to get the pip to work. There may be a more elegant solution.

@timothystewart6 timothystewart6 added the good first issue Good for newcomers label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants