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

Allow more than one backend-url to be specified in sensuctl #1907

Open
amdprophet opened this issue Aug 1, 2018 · 6 comments
Open

Allow more than one backend-url to be specified in sensuctl #1907

amdprophet opened this issue Aug 1, 2018 · 6 comments
Labels
clustering component:sensuctl Sensu CLI improvements enhancement Major version proposal Breaking changes for the next major version of Sensu Go needs-verification pinned reviewed
Milestone

Comments

@amdprophet
Copy link
Member

Allow more than one backend-url to be specified in sensuctl for fail-over purposes.

Expected Behavior

A user should be able to specify more than one backend and have sensuctl pick one (either sequentially or at random). If sensuctl cannot communicate with the chosen backend, attempt to talk to a different backend.

Current Behavior

Only one backend-url can be specified.

@palourde
Copy link
Contributor

palourde commented Aug 2, 2018

FYI, I made a quick PoC to figure out how we could achieve that.

First, we'll need to refactor the Cluster config to support one or multiple APIUrl while staying backward compatible:

type Cluster struct {
APIUrl string `json:"api-url"`
Edition string `json:"edition"`
*types.Tokens
}

Then, we just need to play with Resty to add retries (https://github.com/go-resty/resty#retries). It would look something like this in the New function:

	restyInst.SetRetryCount(2)
	restyInst.AddRetryCondition(
		func(r *resty.Response) (bool, error) {
			// Switch the HostURL to an another backend API. We need to have some
			// logic to exclude the one that just failed. Maybe inspect r.StatusCode()
			// too to ensure it's a connection error and not a 401 or 404 etc.
			restyInst.SetHostURL("http://127.0.0.1:9080")
			return true, nil
		},
	)

@calebhailey
Copy link

Closing due to inactivity (this issue was created pre-GA), plus it looks like this has been resolved & documented. It is now possible to set multiple backend URLs by setting the --backend-url flag multiple times.

See: https://docs.sensu.io/sensu-go/latest/reference/agent/#configuration

@calebhailey
Copy link

Oops, I misread this as "sensu-agent". This is RE: sensuctl which may still be a valid issue.

@calebhailey calebhailey reopened this Feb 8, 2020
@calebhailey calebhailey added the component:sensuctl Sensu CLI improvements label Feb 8, 2020
@stale
Copy link

stale bot commented Aug 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 6, 2020
@stale stale bot closed this as completed Aug 13, 2020
@amdprophet amdprophet reopened this Aug 14, 2020
@stale stale bot removed the wontfix label Aug 14, 2020
@stale
Copy link

stale bot commented Feb 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 10, 2021
@stale stale bot closed this as completed Feb 17, 2021
@amdprophet amdprophet reopened this Mar 13, 2021
@stale stale bot removed the wontfix label Mar 13, 2021
@amdprophet amdprophet changed the title DISCUSS: Allow more than one backend-url to be specified in sensuctl Allow more than one backend-url to be specified in sensuctl Nov 4, 2021
@amdprophet amdprophet added the Major version proposal Breaking changes for the next major version of Sensu Go label Nov 4, 2021
@amdprophet
Copy link
Member Author

With a new major version we can remove the api-url field and replace it with api-urls.

@calebhailey calebhailey added this to the 7.0.0 milestone Dec 23, 2021
@calebhailey calebhailey removed this from the 7.zero milestone Mar 4, 2022
@calebhailey calebhailey added this to the 7.5.0 milestone Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clustering component:sensuctl Sensu CLI improvements enhancement Major version proposal Breaking changes for the next major version of Sensu Go needs-verification pinned reviewed
Projects
None yet
Development

No branches or pull requests

5 participants