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

Namespace not automatically being created. #38

Open
MichaelCharles opened this issue Jul 1, 2022 · 5 comments
Open

Namespace not automatically being created. #38

MichaelCharles opened this issue Jul 1, 2022 · 5 comments

Comments

@MichaelCharles
Copy link
Contributor

MichaelCharles commented Jul 1, 2022

I tried to follow the instructions listed in the README, but when the action is run I get this output

=== Active Configuration
API URL:                  ***
Namespace:                default
Format:                   tabular
Timeout:                  15s
Username:                 ***
JWT Expiration Timestamp: 56652836
Directory test-namespace exists in namespaces/ but is not a defined namespace in sensu, skipping

It seems like I need to perhaps create the namespace manually beforehand? Although it doesn't seem that way according to the README.

edit: Currently using 0.5.0

@MichaelCharles
Copy link
Contributor Author

I updated to use the most recent commit rather than 0.5.0, and I'm still getting the same result

Error: Unable to locate credentials. You can either configure credentials by running "sensuctl configure" or by using the --api-key command line option
Directory test-namespace exists in namespaces/ but is not a defined namespace in sensu, skipping

However, I'm also getting an error concerning using the --api-key command line option.

@MichaelCharles
Copy link
Contributor Author

I reverted back to 0.5.0 and created the namespace manually, and after that it seems to have solved the problem. But if the namespaces are meant to be created automatically, then this seems to be broken.

@jspaleta
Copy link
Contributor

jspaleta commented Jul 1, 2022

I think I understand.

It doesn't automatically make namespaces that exist in 'namespaces_dir' It will create namespaces that exist in the 'namspaces_file' as a separate control.

Take a look at this CI test for an example:

- name: Sensuflow matching label with dashes

    - name: Sensuflow matching label with dashes
      uses: ./
      id: matching-label-with-dash
      with:
        sensu_api_url: http://sensu-backend:8080
        sensu_user: ${{ secrets.SENSU_USER }}
        sensu_password: ${{ secrets.SENSU_PASSWORD }} 
        namespaces_dir: .sensu.test/namespaces/
        namespaces_file: .sensu.test/cluster/namespaces.yaml
        matching_label: "sensu.io/workflow"
        matching_condition: "== 'sensu-flow'"

In this CI test the namespace resources included in .sensu.test/cluster/namespaces.yaml will get created before the contents of .sensu.test/namespaces/ are processed.

@MichaelCharles
Copy link
Contributor Author

MichaelCharles commented Jul 5, 2022

In my case, the namespace was defined in .sensu/cluster/namespaces.yaml, but I still got the error described.

I had just followed the steps listed on the sensu/sensu-flow readme, although perhaps I missed something? I'd like to try and reproduce the problem but I need to find time to do so.

@jspaleta
Copy link
Contributor

jspaleta commented Jul 7, 2022

If your able to find a reproducer I can add it as a CI test. But as of right now I'm not sure how to help. There is a CI test in github actions that covers this.

Best guess is your using a sensu user that does not have RBAC access to create namespace resources.

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

2 participants