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

[UII] Add proxy args to install snippets #193922

Merged
merged 14 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ properties:
type: string
download_source_id:
type: string
space_ids:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for adding this 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 the spec for this API isn't actually compiled due to it being an internal route, but figured I'd keep it up-to-date anyway

type: array
items:
type: string
data_output_id:
type: string
required:
- id
- name
Expand All @@ -33,10 +39,16 @@ properties:
$ref: ./fleet_server_host.yaml
host_proxy:
$ref: ./proxies.yaml
es_output:
$ref: ./output_create_request_elasticsearch.yaml
es_output_proxy:
$ref: ./proxies.yaml
required:
- agent_policies
- has_active
download_source:
$ref: ./download_sources.yaml
download_source_proxy:
$ref: ./proxies.yaml
required:
- fleet_server
13 changes: 12 additions & 1 deletion x-pack/plugins/fleet/common/types/rest_spec/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
* 2.0.
*/

import type { Settings, AgentPolicy, FleetServerHost, FleetProxy, DownloadSource } from '../models';
import type {
Settings,
AgentPolicy,
FleetServerHost,
FleetProxy,
DownloadSource,
Output,
} from '../models';

export interface GetSettingsResponse {
item: Settings;
Expand Down Expand Up @@ -35,16 +42,20 @@ export type EnrollmentSettingsFleetServerPolicy = Pick<
| 'fleet_server_host_id'
| 'download_source_id'
| 'space_ids'
| 'data_output_id'
>;

export interface GetEnrollmentSettingsResponse {
fleet_server: {
policies: EnrollmentSettingsFleetServerPolicy[];
has_active: boolean;
es_output?: Output;
es_output_proxy?: FleetProxy;
host?: FleetServerHost;
host_proxy?: FleetProxy;
};
download_source?: DownloadSource;
download_source_proxy?: FleetProxy;
}
export interface PutSpaceSettingsRequest {
body: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import type { PLATFORM_TYPE } from '../../../hooks';
import { useDefaultDownloadSource } from '../../../hooks';
import { useStartServices, useDefaultOutput, useKibanaVersion } from '../../../hooks';
import { useFleetServerHostsForPolicy } from '../../../hooks';
import { useStartServices, useKibanaVersion } from '../../../hooks';

import { PlatformSelector } from '../..';

Expand Down Expand Up @@ -61,24 +61,31 @@ const InstallFleetServerStepContent: React.FunctionComponent<{
}> = ({ serviceToken, fleetServerHost, fleetServerPolicyId, deploymentMode }) => {
const { docLinks } = useStartServices();
const kibanaVersion = useKibanaVersion();
const { output } = useDefaultOutput();
const { downloadSource } = useDefaultDownloadSource();

const commandOutput = output?.type === 'elasticsearch' ? output : undefined;
const { esOutput, esOutputProxy, downloadSource, downloadSourceProxy } =
useFleetServerHostsForPolicy(
fleetServerPolicyId
? {
id: fleetServerPolicyId,
}
: null
);

const installCommands = (['linux', 'mac', 'windows', 'deb', 'rpm'] as PLATFORM_TYPE[]).reduce(
(acc, platform) => {
acc[platform] = getInstallCommandForPlatform(
acc[platform] = getInstallCommandForPlatform({
platform,
commandOutput?.hosts?.[0] ?? '<ELASTICSEARCH_HOST>',
serviceToken ?? '',
fleetServerPolicyId,
esOutputHost: esOutput?.hosts?.[0] ?? '<ELASTICSEARCH_HOST>',
esOutputProxy,
serviceToken: serviceToken ?? '',
policyId: fleetServerPolicyId,
fleetServerHost,
deploymentMode === 'production',
commandOutput?.ca_trusted_fingerprint ?? undefined,
isProductionDeployment: deploymentMode === 'production',
sslCATrustedFingerprint: esOutput?.ca_trusted_fingerprint ?? undefined,
kibanaVersion,
downloadSource
);
downloadSource,
downloadSourceProxy,
});

return acc;
},
Expand Down
Loading