-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Ingest Manager] support multiple kibana urls #75712
Merged
neptunian
merged 18 commits into
elastic:master
from
neptunian:72731-allow-multiple-kibana-urls
Sep 2, 2020
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
aa7ac6b
let the user specify multiple kibana urls
neptunian 11382f1
add validation to kibana urls so paths and protocols cannot differ
neptunian b81c7ba
update i18n message
neptunian b11aaab
only send the first url to the instructions
neptunian c71e883
udpate all agent configs' revision when settings is updated
neptunian 7f9f138
fix jest test
neptunian 4eb6a85
update endpoint full agent policy test
neptunian 279bde0
fix type
neptunian 9e1fbd1
dont add settings if standalone mode
neptunian 6745e68
fix ui not handling errors from /{agentPolicyId}/full endpoint
neptunian 75108cf
Merge branch 'master' into 72731-allow-multiple-kibana-urls
neptunian 1591640
fix formatted message id
neptunian 69e76f4
only return needed fields
neptunian 1e47f95
fill in updated_by and updated_at attributes of the ingest-agent-poli…
neptunian f157c43
throw error if kibana_urls not set and update tests
neptunian b644e08
change ingest_manager_settings SO attribute kibana_url: string to kib…
neptunian bb7eb07
leave instructions single kibana url
neptunian 3577435
make kibana_url and other attributes created during setup required, f…
neptunian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/ingest_manager/common/services/is_diff_path_protocol.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { isDiffPathProtocol } from './is_diff_path_protocol'; | ||
|
||
describe('Ingest Manager - isDiffPathProtocol', () => { | ||
it('returns true for different paths', () => { | ||
expect( | ||
isDiffPathProtocol([ | ||
'http://localhost:8888/abc', | ||
'http://localhost:8888/abc', | ||
'http://localhost:8888/efg', | ||
]) | ||
).toBe(true); | ||
}); | ||
it('returns true for different protocols', () => { | ||
expect( | ||
isDiffPathProtocol([ | ||
'http://localhost:8888/abc', | ||
'https://localhost:8888/abc', | ||
'http://localhost:8888/abc', | ||
]) | ||
).toBe(true); | ||
}); | ||
it('returns false for same paths and protocols and different host or port', () => { | ||
expect( | ||
isDiffPathProtocol([ | ||
'http://localhost:8888/abc', | ||
'http://localhost2:8888/abc', | ||
'http://localhost:8883/abc', | ||
]) | ||
).toBe(false); | ||
}); | ||
it('returns false for one url', () => { | ||
expect(isDiffPathProtocol(['http://localhost:8888/abc'])).toBe(false); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/ingest_manager/common/services/is_diff_path_protocol.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
// validates an array of urls have the same path and protocol | ||
export function isDiffPathProtocol(kibanaUrls: string[]) { | ||
const urlCompare = new URL(kibanaUrls[0]); | ||
const compareProtocol = urlCompare.protocol; | ||
const comparePathname = urlCompare.pathname; | ||
return kibanaUrls.some((v) => { | ||
const url = new URL(v); | ||
const protocol = url.protocol; | ||
const pathname = url.pathname; | ||
return compareProtocol !== protocol || comparePathname !== pathname; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible for the old settingsDoc to have
undefined
forsettingsDoc.attributes.kibana_url
? if so, we may need to wrap this line in a conditional so that we don't set[undefined]
as a value for the new docThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only possible for there to be no settings if they haven't started kibana. Settings along with the kibana_url gets created during setup and they cannot remove it through the settings api