Skip to content

Commit

Permalink
[Data Usage] remove autoops.api.tls.ca config (elastic#200808)
Browse files Browse the repository at this point in the history
## Summary

Remove unused `autoops.api.tls.ca` config.


### Checklist

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_node:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

Co-authored-by: Ash <[email protected]>
  • Loading branch information
2 people authored and CAWilson94 committed Dec 12, 2024
1 parent 0901c1d commit 647a772
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/data_usage/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const configSchema = schema.object({
schema.object({
certificate: schema.maybe(schema.string()),
key: schema.maybe(schema.string()),
ca: schema.maybe(schema.string()),
})
),
})
Expand Down
21 changes: 15 additions & 6 deletions x-pack/plugins/data_usage/server/services/autoops_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,23 @@ export class AutoOpsAPIService {
throw new AutoOpsError(AUTO_OPS_MISSING_CONFIG_ERROR);
}

if (!autoopsConfig.api?.url) {
this.logger.error(`[AutoOps API] Missing API URL in the configuration.`, errorMetadata);
throw new AutoOpsError('Missing API URL in AutoOps configuration.');
}

if (!autoopsConfig.api?.tls?.certificate || !autoopsConfig.api?.tls?.key) {
this.logger.error(
`[AutoOps API] Missing required TLS certificate or key in the configuration.`,
errorMetadata
);
throw new AutoOpsError('Missing required TLS certificate or key in AutoOps configuration.');
}

this.logger.debug(
`[AutoOps API] Creating autoops agent with TLS cert: ${
autoopsConfig?.api?.tls?.certificate ? '[REDACTED]' : 'undefined'
} and TLS key: ${autoopsConfig?.api?.tls?.key ? '[REDACTED]' : 'undefined'}
and TLS ca: ${autoopsConfig?.api?.tls?.ca ? '[REDACTED]' : 'undefined'}`
`[AutoOps API] Creating autoops agent with request URL: ${autoopsConfig.api.url} and TLS cert: [REDACTED] and TLS key: [REDACTED]`
);

const controller = new AbortController();
const tlsConfig = this.createTlsConfig(autoopsConfig);
const cloudSetup = appContextService.getCloud();
Expand Down Expand Up @@ -169,7 +180,6 @@ export class AutoOpsAPIService {
enabled: true,
certificate: autoopsConfig?.api?.tls?.certificate,
key: autoopsConfig?.api?.tls?.key,
certificateAuthorities: autoopsConfig?.api?.tls?.ca,
})
);
}
Expand All @@ -187,7 +197,6 @@ export class AutoOpsAPIService {
...requestConfig.httpsAgent.options,
cert: requestConfig.httpsAgent.options.cert ? 'REDACTED' : undefined,
key: requestConfig.httpsAgent.options.key ? 'REDACTED' : undefined,
ca: requestConfig.httpsAgent.options.ca ? 'REDACTED' : undefined,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { createTestConfig } from '../../config.base';
import { services as apmServices } from './apm_api_integration/common/services';
import { services as datasetQualityServices } from './dataset_quality_api_integration/common/services';
Expand Down Expand Up @@ -32,6 +32,5 @@ export default createTestConfig({
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
`--xpack.dataUsage.autoops.api.tls.ca=${CA_CERT_PATH}`,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { createTestConfig } from '../../config.base';

export default createTestConfig({
Expand All @@ -28,6 +28,5 @@ export default createTestConfig({
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
`--xpack.dataUsage.autoops.api.tls.ca=${CA_CERT_PATH}`,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { createTestConfig } from '../../config.base';

export default createTestConfig({
Expand All @@ -32,6 +32,5 @@ export default createTestConfig({
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
`--xpack.dataUsage.autoops.api.tls.ca=${CA_CERT_PATH}`,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { createTestConfig } from '../../config.base';

export default createTestConfig({
Expand All @@ -25,6 +25,5 @@ export default createTestConfig({
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
`--xpack.dataUsage.autoops.api.tls.ca=${CA_CERT_PATH}`,
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { createTestConfig } from '../../config.base';

export default createTestConfig({
Expand All @@ -28,7 +28,6 @@ export default createTestConfig({
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
`--xpack.dataUsage.autoops.api.tls.ca=${CA_CERT_PATH}`,
],
apps: {
serverlessElasticsearch: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { CA_CERT_PATH, KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { KBN_CERT_PATH, KBN_KEY_PATH } from '@kbn/dev-utils';
import { createTestConfig } from '../../config.base';

export default createTestConfig({
Expand All @@ -25,6 +25,5 @@ export default createTestConfig({
'--xpack.dataUsage.autoops.api.url=http://localhost:9000',
`--xpack.dataUsage.autoops.api.tls.certificate=${KBN_CERT_PATH}`,
`--xpack.dataUsage.autoops.api.tls.key=${KBN_KEY_PATH}`,
`--xpack.dataUsage.autoops.api.tls.ca=${CA_CERT_PATH}`,
],
});

0 comments on commit 647a772

Please sign in to comment.