From 3ec294a186debe88d12460f749c53847740f5943 Mon Sep 17 00:00:00 2001 From: goenning Date: Fri, 13 May 2022 13:35:02 +0100 Subject: [PATCH 1/2] expose detectErrors function publicly Signed-off-by: goenning --- .changeset/hip-ways-shop.md | 5 +++++ plugins/kubernetes/api-report.md | 32 ++++++++++++++++++++++++++++++++ plugins/kubernetes/src/index.ts | 1 + 3 files changed, 38 insertions(+) create mode 100644 .changeset/hip-ways-shop.md diff --git a/.changeset/hip-ways-shop.md b/.changeset/hip-ways-shop.md new file mode 100644 index 0000000000..74646b7b3a --- /dev/null +++ b/.changeset/hip-ways-shop.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-kubernetes': patch +--- + +expose detectErrors function publicly diff --git a/plugins/kubernetes/api-report.md b/plugins/kubernetes/api-report.md index 99bee06165..19b25b1b02 100644 --- a/plugins/kubernetes/api-report.md +++ b/plugins/kubernetes/api-report.md @@ -108,6 +108,38 @@ export interface DeploymentResources { replicaSets: V1ReplicaSet[]; } +// Warning: (ae-missing-release-tag) "DetectedError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export interface DetectedError { + // (undocumented) + cluster: string; + // Warning: (ae-forgotten-export) The symbol "ErrorDetectableKind" needs to be exported by the entry point index.d.ts + // + // (undocumented) + kind: ErrorDetectableKind; + // (undocumented) + message: string[]; + // (undocumented) + names: string[]; + // Warning: (ae-forgotten-export) The symbol "ErrorSeverity" needs to be exported by the entry point index.d.ts + // + // (undocumented) + severity: ErrorSeverity; +} + +// Warning: (ae-missing-release-tag) "DetectedErrorsByCluster" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export type DetectedErrorsByCluster = Map; + +// Warning: (ae-missing-release-tag) "detectErrors" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) +// +// @public (undocumented) +export const detectErrors: ( + objects: ObjectsByEntityResponse, +) => DetectedErrorsByCluster; + // Warning: (ae-missing-release-tag) "EntityKubernetesContent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) diff --git a/plugins/kubernetes/src/index.ts b/plugins/kubernetes/src/index.ts index 688d52d7e1..39a966cd1f 100644 --- a/plugins/kubernetes/src/index.ts +++ b/plugins/kubernetes/src/index.ts @@ -30,5 +30,6 @@ export * from './api'; export * from './kubernetes-auth-provider'; export * from './utils/clusterLinks'; export * from './components'; +export * from './error-detection'; export * from './hooks'; export * from './types'; From 1c752277c6f21cd5f1c6131b9efc66e2cbf71c83 Mon Sep 17 00:00:00 2001 From: goenning Date: Mon, 11 Jul 2022 14:13:17 +0100 Subject: [PATCH 2/2] fix api-reports Signed-off-by: goenning --- plugins/kubernetes/api-report.md | 25 +++++++++---------- .../src/error-detection/error-detection.ts | 8 ++++-- .../kubernetes/src/error-detection/index.ts | 7 +++++- .../kubernetes/src/error-detection/types.ts | 20 +++++++++++++++ 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/plugins/kubernetes/api-report.md b/plugins/kubernetes/api-report.md index ee8c9b502d..da6948043c 100644 --- a/plugins/kubernetes/api-report.md +++ b/plugins/kubernetes/api-report.md @@ -98,34 +98,24 @@ export interface DeploymentResources { replicaSets: V1ReplicaSet[]; } -// Warning: (ae-missing-release-tag) "DetectedError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) +// @alpha export interface DetectedError { // (undocumented) cluster: string; - // Warning: (ae-forgotten-export) The symbol "ErrorDetectableKind" needs to be exported by the entry point index.d.ts - // // (undocumented) kind: ErrorDetectableKind; // (undocumented) message: string[]; // (undocumented) names: string[]; - // Warning: (ae-forgotten-export) The symbol "ErrorSeverity" needs to be exported by the entry point index.d.ts - // // (undocumented) severity: ErrorSeverity; } -// Warning: (ae-missing-release-tag) "DetectedErrorsByCluster" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) +// @alpha export type DetectedErrorsByCluster = Map; -// Warning: (ae-missing-release-tag) "detectErrors" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) +// @alpha export const detectErrors: ( objects: ObjectsByEntityResponse, ) => DetectedErrorsByCluster; @@ -142,6 +132,12 @@ export type EntityKubernetesContentProps = { refreshIntervalMs?: number; }; +// @alpha +export type ErrorDetectableKind = + | 'Pod' + | 'Deployment' + | 'HorizontalPodAutoscaler'; + // Warning: (ae-forgotten-export) The symbol "ErrorPanelProps" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ErrorPanel" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -160,6 +156,9 @@ export const ErrorReporting: ({ detectedErrors, }: ErrorReportingProps) => JSX.Element; +// @alpha +export type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; + // Warning: (ae-forgotten-export) The symbol "FormatClusterLinkOptions" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "formatClusterLink" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // diff --git a/plugins/kubernetes/src/error-detection/error-detection.ts b/plugins/kubernetes/src/error-detection/error-detection.ts index e1e83f23ab..3a9f1571e0 100644 --- a/plugins/kubernetes/src/error-detection/error-detection.ts +++ b/plugins/kubernetes/src/error-detection/error-detection.ts @@ -21,8 +21,12 @@ import { detectErrorsInPods } from './pods'; import { detectErrorsInDeployments } from './deployments'; import { detectErrorsInHpa } from './hpas'; -// For each cluster try to find errors in each of the object types provided -// returning a map of cluster names to errors in that cluster +/** + * For each cluster try to find errors in each of the object types provided + * returning a map of cluster names to errors in that cluster + * + * @alpha + */ export const detectErrors = ( objects: ObjectsByEntityResponse, ): DetectedErrorsByCluster => { diff --git a/plugins/kubernetes/src/error-detection/index.ts b/plugins/kubernetes/src/error-detection/index.ts index b9127ccbda..ced03066a7 100644 --- a/plugins/kubernetes/src/error-detection/index.ts +++ b/plugins/kubernetes/src/error-detection/index.ts @@ -14,5 +14,10 @@ * limitations under the License. */ -export type { DetectedError, DetectedErrorsByCluster } from './types'; +export type { + ErrorDetectableKind, + DetectedError, + DetectedErrorsByCluster, + ErrorSeverity, +} from './types'; export { detectErrors } from './error-detection'; diff --git a/plugins/kubernetes/src/error-detection/types.ts b/plugins/kubernetes/src/error-detection/types.ts index 2ec66f3efc..871413d43e 100644 --- a/plugins/kubernetes/src/error-detection/types.ts +++ b/plugins/kubernetes/src/error-detection/types.ts @@ -21,17 +21,37 @@ import { V1Pod, } from '@kubernetes/client-node'; +/** + * Severity of the error, where 10 is critical and 0 is very low. + * + * @alpha + */ export type ErrorSeverity = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; export type ErrorDetectable = V1Pod | V1Deployment | V1HorizontalPodAutoscaler; +/** + * Kubernetes kinds that errors might be reported by the plugin + * + * @alpha + */ export type ErrorDetectableKind = | 'Pod' | 'Deployment' | 'HorizontalPodAutoscaler'; +/** + * A list of errors keyed by Cluster name + * + * @alpha + */ export type DetectedErrorsByCluster = Map; +/** + * Represents an error found on a Kubernetes object + * + * @alpha + */ export interface DetectedError { severity: ErrorSeverity; cluster: string;