mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Logs onboarding] Ensure versioning for SO (#165331)
Closes https://github.com/elastic/kibana/issues/160253. ### Changes - Schema was added to observabilityOnboarding SO - `x-elastic-internal-origin` was added to requests from installation script
This commit is contained in:
parent
09cd69d386
commit
4125ae2a1e
6 changed files with 54 additions and 6 deletions
|
@ -120,7 +120,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
|
|||
"ml-module": "2225cbb4bd508ea5f69db4b848be9d8a74b60198",
|
||||
"ml-trained-model": "482195cefd6b04920e539d34d7356d22cb68e4f3",
|
||||
"monitoring-telemetry": "5d91bf75787d9d4dd2fae954d0b3f76d33d2e559",
|
||||
"observability-onboarding-state": "c18631f47a0da568f12f859c9ab9d4ca73bdff7c",
|
||||
"observability-onboarding-state": "b16064c516aac64ae699c737d7d10b6e199bfded",
|
||||
"osquery-manager-usage-metric": "983bcbc3b7dda0aad29b20907db233abba709bcc",
|
||||
"osquery-pack": "6ab4358ca4304a12dcfc1777c8135b75cffb4397",
|
||||
"osquery-pack-asset": "b14101d3172c4b60eb5404696881ce5275c84152",
|
||||
|
|
|
@ -61,6 +61,7 @@ updateStepProgress() {
|
|||
--header "Authorization: ApiKey ${API_KEY_ENCODED}" \
|
||||
--header "Content-Type: application/json" \
|
||||
--header "kbn-xsrf: true" \
|
||||
--header "x-elastic-internal-origin: Kibana" \
|
||||
--data "{\"status\":\"${STATUS}\", \"message\":\"${MESSAGE}\"}" \
|
||||
--output /dev/null \
|
||||
--no-progress-meter
|
||||
|
@ -148,6 +149,7 @@ downloadElasticAgentConfig() {
|
|||
--header "Authorization: ApiKey ${API_KEY_ENCODED}" \
|
||||
--header "Content-Type: application/json" \
|
||||
--header "kbn-xsrf: true" \
|
||||
--header "x-elastic-internal-origin: Kibana" \
|
||||
--no-progress-meter \
|
||||
--output ${cfg}
|
||||
|
||||
|
@ -162,7 +164,7 @@ downloadElasticAgentConfig() {
|
|||
|
||||
if [ "${AUTO_DOWNLOAD_CONFIG}" == "autoDownloadConfig=1" ]; then
|
||||
downloadElasticAgentConfig
|
||||
echo "Done with standalone Elastic Agent setup for custom logs. Look for streaming logs to arrive in Kibana"
|
||||
echo "Done with standalone Elastic Agent setup. Look for streaming logs to arrive in Kibana"
|
||||
else
|
||||
echo "Done with standalone Elastic Agent setup for custom logs. Make sure to add your configuration to ${cfg}, then look for streaming logs to arrive in Kibana"
|
||||
echo "Done with standalone Elastic Agent setup. Make sure to add your configuration to ${cfg}, then look for streaming logs to arrive in Kibana"
|
||||
fi
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { SavedObjectsType } from '@kbn/core/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
export const OBSERVABILITY_ONBOARDING_STATE_SAVED_OBJECT_TYPE =
|
||||
'observability-onboarding-state';
|
||||
|
@ -46,6 +47,18 @@ export interface SavedObservabilityOnboardingFlow
|
|||
updatedAt: number;
|
||||
}
|
||||
|
||||
const LogFilesStateSchema = schema.object({
|
||||
datasetName: schema.string(),
|
||||
serviceName: schema.maybe(schema.string()),
|
||||
customConfigurations: schema.maybe(schema.string()),
|
||||
logFilePaths: schema.arrayOf(schema.string()),
|
||||
namespace: schema.string(),
|
||||
});
|
||||
|
||||
const SystemLogsStateSchema = schema.object({
|
||||
namespace: schema.string(),
|
||||
});
|
||||
|
||||
export const observabilityOnboardingFlow: SavedObjectsType = {
|
||||
name: OBSERVABILITY_ONBOARDING_STATE_SAVED_OBJECT_TYPE,
|
||||
hidden: false,
|
||||
|
@ -57,4 +70,24 @@ export const observabilityOnboardingFlow: SavedObjectsType = {
|
|||
progress: { type: 'object', dynamic: false },
|
||||
},
|
||||
},
|
||||
modelVersions: {
|
||||
'1': {
|
||||
changes: [],
|
||||
schemas: {
|
||||
create: schema.object({
|
||||
type: schema.string(),
|
||||
state: schema.maybe(
|
||||
schema.oneOf([LogFilesStateSchema, SystemLogsStateSchema])
|
||||
),
|
||||
progress: schema.mapOf(
|
||||
schema.string(),
|
||||
schema.object({
|
||||
status: schema.string(),
|
||||
message: schema.maybe(schema.string()),
|
||||
})
|
||||
),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -49,6 +49,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
state: {
|
||||
datasetName,
|
||||
namespace,
|
||||
logFilePaths: ['my-service.log'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -56,7 +56,14 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
|
||||
describe('when required privileges are set', () => {
|
||||
it('returns a flow id and apiKey encoded', async () => {
|
||||
const request = await callApiWithPrivileges('logFiles');
|
||||
const state = {
|
||||
datasetName: 'my-dataset',
|
||||
serviceName: 'my-service',
|
||||
namespace: 'my-namespace',
|
||||
logFilePaths: ['my-service-logs.log'],
|
||||
};
|
||||
|
||||
const request = await callApiWithPrivileges('logFiles', state);
|
||||
|
||||
expect(request.status).to.be(200);
|
||||
expect(request.body.apiKeyEncoded).to.not.empty();
|
||||
|
@ -68,7 +75,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
datasetName: 'my-dataset',
|
||||
serviceName: 'my-service',
|
||||
namespace: 'my-namespace',
|
||||
logFilePaths: 'my-service-logs.log',
|
||||
logFilePaths: ['my-service-logs.log'],
|
||||
};
|
||||
|
||||
const request = await callApiWithPrivileges('logFiles', state);
|
||||
|
|
|
@ -69,7 +69,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
body: {
|
||||
type: 'logFiles',
|
||||
name: 'name',
|
||||
state: {},
|
||||
state: {
|
||||
datasetName: 'my-dataset',
|
||||
serviceName: 'my-service',
|
||||
namespace: 'my-namespace',
|
||||
logFilePaths: ['my-service.log'],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue