@backstage/plugin-kubernetes-common 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @backstage/plugin-kubernetes-common
2
2
 
3
+ ## 0.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/catalog-model@1.5.0
9
+
10
+ ## 0.7.6-next.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - @backstage/catalog-model@1.5.0-next.0
16
+ - @backstage/types@1.1.1
17
+ - @backstage/plugin-permission-common@0.7.13
18
+
3
19
  ## 0.7.5
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,15 @@
1
+ const ANNOTATION_KUBERNETES_API_SERVER = "kubernetes.io/api-server";
2
+ const ANNOTATION_KUBERNETES_API_SERVER_CA = "kubernetes.io/api-server-certificate-authority";
3
+ const ANNOTATION_KUBERNETES_AUTH_PROVIDER = "kubernetes.io/auth-provider";
4
+ const ANNOTATION_KUBERNETES_OIDC_TOKEN_PROVIDER = "kubernetes.io/oidc-token-provider";
5
+ const ANNOTATION_KUBERNETES_SKIP_METRICS_LOOKUP = "kubernetes.io/skip-metrics-lookup";
6
+ const ANNOTATION_KUBERNETES_SKIP_TLS_VERIFY = "kubernetes.io/skip-tls-verify";
7
+ const ANNOTATION_KUBERNETES_DASHBOARD_URL = "kubernetes.io/dashboard-url";
8
+ const ANNOTATION_KUBERNETES_DASHBOARD_APP = "kubernetes.io/dashboard-app";
9
+ const ANNOTATION_KUBERNETES_DASHBOARD_PARAMETERS = "kubernetes.io/dashboard-parameters";
10
+ const ANNOTATION_KUBERNETES_AWS_ASSUME_ROLE = "kubernetes.io/aws-assume-role";
11
+ const ANNOTATION_KUBERNETES_AWS_CLUSTER_ID = "kubernetes.io/x-k8s-aws-id";
12
+ const ANNOTATION_KUBERNETES_AWS_EXTERNAL_ID = "kubernetes.io/aws-external-id";
13
+
14
+ export { ANNOTATION_KUBERNETES_API_SERVER, ANNOTATION_KUBERNETES_API_SERVER_CA, ANNOTATION_KUBERNETES_AUTH_PROVIDER, ANNOTATION_KUBERNETES_AWS_ASSUME_ROLE, ANNOTATION_KUBERNETES_AWS_CLUSTER_ID, ANNOTATION_KUBERNETES_AWS_EXTERNAL_ID, ANNOTATION_KUBERNETES_DASHBOARD_APP, ANNOTATION_KUBERNETES_DASHBOARD_PARAMETERS, ANNOTATION_KUBERNETES_DASHBOARD_URL, ANNOTATION_KUBERNETES_OIDC_TOKEN_PROVIDER, ANNOTATION_KUBERNETES_SKIP_METRICS_LOOKUP, ANNOTATION_KUBERNETES_SKIP_TLS_VERIFY };
15
+ //# sourceMappingURL=catalog-entity-constants.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-entity-constants.esm.js","sources":["../src/catalog-entity-constants.ts"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Annotation for specifying the API server of a Kubernetes cluster\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_API_SERVER = 'kubernetes.io/api-server';\n\n/**\n * Annotation for specifying the Certificate Authority of an API server for a Kubernetes cluster\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_API_SERVER_CA =\n 'kubernetes.io/api-server-certificate-authority';\n\n/**\n * Annotation for specifying the auth provider for a Kubernetes cluster\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_AUTH_PROVIDER =\n 'kubernetes.io/auth-provider';\n\n/**\n * Annotation for specifying the oidc provider used to get id tokens for a Kubernetes cluster\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_OIDC_TOKEN_PROVIDER =\n 'kubernetes.io/oidc-token-provider';\n\n/**\n * Annotation for specifying boolean value for skip metric lookup.\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_SKIP_METRICS_LOOKUP =\n 'kubernetes.io/skip-metrics-lookup';\n\n/**\n * Annotation for specifying boolean value for skip tls verify.\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_SKIP_TLS_VERIFY =\n 'kubernetes.io/skip-tls-verify';\n\n/**\n * Annotation for specifying the dashboard url for a Kubernetes cluster.\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_DASHBOARD_URL =\n 'kubernetes.io/dashboard-url';\n\n/**\n * Annotation for specifying the dashboard app for a Kubernetes cluster.\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_DASHBOARD_APP =\n 'kubernetes.io/dashboard-app';\n\n/**\n * Annotation for specifying the dashboard app parameters for a Kubernetes cluster.\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_DASHBOARD_PARAMETERS =\n 'kubernetes.io/dashboard-parameters';\n\n/**\n * Annotation for specifying the assume role use to authenticate with AWS.\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_AWS_ASSUME_ROLE =\n 'kubernetes.io/aws-assume-role';\n\n/**\n * Annotation for specifying the AWS ID of a cluster when signing STS tokens\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_AWS_CLUSTER_ID =\n 'kubernetes.io/x-k8s-aws-id';\n\n/**\n * Annotation for specifying an external id when communicating with AWS\n *\n * @public\n */\nexport const ANNOTATION_KUBERNETES_AWS_EXTERNAL_ID =\n 'kubernetes.io/aws-external-id';\n"],"names":[],"mappings":"AAqBO,MAAM,gCAAmC,GAAA,2BAAA;AAOzC,MAAM,mCACX,GAAA,iDAAA;AAOK,MAAM,mCACX,GAAA,8BAAA;AAOK,MAAM,yCACX,GAAA,oCAAA;AAOK,MAAM,yCACX,GAAA,oCAAA;AAOK,MAAM,qCACX,GAAA,gCAAA;AAOK,MAAM,mCACX,GAAA,8BAAA;AAOK,MAAM,mCACX,GAAA,8BAAA;AAOK,MAAM,0CACX,GAAA,qCAAA;AAOK,MAAM,qCACX,GAAA,gCAAA;AAOK,MAAM,oCACX,GAAA,6BAAA;AAOK,MAAM,qCACX,GAAA;;;;"}
@@ -0,0 +1,8 @@
1
+ const detectErrorsInObjects = (objects, errorMappers) => {
2
+ return objects.flatMap((o) => {
3
+ return errorMappers.flatMap((em) => em.detectErrors(o));
4
+ });
5
+ };
6
+
7
+ export { detectErrorsInObjects };
8
+ //# sourceMappingURL=common.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.esm.js","sources":["../../src/error-detection/common.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DetectedError, ErrorMapper } from './types';\n\n// Run through the each error mapper for each object\n// returning a deduplicated (mostly) result\nexport const detectErrorsInObjects = <T>(\n objects: T[],\n errorMappers: ErrorMapper<T>[],\n): DetectedError[] => {\n return objects.flatMap(o => {\n return errorMappers.flatMap(em => em.detectErrors(o));\n });\n};\n"],"names":[],"mappings":"AAoBa,MAAA,qBAAA,GAAwB,CACnC,OAAA,EACA,YACoB,KAAA;AACpB,EAAO,OAAA,OAAA,CAAQ,QAAQ,CAAK,CAAA,KAAA;AAC1B,IAAA,OAAO,aAAa,OAAQ,CAAA,CAAA,EAAA,KAAM,EAAG,CAAA,YAAA,CAAa,CAAC,CAAC,CAAA,CAAA;AAAA,GACrD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,28 @@
1
+ import { detectErrorsInObjects } from './common.esm.js';
2
+
3
+ const deploymentErrorMappers = [
4
+ {
5
+ detectErrors: (deployment) => {
6
+ var _a, _b;
7
+ return ((_b = (_a = deployment.status) == null ? void 0 : _a.conditions) != null ? _b : []).filter((c) => c.status === "False").filter((c) => c.message !== void 0).map((c) => {
8
+ var _a2, _b2, _c, _d, _e;
9
+ return {
10
+ type: "condition-message-present",
11
+ message: (_a2 = c.message) != null ? _a2 : "",
12
+ severity: 6,
13
+ sourceRef: {
14
+ name: (_c = (_b2 = deployment.metadata) == null ? void 0 : _b2.name) != null ? _c : "unknown hpa",
15
+ namespace: (_e = (_d = deployment.metadata) == null ? void 0 : _d.namespace) != null ? _e : "unknown namespace",
16
+ kind: "Deployment",
17
+ apiGroup: "apps/v1"
18
+ },
19
+ occurrenceCount: 1
20
+ };
21
+ });
22
+ }
23
+ }
24
+ ];
25
+ const detectErrorsInDeployments = (deployments) => detectErrorsInObjects(deployments, deploymentErrorMappers);
26
+
27
+ export { detectErrorsInDeployments };
28
+ //# sourceMappingURL=deployments.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployments.esm.js","sources":["../../src/error-detection/deployments.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DetectedError, ErrorMapper } from './types';\nimport { Deployment } from 'kubernetes-models/apps/v1';\nimport { detectErrorsInObjects } from './common';\n\nconst deploymentErrorMappers: ErrorMapper<Deployment>[] = [\n {\n detectErrors: deployment => {\n return (deployment.status?.conditions ?? [])\n .filter(c => c.status === 'False')\n .filter(c => c.message !== undefined)\n .map(c => ({\n type: 'condition-message-present',\n message: c.message ?? '',\n severity: 6,\n sourceRef: {\n name: deployment.metadata?.name ?? 'unknown hpa',\n namespace: deployment.metadata?.namespace ?? 'unknown namespace',\n kind: 'Deployment',\n apiGroup: 'apps/v1',\n },\n occurrenceCount: 1,\n }));\n },\n },\n];\n\nexport const detectErrorsInDeployments = (\n deployments: Deployment[],\n): DetectedError[] =>\n detectErrorsInObjects(deployments, deploymentErrorMappers);\n"],"names":["_a","_b"],"mappings":";;AAoBA,MAAM,sBAAoD,GAAA;AAAA,EACxD;AAAA,IACE,cAAc,CAAc,UAAA,KAAA;AAtBhC,MAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAuBM,MAAQ,OAAA,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,UAAA,CAAW,WAAX,IAAmB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,UAAA,KAAnB,YAAiC,EAAC,EACvC,OAAO,CAAK,CAAA,KAAA,CAAA,CAAE,WAAW,OAAO,CAAA,CAChC,OAAO,CAAK,CAAA,KAAA,CAAA,CAAE,YAAY,KAAS,CAAA,CAAA,CACnC,IAAI,CAAE,CAAA,KAAA;AA1Bf,QAAA,IAAAA,KAAAC,GAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA0BmB,QAAA,OAAA;AAAA,UACT,IAAM,EAAA,2BAAA;AAAA,UACN,OAASD,EAAAA,CAAAA,GAAAA,GAAA,CAAE,CAAA,OAAA,KAAF,OAAAA,GAAa,GAAA,EAAA;AAAA,UACtB,QAAU,EAAA,CAAA;AAAA,UACV,SAAW,EAAA;AAAA,YACT,IAAA,EAAA,CAAM,MAAAC,GAAA,GAAA,UAAA,CAAW,aAAX,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,GAAAA,CAAqB,SAArB,IAA6B,GAAA,EAAA,GAAA,aAAA;AAAA,YACnC,SAAW,EAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,UAAA,CAAW,QAAX,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAqB,cAArB,IAAkC,GAAA,EAAA,GAAA,mBAAA;AAAA,YAC7C,IAAM,EAAA,YAAA;AAAA,YACN,QAAU,EAAA,SAAA;AAAA,WACZ;AAAA,UACA,eAAiB,EAAA,CAAA;AAAA,SACnB,CAAA;AAAA,OAAE,CAAA,CAAA;AAAA,KACN;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,yBAA4B,GAAA,CACvC,WAEA,KAAA,qBAAA,CAAsB,aAAa,sBAAsB;;;;"}
@@ -0,0 +1,28 @@
1
+ import { groupResponses } from '../util/response.esm.js';
2
+ import { detectErrorsInPods } from './pods.esm.js';
3
+ import { detectErrorsInDeployments } from './deployments.esm.js';
4
+ import { detectErrorsInHpa } from './hpas.esm.js';
5
+
6
+ const detectErrors = (objects) => {
7
+ const errors = /* @__PURE__ */ new Map();
8
+ for (const clusterResponse of objects.items) {
9
+ let clusterErrors = [];
10
+ const groupedResponses = groupResponses(clusterResponse.resources);
11
+ clusterErrors = clusterErrors.concat(
12
+ detectErrorsInPods(groupedResponses.pods)
13
+ );
14
+ clusterErrors = clusterErrors.concat(
15
+ detectErrorsInDeployments(groupedResponses.deployments)
16
+ );
17
+ clusterErrors = clusterErrors.concat(
18
+ detectErrorsInHpa(
19
+ groupedResponses.horizontalPodAutoscalers
20
+ )
21
+ );
22
+ errors.set(clusterResponse.cluster.name, clusterErrors);
23
+ }
24
+ return errors;
25
+ };
26
+
27
+ export { detectErrors };
28
+ //# sourceMappingURL=error-detection.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-detection.esm.js","sources":["../../src/error-detection/error-detection.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DetectedError, DetectedErrorsByCluster } from './types';\nimport { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';\nimport { groupResponses } from '../util';\nimport { detectErrorsInPods } from './pods';\nimport { detectErrorsInDeployments } from './deployments';\nimport { detectErrorsInHpa } from './hpas';\nimport { Deployment } from 'kubernetes-models/apps/v1';\nimport { HorizontalPodAutoscaler } from 'kubernetes-models/autoscaling/v1';\nimport { Pod } from 'kubernetes-models/v1';\n\n/**\n * For each cluster try to find errors in each of the object types provided\n * returning a map of cluster names to errors in that cluster\n *\n * @public\n */\nexport const detectErrors = (\n objects: ObjectsByEntityResponse,\n): DetectedErrorsByCluster => {\n const errors: DetectedErrorsByCluster = new Map<string, DetectedError[]>();\n\n for (const clusterResponse of objects.items) {\n let clusterErrors: DetectedError[] = [];\n\n const groupedResponses = groupResponses(clusterResponse.resources);\n\n clusterErrors = clusterErrors.concat(\n detectErrorsInPods(groupedResponses.pods as Pod[]),\n );\n\n clusterErrors = clusterErrors.concat(\n detectErrorsInDeployments(groupedResponses.deployments as Deployment[]),\n );\n\n clusterErrors = clusterErrors.concat(\n detectErrorsInHpa(\n groupedResponses.horizontalPodAutoscalers as HorizontalPodAutoscaler[],\n ),\n );\n\n errors.set(clusterResponse.cluster.name, clusterErrors);\n }\n\n return errors;\n};\n"],"names":[],"mappings":";;;;;AAgCa,MAAA,YAAA,GAAe,CAC1B,OAC4B,KAAA;AAC5B,EAAM,MAAA,MAAA,uBAAsC,GAA6B,EAAA,CAAA;AAEzE,EAAW,KAAA,MAAA,eAAA,IAAmB,QAAQ,KAAO,EAAA;AAC3C,IAAA,IAAI,gBAAiC,EAAC,CAAA;AAEtC,IAAM,MAAA,gBAAA,GAAmB,cAAe,CAAA,eAAA,CAAgB,SAAS,CAAA,CAAA;AAEjE,IAAA,aAAA,GAAgB,aAAc,CAAA,MAAA;AAAA,MAC5B,kBAAA,CAAmB,iBAAiB,IAAa,CAAA;AAAA,KACnD,CAAA;AAEA,IAAA,aAAA,GAAgB,aAAc,CAAA,MAAA;AAAA,MAC5B,yBAAA,CAA0B,iBAAiB,WAA2B,CAAA;AAAA,KACxE,CAAA;AAEA,IAAA,aAAA,GAAgB,aAAc,CAAA,MAAA;AAAA,MAC5B,iBAAA;AAAA,QACE,gBAAiB,CAAA,wBAAA;AAAA,OACnB;AAAA,KACF,CAAA;AAEA,IAAA,MAAA,CAAO,GAAI,CAAA,eAAA,CAAgB,OAAQ,CAAA,IAAA,EAAM,aAAa,CAAA,CAAA;AAAA,GACxD;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -0,0 +1,30 @@
1
+ import { detectErrorsInObjects } from './common.esm.js';
2
+
3
+ const hpaErrorMappers = [
4
+ {
5
+ detectErrors: (hpa) => {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7
+ if (((_b = (_a = hpa.spec) == null ? void 0 : _a.maxReplicas) != null ? _b : -1) === ((_c = hpa.status) == null ? void 0 : _c.currentReplicas)) {
8
+ return [
9
+ {
10
+ type: "hpa-max-current-replicas",
11
+ message: `Current number of replicas (${(_d = hpa.status) == null ? void 0 : _d.currentReplicas}) is equal to the configured max number of replicas (${(_f = (_e = hpa.spec) == null ? void 0 : _e.maxReplicas) != null ? _f : -1})`,
12
+ severity: 8,
13
+ sourceRef: {
14
+ name: (_h = (_g = hpa.metadata) == null ? void 0 : _g.name) != null ? _h : "unknown hpa",
15
+ namespace: (_j = (_i = hpa.metadata) == null ? void 0 : _i.namespace) != null ? _j : "unknown namespace",
16
+ kind: "HorizontalPodAutoscaler",
17
+ apiGroup: "autoscaling/v1"
18
+ },
19
+ occurrenceCount: 1
20
+ }
21
+ ];
22
+ }
23
+ return [];
24
+ }
25
+ }
26
+ ];
27
+ const detectErrorsInHpa = (hpas) => detectErrorsInObjects(hpas, hpaErrorMappers);
28
+
29
+ export { detectErrorsInHpa };
30
+ //# sourceMappingURL=hpas.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hpas.esm.js","sources":["../../src/error-detection/hpas.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { HorizontalPodAutoscaler } from 'kubernetes-models/autoscaling/v1';\nimport { DetectedError, ErrorMapper } from './types';\nimport { detectErrorsInObjects } from './common';\n\nconst hpaErrorMappers: ErrorMapper<HorizontalPodAutoscaler>[] = [\n {\n detectErrors: hpa => {\n if ((hpa.spec?.maxReplicas ?? -1) === hpa.status?.currentReplicas) {\n return [\n {\n type: 'hpa-max-current-replicas',\n message: `Current number of replicas (${\n hpa.status?.currentReplicas\n }) is equal to the configured max number of replicas (${\n hpa.spec?.maxReplicas ?? -1\n })`,\n severity: 8,\n sourceRef: {\n name: hpa.metadata?.name ?? 'unknown hpa',\n namespace: hpa.metadata?.namespace ?? 'unknown namespace',\n kind: 'HorizontalPodAutoscaler',\n apiGroup: 'autoscaling/v1',\n },\n occurrenceCount: 1,\n },\n ];\n }\n return [];\n },\n },\n];\n\nexport const detectErrorsInHpa = (\n hpas: HorizontalPodAutoscaler[],\n): DetectedError[] => detectErrorsInObjects(hpas, hpaErrorMappers);\n"],"names":[],"mappings":";;AAoBA,MAAM,eAA0D,GAAA;AAAA,EAC9D;AAAA,IACE,cAAc,CAAO,GAAA,KAAA;AAtBzB,MAAA,IAAA,EAAA,EAAA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AA,CAAA;AAAA,WACnB;AAAA,SACF,CAAA;AAAA,OACF;AACA,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,iBAAoB,GAAA,CAC/B,IACoB,KAAA,qBAAA,CAAsB,MAAM,eAAe;;;;"}
@@ -0,0 +1,225 @@
1
+ import { detectErrorsInObjects } from './common.esm.js';
2
+ import lodash from 'lodash';
3
+ import { DateTime } from 'luxon';
4
+
5
+ function isPodReadinessProbeUnready({
6
+ container,
7
+ containerStatus
8
+ }) {
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10
+ if (containerStatus.ready || ((_b = (_a = containerStatus.state) == null ? void 0 : _a.running) == null ? void 0 : _b.startedAt) === void 0 || !container.readinessProbe) {
11
+ return false;
12
+ }
13
+ const startDateTime = DateTime.fromISO(
14
+ (_d = (_c = containerStatus.state) == null ? void 0 : _c.running) == null ? void 0 : _d.startedAt
15
+ ).plus({
16
+ seconds: (_f = (_e = container.readinessProbe) == null ? void 0 : _e.initialDelaySeconds) != null ? _f : 0
17
+ }).plus({
18
+ seconds: ((_h = (_g = container.readinessProbe) == null ? void 0 : _g.periodSeconds) != null ? _h : 0) * ((_j = (_i = container.readinessProbe) == null ? void 0 : _i.failureThreshold) != null ? _j : 0)
19
+ });
20
+ return startDateTime < DateTime.now();
21
+ }
22
+ const podToContainerSpecsAndStatuses = (pod) => {
23
+ var _a, _b, _c, _d;
24
+ const specs = lodash.groupBy((_b = (_a = pod.spec) == null ? void 0 : _a.containers) != null ? _b : [], (value) => value.name);
25
+ const result = [];
26
+ for (const cs of (_d = (_c = pod.status) == null ? void 0 : _c.containerStatuses) != null ? _d : []) {
27
+ const spec = specs[cs.name];
28
+ if (spec.length > 0) {
29
+ result.push({
30
+ container: spec[0],
31
+ containerStatus: cs
32
+ });
33
+ }
34
+ }
35
+ return result;
36
+ };
37
+ const readinessProbeProposedFixes = (pod) => {
38
+ var _a, _b, _c, _d;
39
+ const firstUnreadyContainerStatus = (_b = (_a = pod.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.find(
40
+ (cs) => {
41
+ return cs.ready === false;
42
+ }
43
+ );
44
+ return {
45
+ errorType: "ReadinessProbeFailed",
46
+ rootCauseExplanation: `The container ${firstUnreadyContainerStatus == null ? void 0 : firstUnreadyContainerStatus.name} failed to start properly, but is not crashing`,
47
+ actions: [
48
+ "Ensure that the container starts correctly locally",
49
+ "Check the container's logs looking for error during startup"
50
+ ],
51
+ type: "events",
52
+ podName: (_d = (_c = pod.metadata) == null ? void 0 : _c.name) != null ? _d : ""
53
+ };
54
+ };
55
+ const restartingPodProposedFixes = (pod) => {
56
+ var _a, _b, _c;
57
+ const lastTerminatedCs = ((_b = (_a = pod.status) == null ? void 0 : _a.containerStatuses) != null ? _b : []).find(
58
+ (cs) => {
59
+ var _a2;
60
+ return ((_a2 = cs.lastState) == null ? void 0 : _a2.terminated) !== void 0;
61
+ }
62
+ );
63
+ const lastTerminated = (_c = lastTerminatedCs == null ? void 0 : lastTerminatedCs.lastState) == null ? void 0 : _c.terminated;
64
+ if (!lastTerminated) {
65
+ return void 0;
66
+ }
67
+ switch (lastTerminated == null ? void 0 : lastTerminated.reason) {
68
+ case "Unknown":
69
+ return {
70
+ // TODO check this one, it's more likely a cluster issue
71
+ errorType: "Unknown",
72
+ rootCauseExplanation: `This container has exited with a non-zero exit code (${lastTerminated.exitCode})`,
73
+ actions: ["Check the crash logs for stacktraces"],
74
+ container: lastTerminatedCs.name,
75
+ type: "logs"
76
+ };
77
+ case "Error":
78
+ return {
79
+ errorType: "Error",
80
+ rootCauseExplanation: `This container has exited with a non-zero exit code (${lastTerminated.exitCode})`,
81
+ actions: ["Check the crash logs for stacktraces"],
82
+ container: lastTerminatedCs.name,
83
+ type: "logs"
84
+ };
85
+ case "OOMKilled":
86
+ return {
87
+ errorType: "OOMKilled",
88
+ rootCauseExplanation: `The container "${lastTerminatedCs.name}" has crashed because it has tried to use more memory that it has been allocated`,
89
+ actions: [
90
+ `Increase the amount of memory assigned to the container`,
91
+ "Ensure the application is memory bounded and is not trying to consume too much memory"
92
+ ],
93
+ docsLink: "https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/#exceed-a-container-s-memory-limit",
94
+ type: "docs"
95
+ };
96
+ default:
97
+ return void 0;
98
+ }
99
+ };
100
+ const waitingProposedFix = (pod) => {
101
+ var _a, _b, _c, _d, _e;
102
+ const waitingCs = ((_b = (_a = pod.status) == null ? void 0 : _a.containerStatuses) != null ? _b : []).find(
103
+ (cs) => {
104
+ var _a2;
105
+ return ((_a2 = cs.state) == null ? void 0 : _a2.waiting) !== void 0;
106
+ }
107
+ );
108
+ const waiting = ((_d = (_c = pod.status) == null ? void 0 : _c.containerStatuses) != null ? _d : []).map((cs) => {
109
+ var _a2;
110
+ return (_a2 = cs.state) == null ? void 0 : _a2.waiting;
111
+ }).find((w) => (w == null ? void 0 : w.reason) !== void 0);
112
+ switch (waiting == null ? void 0 : waiting.reason) {
113
+ case "InvalidImageName":
114
+ return {
115
+ errorType: "InvalidImageName",
116
+ rootCauseExplanation: "The image in the pod is invalid",
117
+ actions: ["Ensure the image name is correct and valid image name"],
118
+ type: "docs",
119
+ docsLink: "https://docs.docker.com/engine/reference/commandline/tag/#extended-description"
120
+ };
121
+ case "ImagePullBackOff":
122
+ return {
123
+ errorType: "ImagePullBackOff",
124
+ rootCauseExplanation: "The image either could not be found or Kubernetes does not have permission to pull it",
125
+ actions: [
126
+ "Ensure the image name is correct",
127
+ "Ensure Kubernetes has permission to pull this image"
128
+ ],
129
+ type: "docs",
130
+ docsLink: "https://kubernetes.io/docs/concepts/containers/images/#imagepullbackoff"
131
+ };
132
+ case "CrashLoopBackOff":
133
+ return {
134
+ errorType: "CrashLoopBackOff",
135
+ rootCauseExplanation: `The container ${waitingCs == null ? void 0 : waitingCs.name} has crashed many times, it will be exponentially restarted until it stops crashing`,
136
+ actions: ["Check the crash logs for stacktraces"],
137
+ type: "logs",
138
+ container: (_e = waitingCs == null ? void 0 : waitingCs.name) != null ? _e : "unknown"
139
+ };
140
+ case "CreateContainerConfigError":
141
+ return {
142
+ errorType: "CreateContainerConfigError",
143
+ rootCauseExplanation: "There is missing or mismatching configuration required to start the container",
144
+ actions: [
145
+ "Ensure ConfigMaps references in the Deployment manifest are correct and the keys exist",
146
+ "Ensure Secrets references in the Deployment manifest are correct and the keys exist"
147
+ ],
148
+ type: "docs",
149
+ docsLink: "https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/"
150
+ };
151
+ default:
152
+ return void 0;
153
+ }
154
+ };
155
+ const podErrorMappers = [
156
+ {
157
+ detectErrors: (pod) => {
158
+ return podToContainerSpecsAndStatuses(pod).filter(isPodReadinessProbeUnready).map((cs) => {
159
+ var _a, _b, _c, _d;
160
+ return {
161
+ type: "readiness-probe-taking-too-long",
162
+ message: `The container ${cs.container.name} failed to start properly, but is not crashing`,
163
+ severity: 4,
164
+ proposedFix: readinessProbeProposedFixes(pod),
165
+ sourceRef: {
166
+ name: (_b = (_a = pod.metadata) == null ? void 0 : _a.name) != null ? _b : "unknown pod",
167
+ namespace: (_d = (_c = pod.metadata) == null ? void 0 : _c.namespace) != null ? _d : "unknown namespace",
168
+ kind: "Pod",
169
+ apiGroup: "v1"
170
+ },
171
+ occurrenceCount: 1
172
+ };
173
+ });
174
+ }
175
+ },
176
+ {
177
+ detectErrors: (pod) => {
178
+ var _a, _b;
179
+ return ((_b = (_a = pod.status) == null ? void 0 : _a.containerStatuses) != null ? _b : []).filter((cs) => {
180
+ var _a2, _b2;
181
+ return ((_b2 = (_a2 = cs.state) == null ? void 0 : _a2.waiting) == null ? void 0 : _b2.message) !== void 0;
182
+ }).map((cs) => {
183
+ var _a2, _b2, _c, _d, _e, _f, _g;
184
+ return {
185
+ type: "container-waiting",
186
+ message: (_c = (_b2 = (_a2 = cs.state) == null ? void 0 : _a2.waiting) == null ? void 0 : _b2.message) != null ? _c : "container waiting",
187
+ severity: 4,
188
+ proposedFix: waitingProposedFix(pod),
189
+ sourceRef: {
190
+ name: (_e = (_d = pod.metadata) == null ? void 0 : _d.name) != null ? _e : "unknown pod",
191
+ namespace: (_g = (_f = pod.metadata) == null ? void 0 : _f.namespace) != null ? _g : "unknown namespace",
192
+ kind: "Pod",
193
+ apiGroup: "v1"
194
+ },
195
+ occurrenceCount: 1
196
+ };
197
+ });
198
+ }
199
+ },
200
+ {
201
+ detectErrors: (pod) => {
202
+ var _a, _b;
203
+ return ((_b = (_a = pod.status) == null ? void 0 : _a.containerStatuses) != null ? _b : []).filter((cs) => cs.restartCount > 0).map((cs) => {
204
+ var _a2, _b2, _c, _d;
205
+ return {
206
+ type: "containers-restarting",
207
+ message: `container=${cs.name} restarted ${cs.restartCount} times`,
208
+ severity: 4,
209
+ proposedFix: restartingPodProposedFixes(pod),
210
+ sourceRef: {
211
+ name: (_b2 = (_a2 = pod.metadata) == null ? void 0 : _a2.name) != null ? _b2 : "unknown pod",
212
+ namespace: (_d = (_c = pod.metadata) == null ? void 0 : _c.namespace) != null ? _d : "unknown namespace",
213
+ kind: "Pod",
214
+ apiGroup: "v1"
215
+ },
216
+ occurrenceCount: cs.restartCount
217
+ };
218
+ });
219
+ }
220
+ }
221
+ ];
222
+ const detectErrorsInPods = (pods) => detectErrorsInObjects(pods, podErrorMappers);
223
+
224
+ export { detectErrorsInPods };
225
+ //# sourceMappingURL=pods.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pods.esm.js","sources":["../../src/error-detection/pods.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Pod, IContainerStatus, IContainer } from 'kubernetes-models/v1';\nimport { DetectedError, ErrorMapper, ProposedFix } from './types';\nimport { detectErrorsInObjects } from './common';\nimport lodash from 'lodash';\nimport { DateTime } from 'luxon';\n\nfunction isPodReadinessProbeUnready({\n container,\n containerStatus,\n}: ContainerSpecAndStatus): boolean {\n if (\n containerStatus.ready ||\n containerStatus.state?.running?.startedAt === undefined ||\n !container.readinessProbe\n ) {\n return false;\n }\n const startDateTime = DateTime.fromISO(\n containerStatus.state?.running?.startedAt,\n )\n // Add initial delay\n .plus({\n seconds: container.readinessProbe?.initialDelaySeconds ?? 0,\n })\n // Add failure threshold\n .plus({\n seconds:\n (container.readinessProbe?.periodSeconds ?? 0) *\n (container.readinessProbe?.failureThreshold ?? 0),\n });\n return startDateTime < DateTime.now();\n}\n\ninterface ContainerSpecAndStatus {\n container: IContainer;\n containerStatus: IContainerStatus;\n}\n\nconst podToContainerSpecsAndStatuses = (pod: Pod): ContainerSpecAndStatus[] => {\n const specs = lodash.groupBy(pod.spec?.containers ?? [], value => value.name);\n\n const result: ContainerSpecAndStatus[] = [];\n\n for (const cs of pod.status?.containerStatuses ?? []) {\n const spec = specs[cs.name];\n if (spec.length > 0) {\n result.push({\n container: spec[0],\n containerStatus: cs,\n });\n }\n }\n\n return result;\n};\n\nconst readinessProbeProposedFixes = (pod: Pod): ProposedFix | undefined => {\n const firstUnreadyContainerStatus = pod.status?.containerStatuses?.find(\n cs => {\n return cs.ready === false;\n },\n );\n\n return {\n errorType: 'ReadinessProbeFailed',\n rootCauseExplanation: `The container ${firstUnreadyContainerStatus?.name} failed to start properly, but is not crashing`,\n actions: [\n 'Ensure that the container starts correctly locally',\n \"Check the container's logs looking for error during startup\",\n ],\n type: 'events',\n podName: pod.metadata?.name ?? '',\n };\n};\n\nconst restartingPodProposedFixes = (pod: Pod): ProposedFix | undefined => {\n const lastTerminatedCs = (pod.status?.containerStatuses ?? []).find(\n cs => cs.lastState?.terminated !== undefined,\n );\n\n const lastTerminated = lastTerminatedCs?.lastState?.terminated;\n\n if (!lastTerminated) {\n return undefined;\n }\n\n switch (lastTerminated?.reason) {\n case 'Unknown':\n return {\n // TODO check this one, it's more likely a cluster issue\n errorType: 'Unknown',\n rootCauseExplanation: `This container has exited with a non-zero exit code (${lastTerminated.exitCode})`,\n actions: ['Check the crash logs for stacktraces'],\n container: lastTerminatedCs.name,\n type: 'logs',\n };\n case 'Error':\n return {\n errorType: 'Error',\n rootCauseExplanation: `This container has exited with a non-zero exit code (${lastTerminated.exitCode})`,\n actions: ['Check the crash logs for stacktraces'],\n container: lastTerminatedCs.name,\n type: 'logs',\n };\n case 'OOMKilled':\n return {\n errorType: 'OOMKilled',\n rootCauseExplanation: `The container \"${lastTerminatedCs.name}\" has crashed because it has tried to use more memory that it has been allocated`,\n actions: [\n `Increase the amount of memory assigned to the container`,\n 'Ensure the application is memory bounded and is not trying to consume too much memory',\n ],\n docsLink:\n 'https://kubernetes.io/docs/tasks/configure-pod-container/assign-memory-resource/#exceed-a-container-s-memory-limit',\n type: 'docs',\n };\n default:\n return undefined;\n }\n};\n\nconst waitingProposedFix = (pod: Pod): ProposedFix | undefined => {\n const waitingCs = (pod.status?.containerStatuses ?? []).find(\n cs => cs.state?.waiting !== undefined,\n );\n\n const waiting = (pod.status?.containerStatuses ?? [])\n .map(cs => cs.state?.waiting)\n .find(w => w?.reason !== undefined);\n\n switch (waiting?.reason) {\n case 'InvalidImageName':\n return {\n errorType: 'InvalidImageName',\n rootCauseExplanation: 'The image in the pod is invalid',\n actions: ['Ensure the image name is correct and valid image name'],\n type: 'docs',\n docsLink:\n 'https://docs.docker.com/engine/reference/commandline/tag/#extended-description',\n };\n case 'ImagePullBackOff':\n return {\n errorType: 'ImagePullBackOff',\n rootCauseExplanation:\n 'The image either could not be found or Kubernetes does not have permission to pull it',\n actions: [\n 'Ensure the image name is correct',\n 'Ensure Kubernetes has permission to pull this image',\n ],\n type: 'docs',\n docsLink:\n 'https://kubernetes.io/docs/concepts/containers/images/#imagepullbackoff',\n };\n case 'CrashLoopBackOff':\n return {\n errorType: 'CrashLoopBackOff',\n rootCauseExplanation: `The container ${waitingCs?.name} has crashed many times, it will be exponentially restarted until it stops crashing`,\n actions: ['Check the crash logs for stacktraces'],\n type: 'logs',\n container: waitingCs?.name ?? 'unknown',\n };\n case 'CreateContainerConfigError':\n return {\n errorType: 'CreateContainerConfigError',\n rootCauseExplanation:\n 'There is missing or mismatching configuration required to start the container',\n actions: [\n 'Ensure ConfigMaps references in the Deployment manifest are correct and the keys exist',\n 'Ensure Secrets references in the Deployment manifest are correct and the keys exist',\n ],\n type: 'docs',\n docsLink:\n 'https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/',\n };\n default:\n return undefined;\n }\n};\n\nconst podErrorMappers: ErrorMapper<Pod>[] = [\n {\n detectErrors: pod => {\n return podToContainerSpecsAndStatuses(pod)\n .filter(isPodReadinessProbeUnready)\n .map(cs => ({\n type: 'readiness-probe-taking-too-long',\n message: `The container ${cs.container.name} failed to start properly, but is not crashing`,\n severity: 4,\n proposedFix: readinessProbeProposedFixes(pod),\n sourceRef: {\n name: pod.metadata?.name ?? 'unknown pod',\n namespace: pod.metadata?.namespace ?? 'unknown namespace',\n kind: 'Pod',\n apiGroup: 'v1',\n },\n occurrenceCount: 1,\n }));\n },\n },\n {\n detectErrors: pod => {\n return (pod.status?.containerStatuses ?? [])\n .filter(cs => cs.state?.waiting?.message !== undefined)\n .map(cs => ({\n type: 'container-waiting',\n message: cs.state?.waiting?.message ?? 'container waiting',\n severity: 4,\n proposedFix: waitingProposedFix(pod),\n sourceRef: {\n name: pod.metadata?.name ?? 'unknown pod',\n namespace: pod.metadata?.namespace ?? 'unknown namespace',\n kind: 'Pod',\n apiGroup: 'v1',\n },\n occurrenceCount: 1,\n }));\n },\n },\n {\n detectErrors: pod => {\n return (pod.status?.containerStatuses ?? [])\n .filter(cs => cs.restartCount > 0)\n .map(cs => ({\n type: 'containers-restarting',\n message: `container=${cs.name} restarted ${cs.restartCount} times`,\n severity: 4,\n proposedFix: restartingPodProposedFixes(pod),\n sourceRef: {\n name: pod.metadata?.name ?? 'unknown pod',\n namespace: pod.metadata?.namespace ?? 'unknown namespace',\n kind: 'Pod',\n apiGroup: 'v1',\n },\n occurrenceCount: cs.restartCount,\n }));\n },\n },\n];\n\nexport const detectErrorsInPods = (pods: Pod[]): DetectedError[] =>\n detectErrorsInObjects(pods, podErrorMappers);\n"],"names":["_a","_b"],"mappings":";;;;AAsBA,SAAS,0BAA2B,CAAA;AAAA,EAClC,SAAA;AAAA,EACA,eAAA;AACF,CAAoC,EAAA;AAzBpC,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AA0BE,EACE,IAAA,eAAA,CAAgB,KAChB,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,eAAA,CAAgB,KAAhB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAuB,OAAvB,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAgC,SAAc,MAAA,KAAA,CAAA,IAC9C,CAAC,SAAA,CAAU,cACX,EAAA;AACA,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AACA,EAAA,MAAM,gBAAgB,QAAS,CAAA,OAAA;AAAA,IAAA,CAC7B,EAAgB,GAAA,CAAA,EAAA,GAAA,eAAA,CAAA,KAAA,KAAhB,IAAuB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAA,KAAvB,IAAgC,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA;AAAA,IAG/B,IAAK,CAAA;AAAA,IACJ,OAAS,EAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,SAAA,CAAU,cAAV,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAA0B,wBAA1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A,WACZ;AAAA,UACA,iBAAiB,EAAG,CAAA,YAAA;AAAA,SACtB,CAAA;AAAA,OAAE,CAAA,CAAA;AAAA,KACN;AAAA,GACF;AACF,CAAA,CAAA;AAEO,MAAM,kBAAqB,GAAA,CAAC,IACjC,KAAA,qBAAA,CAAsB,MAAM,eAAe;;;;"}
package/dist/index.cjs.js CHANGED
@@ -1,14 +1,12 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var pluginPermissionCommon = require('@backstage/plugin-permission-common');
6
4
  var lodash = require('lodash');
7
5
  var luxon = require('luxon');
8
6
 
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
8
 
11
- var lodash__default = /*#__PURE__*/_interopDefaultLegacy(lodash);
9
+ var lodash__default = /*#__PURE__*/_interopDefaultCompat(lodash);
12
10
 
13
11
  const ANNOTATION_KUBERNETES_API_SERVER = "kubernetes.io/api-server";
14
12
  const ANNOTATION_KUBERNETES_API_SERVER_CA = "kubernetes.io/api-server-certificate-authority";
@@ -114,7 +112,7 @@ function isPodReadinessProbeUnready({
114
112
  }
115
113
  const podToContainerSpecsAndStatuses = (pod) => {
116
114
  var _a, _b, _c, _d;
117
- const specs = lodash__default["default"].groupBy((_b = (_a = pod.spec) == null ? void 0 : _a.containers) != null ? _b : [], (value) => value.name);
115
+ const specs = lodash__default.default.groupBy((_b = (_a = pod.spec) == null ? void 0 : _a.containers) != null ? _b : [], (value) => value.name);
118
116
  const result = [];
119
117
  for (const cs of (_d = (_c = pod.status) == null ? void 0 : _c.containerStatuses) != null ? _d : []) {
120
118
  const spec = specs[cs.name];