Disable management plugins using contextRef (#160671)

This commit is contained in:
Alison Goryachev 2023-07-18 07:21:37 -04:00 committed by GitHub
parent 37521304af
commit 75f68da623
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 131 additions and 8 deletions

View file

@ -9,7 +9,14 @@ import { schema, TypeOf } from '@kbn/config-schema';
import { PluginConfigDescriptor } from '@kbn/core-plugins-server';
const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// cloud_data_migration is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
});
export type CloudDataMigrationConfig = TypeOf<typeof configSchema>;

View file

@ -26,7 +26,14 @@ const schemaLatest = schema.object(
* Disables the plugin.
* Added back in 8.8.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// CCR is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);

View file

@ -28,7 +28,14 @@ const schemaLatest = schema.object(
* Disables the plugin.
* Added back in 8.8.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// ILM is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);

View file

@ -26,7 +26,14 @@ const schemaLatest = schema.object(
* Disables the plugin.
* Added back in 8.8.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// License Management is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);

View file

@ -26,7 +26,14 @@ const schemaLatest = schema.object(
* Disables the plugin.
* Added back in 8.8.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// Remote Clusters is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);

View file

@ -26,7 +26,14 @@ const schemaLatest = schema.object(
* Disables the plugin.
* Added back in 8.8.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// Rollups is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);

View file

@ -29,7 +29,14 @@ const schemaLatest = schema.object(
* Disables the plugin.
* Added back in 8.8.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// Snapshot & Restore is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
},
{ defaultValue: undefined }
);

View file

@ -15,7 +15,14 @@ const configSchema = schema.object({
/**
* Disables the plugin.
*/
enabled: schema.boolean({ defaultValue: true }),
enabled: schema.conditional(
schema.contextRef('serverless'),
true,
// Upgrade Assistant is disabled in serverless; refer to the serverless.yml file as the source of truth
// We take this approach in order to have a central place (serverless.yml) to view disabled plugins across Kibana
schema.boolean({ defaultValue: true }),
schema.never()
),
featureSet: schema.object({
/**

View file

@ -10,5 +10,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('serverless common UI', function () {
loadTestFile(require.resolve('./home_page'));
loadTestFile(require.resolve('./management'));
});
}

View file

@ -0,0 +1,66 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getPageObject, getService }: FtrProviderContext) {
const commonPage = getPageObject('common');
const testSubjects = getService('testSubjects');
describe('Management', function () {
describe('Disabled UIs', () => {
const DISABLED_PLUGINS = [
{
appName: 'Upgrade Assistant',
url: 'stack/upgrade_assistant',
},
{
appName: 'Advanced Settings',
url: 'kibana/settings',
},
{
appName: 'Migrate',
url: 'data/migrate_data',
},
{
appName: 'Remote Clusters',
url: 'data/remote_clusters',
},
{
appName: 'Cross-Cluster Replication',
url: 'data/cross_cluster_replication',
},
{
appName: 'Snapshot and Restore',
url: 'data/snapshot_restore',
},
{
appName: 'Index Lifecycle Management',
url: 'data/index_lifecycle_management',
},
{
appName: 'Rollup Jobs',
url: 'data/rollup_jobs',
},
{
appName: 'License Management',
url: 'stack/license_management',
},
];
DISABLED_PLUGINS.forEach(({ appName, url }) => {
it(`${appName} is not accessible`, async () => {
await commonPage.navigateToUrl('management', url, {
shouldUseHashForSubUrl: false,
});
// If the route doesn't exist, the user will be redirected back to the Management landing page
await testSubjects.exists('managementHome');
});
});
});
});
}