kubernetes-plugin: integrate with top method from kubernetes client library (#8248)

* kubernetes-plugin: integrate with top method from kubernetes client library

Signed-off-by: mclarke <mclarke@spotify.com>

* fix existing tests

Signed-off-by: mclarke <mclarke@spotify.com>

* prettier

Signed-off-by: mclarke <mclarke@spotify.com>

* add fetcher test

Signed-off-by: mclarke <mclarke@spotify.com>

* update api report

Signed-off-by: mclarke <mclarke@spotify.com>

* fix fe tests

Signed-off-by: mclarke <mclarke@spotify.com>

* fe tests

Signed-off-by: mclarke <mclarke@spotify.com>

* changeset

Signed-off-by: mclarke <mclarke@spotify.com>

* add skip metrics lookup flag

Signed-off-by: mclarke <mclarke@spotify.com>

* add skip metrics lookup to gke locator and docs

Signed-off-by: mclarke <mclarke@spotify.com>

* fix tests

Signed-off-by: mclarke <mclarke@spotify.com>

* minor change

Signed-off-by: mclarke <mclarke@spotify.com>

* missed prettier

Signed-off-by: mclarke <mclarke@spotify.com>

* missed file

Signed-off-by: mclarke <mclarke@spotify.com>

* more details to changeset

Signed-off-by: mclarke <mclarke@spotify.com>
This commit is contained in:
Matthew Clarke
2021-12-02 23:10:48 +00:00
committed by GitHub
parent a6639021a6
commit c010632f88
42 changed files with 1005 additions and 155 deletions
+42 -2
View File
@@ -4,11 +4,11 @@
```ts
import { Entity } from '@backstage/catalog-model';
import { ExtensionsV1beta1Ingress } from '@kubernetes/client-node';
import { V1ConfigMap } from '@kubernetes/client-node';
import { V1CronJob } from '@kubernetes/client-node';
import { V1Deployment } from '@kubernetes/client-node';
import { V1HorizontalPodAutoscaler } from '@kubernetes/client-node';
import { V1Ingress } from '@kubernetes/client-node';
import { V1Job } from '@kubernetes/client-node';
import { V1Pod } from '@kubernetes/client-node';
import { V1ReplicaSet } from '@kubernetes/client-node';
@@ -19,6 +19,44 @@ import { V1Service } from '@kubernetes/client-node';
// @public (undocumented)
export type AuthProviderType = 'google' | 'serviceAccount' | 'aws';
// Warning: (ae-missing-release-tag) "ClientContainerStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ClientContainerStatus {
// (undocumented)
container: string;
// (undocumented)
cpuUsage: ClientCurrentResourceUsage;
// (undocumented)
memoryUsage: ClientCurrentResourceUsage;
}
// Warning: (ae-missing-release-tag) "ClientCurrentResourceUsage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ClientCurrentResourceUsage {
// (undocumented)
currentUsage: number | string;
// (undocumented)
limitTotal: number | string;
// (undocumented)
requestTotal: number | string;
}
// Warning: (ae-missing-release-tag) "ClientPodStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface ClientPodStatus {
// (undocumented)
containers: ClientContainerStatus[];
// (undocumented)
cpu: ClientCurrentResourceUsage;
// (undocumented)
memory: ClientCurrentResourceUsage;
// (undocumented)
pod: V1Pod;
}
// Warning: (ae-missing-release-tag) "ClusterAttributes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -37,6 +75,8 @@ export interface ClusterObjects {
// (undocumented)
errors: KubernetesFetchError[];
// (undocumented)
podMetrics: ClientPodStatus[];
// (undocumented)
resources: FetchResponse[];
}
@@ -110,7 +150,7 @@ export interface HorizontalPodAutoscalersFetchResponse {
// @public (undocumented)
export interface IngressesFetchResponse {
// (undocumented)
resources: Array<ExtensionsV1beta1Ingress>;
resources: Array<V1Ingress>;
// (undocumented)
type: 'ingresses';
}
+1 -1
View File
@@ -36,7 +36,7 @@
},
"dependencies": {
"@backstage/catalog-model": "^0.9.7",
"@kubernetes/client-node": "^0.15.0"
"@kubernetes/client-node": "^0.16.0"
},
"devDependencies": {
"@backstage/cli": "^0.10.0"
+22 -2
View File
@@ -15,11 +15,11 @@
*/
import {
ExtensionsV1beta1Ingress,
V1ConfigMap,
V1CronJob,
V1Deployment,
V1HorizontalPodAutoscaler,
V1Ingress,
V1Job,
V1Pod,
V1ReplicaSet,
@@ -69,6 +69,7 @@ export interface ClusterAttributes {
export interface ClusterObjects {
cluster: ClusterAttributes;
resources: FetchResponse[];
podMetrics: ClientPodStatus[];
errors: KubernetesFetchError[];
}
@@ -132,7 +133,7 @@ export interface CronJobsFetchResponse {
export interface IngressesFetchResponse {
type: 'ingresses';
resources: Array<ExtensionsV1beta1Ingress>;
resources: Array<V1Ingress>;
}
export interface CustomResourceFetchResponse {
@@ -151,3 +152,22 @@ export type KubernetesErrorTypes =
| 'UNAUTHORIZED_ERROR'
| 'SYSTEM_ERROR'
| 'UNKNOWN_ERROR';
export interface ClientCurrentResourceUsage {
currentUsage: number | string;
requestTotal: number | string;
limitTotal: number | string;
}
export interface ClientContainerStatus {
container: string;
cpuUsage: ClientCurrentResourceUsage;
memoryUsage: ClientCurrentResourceUsage;
}
export interface ClientPodStatus {
pod: V1Pod;
cpu: ClientCurrentResourceUsage;
memory: ClientCurrentResourceUsage;
containers: ClientContainerStatus[];
}