send protocol separately to agent as part of full agent policy (#79781)
This commit is contained in:
parent
7031ea4f7b
commit
041dfdd89d
|
@ -64,6 +64,7 @@ export interface FullAgentPolicy {
|
||||||
fleet?: {
|
fleet?: {
|
||||||
kibana: {
|
kibana: {
|
||||||
hosts: string[];
|
hosts: string[];
|
||||||
|
protocol: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
inputs: FullAgentPolicyInput[];
|
inputs: FullAgentPolicyInput[];
|
||||||
|
|
|
@ -81,7 +81,8 @@ describe('agent policy', () => {
|
||||||
revision: 1,
|
revision: 1,
|
||||||
fleet: {
|
fleet: {
|
||||||
kibana: {
|
kibana: {
|
||||||
hosts: ['http://localhost:5603'],
|
hosts: ['localhost:5603'],
|
||||||
|
protocol: 'http',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
|
@ -115,7 +116,8 @@ describe('agent policy', () => {
|
||||||
revision: 1,
|
revision: 1,
|
||||||
fleet: {
|
fleet: {
|
||||||
kibana: {
|
kibana: {
|
||||||
hosts: ['http://localhost:5603'],
|
hosts: ['localhost:5603'],
|
||||||
|
protocol: 'http',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
|
@ -150,7 +152,8 @@ describe('agent policy', () => {
|
||||||
revision: 1,
|
revision: 1,
|
||||||
fleet: {
|
fleet: {
|
||||||
kibana: {
|
kibana: {
|
||||||
hosts: ['http://localhost:5603'],
|
hosts: ['localhost:5603'],
|
||||||
|
protocol: 'http',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
agent: {
|
agent: {
|
||||||
|
|
|
@ -538,10 +538,16 @@ class AgentPolicyService {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error('Default settings is not setup');
|
throw new Error('Default settings is not setup');
|
||||||
}
|
}
|
||||||
if (!settings.kibana_urls) throw new Error('kibana_urls is missing');
|
if (!settings.kibana_urls || !settings.kibana_urls.length)
|
||||||
|
throw new Error('kibana_urls is missing');
|
||||||
|
const hostsWithoutProtocol = settings.kibana_urls.map((url) => {
|
||||||
|
const parsedURL = new URL(url);
|
||||||
|
return `${parsedURL.host}${parsedURL.pathname !== '/' ? parsedURL.pathname : ''}`;
|
||||||
|
});
|
||||||
fullAgentPolicy.fleet = {
|
fullAgentPolicy.fleet = {
|
||||||
kibana: {
|
kibana: {
|
||||||
hosts: settings.kibana_urls,
|
protocol: new URL(settings.kibana_urls[0]).protocol.replace(':', ''),
|
||||||
|
hosts: hostsWithoutProtocol,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||||
const { protocol, hostname, port } = kbnTestServer;
|
const { protocol, hostname, port } = kbnTestServer;
|
||||||
|
|
||||||
const kibanaUrl = Url.format({
|
const kibanaUrl = Url.format({
|
||||||
protocol,
|
|
||||||
hostname,
|
hostname,
|
||||||
port,
|
port,
|
||||||
});
|
});
|
||||||
|
@ -237,6 +236,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||||
fleet: {
|
fleet: {
|
||||||
kibana: {
|
kibana: {
|
||||||
hosts: [kibanaUrl],
|
hosts: [kibanaUrl],
|
||||||
|
protocol,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
revision: 3,
|
revision: 3,
|
||||||
|
|
Loading…
Reference in a new issue