[Ingest Manager] Enforce license level for custom registry URL (#79204)

* Enforce enterprise license for custom registry URL

* Add comments
This commit is contained in:
Jen Huang 2020-10-05 12:20:33 -07:00 committed by GitHub
parent 8120e7e7bc
commit c88d2d3ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View file

@ -8,7 +8,8 @@
- [code for adding the routes](https://github.com/elastic/kibana/blob/1f27d349533b1c2865c10c45b2cf705d7416fb36/x-pack/plugins/ingest_manager/server/plugin.ts#L115-L133)
- [Integration tests](server/integration_tests/router.test.ts)
- Both EPM and Fleet require `ingestManager` be enabled. They are not standalone features.
- For Gold+ license, a custom package registry URL can be used by setting `xpack.ingestManager.registryUrl=http://localhost:8080`
- For Enterprise license, a custom package registry URL can be used by setting `xpack.ingestManager.registryUrl=http://localhost:8080`
- This property is currently only for internal Elastic development and is unsupported
## Fleet Requirements

View file

@ -43,4 +43,11 @@ export class LicenseService {
this.licenseInformation?.hasAtLeast('gold')
);
}
public isEnterprise() {
return (
this.licenseInformation?.isAvailable &&
this.licenseInformation?.isActive &&
this.licenseInformation?.hasAtLeast('enterprise')
);
}
}

View file

@ -28,16 +28,19 @@ const getDefaultRegistryUrl = (): string => {
}
};
// Custom registry URL is currently only for internal Elastic development and is unsupported
export const getRegistryUrl = (): string => {
const customUrl = appContextService.getConfig()?.registryUrl;
const isGoldPlus = licenseService.isGoldPlus();
const isEnterprise = licenseService.isEnterprise();
if (customUrl && isGoldPlus) {
if (customUrl && isEnterprise) {
return customUrl;
}
if (customUrl) {
appContextService.getLogger().warn('Gold license is required to use a custom registry url.');
appContextService
.getLogger()
.warn('Enterprise license is required to use a custom registry url.');
}
return getDefaultRegistryUrl();