@backstage/plugin-kubernetes-common 0.9.14 → 0.9.15-next.0

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,11 @@
1
1
  # @backstage/plugin-kubernetes-common
2
2
 
3
+ ## 0.9.15-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ca14116: Moved `kubernetes-models` and `@kubernetes-models/apimachinery` to dev dependencies, since they are only used for types. Backends no longer install `kubernetes-models` through `@backstage/plugin-kubernetes-common`.
8
+
3
9
  ## 0.9.14
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"deployments.cjs.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":["detectErrorsInObjects"],"mappings":";;;;AAoBA,MAAM,sBAAA,GAAoD;AAAA,EACxD;AAAA,IACE,cAAc,CAAA,UAAA,KAAc;AAC1B,MAAA,OAAA,CAAQ,WAAW,MAAA,EAAQ,UAAA,IAAc,EAAC,EACvC,MAAA,CAAO,OAAK,CAAA,CAAE,MAAA,KAAW,OAAO,CAAA,CAChC,OAAO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,MAAS,CAAA,CACnC,IAAI,CAAA,CAAA,MAAM;AAAA,QACT,IAAA,EAAM,2BAAA;AAAA,QACN,OAAA,EAAS,EAAE,OAAA,IAAW,EAAA;AAAA,QACtB,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,UAAA,CAAW,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UACnC,SAAA,EAAW,UAAA,CAAW,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UAC7C,IAAA,EAAM,YAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,yBAAA,GAA4B,CACvC,WAAA,KAEAA,4BAAA,CAAsB,aAAa,sBAAsB;;"}
1
+ {"version":3,"file":"deployments.cjs.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 type { 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":["detectErrorsInObjects"],"mappings":";;;;AAoBA,MAAM,sBAAA,GAAoD;AAAA,EACxD;AAAA,IACE,cAAc,CAAA,UAAA,KAAc;AAC1B,MAAA,OAAA,CAAQ,WAAW,MAAA,EAAQ,UAAA,IAAc,EAAC,EACvC,MAAA,CAAO,OAAK,CAAA,CAAE,MAAA,KAAW,OAAO,CAAA,CAChC,OAAO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,MAAS,CAAA,CACnC,IAAI,CAAA,CAAA,MAAM;AAAA,QACT,IAAA,EAAM,2BAAA;AAAA,QACN,OAAA,EAAS,EAAE,OAAA,IAAW,EAAA;AAAA,QACtB,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,UAAA,CAAW,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UACnC,SAAA,EAAW,UAAA,CAAW,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UAC7C,IAAA,EAAM,YAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,yBAAA,GAA4B,CACvC,WAAA,KAEAA,4BAAA,CAAsB,aAAa,sBAAsB;;"}
@@ -1 +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":[],"mappings":";;AAoBA,MAAM,sBAAA,GAAoD;AAAA,EACxD;AAAA,IACE,cAAc,CAAA,UAAA,KAAc;AAC1B,MAAA,OAAA,CAAQ,WAAW,MAAA,EAAQ,UAAA,IAAc,EAAC,EACvC,MAAA,CAAO,OAAK,CAAA,CAAE,MAAA,KAAW,OAAO,CAAA,CAChC,OAAO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,MAAS,CAAA,CACnC,IAAI,CAAA,CAAA,MAAM;AAAA,QACT,IAAA,EAAM,2BAAA;AAAA,QACN,OAAA,EAAS,EAAE,OAAA,IAAW,EAAA;AAAA,QACtB,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,UAAA,CAAW,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UACnC,SAAA,EAAW,UAAA,CAAW,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UAC7C,IAAA,EAAM,YAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,yBAAA,GAA4B,CACvC,WAAA,KAEA,qBAAA,CAAsB,aAAa,sBAAsB;;"}
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 type { 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":[],"mappings":";;AAoBA,MAAM,sBAAA,GAAoD;AAAA,EACxD;AAAA,IACE,cAAc,CAAA,UAAA,KAAc;AAC1B,MAAA,OAAA,CAAQ,WAAW,MAAA,EAAQ,UAAA,IAAc,EAAC,EACvC,MAAA,CAAO,OAAK,CAAA,CAAE,MAAA,KAAW,OAAO,CAAA,CAChC,OAAO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,MAAS,CAAA,CACnC,IAAI,CAAA,CAAA,MAAM;AAAA,QACT,IAAA,EAAM,2BAAA;AAAA,QACN,OAAA,EAAS,EAAE,OAAA,IAAW,EAAA;AAAA,QACtB,QAAA,EAAU,CAAA;AAAA,QACV,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,UAAA,CAAW,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UACnC,SAAA,EAAW,UAAA,CAAW,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UAC7C,IAAA,EAAM,YAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,yBAAA,GAA4B,CACvC,WAAA,KAEA,qBAAA,CAAsB,aAAa,sBAAsB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"error-detection.cjs.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 type { 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/v2';\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":["groupResponses","detectErrorsInPods","detectErrorsInDeployments","detectErrorsInHpa"],"mappings":";;;;;;;AAgCO,MAAM,YAAA,GAAe,CAC1B,OAAA,KAC4B;AAC5B,EAAA,MAAM,MAAA,uBAAsC,GAAA,EAA6B;AAEzE,EAAA,KAAA,MAAW,eAAA,IAAmB,QAAQ,KAAA,EAAO;AAC3C,IAAA,IAAI,gBAAiC,EAAC;AAEtC,IAAA,MAAM,gBAAA,GAAmBA,uBAAA,CAAe,eAAA,CAAgB,SAAS,CAAA;AAEjE,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5BC,uBAAA,CAAmB,iBAAiB,IAAa;AAAA,KACnD;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5BC,qCAAA,CAA0B,iBAAiB,WAA2B;AAAA,KACxE;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5BC,sBAAA;AAAA,QACE,gBAAA,CAAiB;AAAA;AACnB,KACF;AAEA,IAAA,MAAA,CAAO,GAAA,CAAI,eAAA,CAAgB,OAAA,CAAQ,IAAA,EAAM,aAAa,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,MAAA;AACT;;"}
1
+ {"version":3,"file":"error-detection.cjs.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 type { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';\nimport { groupResponses } from '../util';\nimport { detectErrorsInPods } from './pods';\nimport { detectErrorsInDeployments } from './deployments';\nimport { detectErrorsInHpa } from './hpas';\nimport type { Deployment } from 'kubernetes-models/apps/v1';\nimport type { HorizontalPodAutoscaler } from 'kubernetes-models/autoscaling/v2';\nimport type { 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":["groupResponses","detectErrorsInPods","detectErrorsInDeployments","detectErrorsInHpa"],"mappings":";;;;;;;AAgCO,MAAM,YAAA,GAAe,CAC1B,OAAA,KAC4B;AAC5B,EAAA,MAAM,MAAA,uBAAsC,GAAA,EAA6B;AAEzE,EAAA,KAAA,MAAW,eAAA,IAAmB,QAAQ,KAAA,EAAO;AAC3C,IAAA,IAAI,gBAAiC,EAAC;AAEtC,IAAA,MAAM,gBAAA,GAAmBA,uBAAA,CAAe,eAAA,CAAgB,SAAS,CAAA;AAEjE,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5BC,uBAAA,CAAmB,iBAAiB,IAAa;AAAA,KACnD;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5BC,qCAAA,CAA0B,iBAAiB,WAA2B;AAAA,KACxE;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5BC,sBAAA;AAAA,QACE,gBAAA,CAAiB;AAAA;AACnB,KACF;AAEA,IAAA,MAAA,CAAO,GAAA,CAAI,eAAA,CAAgB,OAAA,CAAQ,IAAA,EAAM,aAAa,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,MAAA;AACT;;"}
@@ -1 +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 type { 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/v2';\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":";;;;;AAgCO,MAAM,YAAA,GAAe,CAC1B,OAAA,KAC4B;AAC5B,EAAA,MAAM,MAAA,uBAAsC,GAAA,EAA6B;AAEzE,EAAA,KAAA,MAAW,eAAA,IAAmB,QAAQ,KAAA,EAAO;AAC3C,IAAA,IAAI,gBAAiC,EAAC;AAEtC,IAAA,MAAM,gBAAA,GAAmB,cAAA,CAAe,eAAA,CAAgB,SAAS,CAAA;AAEjE,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5B,kBAAA,CAAmB,iBAAiB,IAAa;AAAA,KACnD;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5B,yBAAA,CAA0B,iBAAiB,WAA2B;AAAA,KACxE;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5B,iBAAA;AAAA,QACE,gBAAA,CAAiB;AAAA;AACnB,KACF;AAEA,IAAA,MAAA,CAAO,GAAA,CAAI,eAAA,CAAgB,OAAA,CAAQ,IAAA,EAAM,aAAa,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,MAAA;AACT;;"}
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 type { ObjectsByEntityResponse } from '@backstage/plugin-kubernetes-common';\nimport { groupResponses } from '../util';\nimport { detectErrorsInPods } from './pods';\nimport { detectErrorsInDeployments } from './deployments';\nimport { detectErrorsInHpa } from './hpas';\nimport type { Deployment } from 'kubernetes-models/apps/v1';\nimport type { HorizontalPodAutoscaler } from 'kubernetes-models/autoscaling/v2';\nimport type { 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":";;;;;AAgCO,MAAM,YAAA,GAAe,CAC1B,OAAA,KAC4B;AAC5B,EAAA,MAAM,MAAA,uBAAsC,GAAA,EAA6B;AAEzE,EAAA,KAAA,MAAW,eAAA,IAAmB,QAAQ,KAAA,EAAO;AAC3C,IAAA,IAAI,gBAAiC,EAAC;AAEtC,IAAA,MAAM,gBAAA,GAAmB,cAAA,CAAe,eAAA,CAAgB,SAAS,CAAA;AAEjE,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5B,kBAAA,CAAmB,iBAAiB,IAAa;AAAA,KACnD;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5B,yBAAA,CAA0B,iBAAiB,WAA2B;AAAA,KACxE;AAEA,IAAA,aAAA,GAAgB,aAAA,CAAc,MAAA;AAAA,MAC5B,iBAAA;AAAA,QACE,gBAAA,CAAiB;AAAA;AACnB,KACF;AAEA,IAAA,MAAA,CAAO,GAAA,CAAI,eAAA,CAAgB,OAAA,CAAQ,IAAA,EAAM,aAAa,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,MAAA;AACT;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hpas.cjs.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/v2';\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/v2',\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":["detectErrorsInObjects"],"mappings":";;;;AAoBA,MAAM,eAAA,GAA0D;AAAA,EAC9D;AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,IAAA,CAAK,IAAI,IAAA,EAAM,WAAA,IAAe,EAAA,MAAQ,GAAA,CAAI,QAAQ,eAAA,EAAiB;AACjE,QAAA,OAAO;AAAA,UACL;AAAA,YACE,IAAA,EAAM,0BAAA;AAAA,YACN,OAAA,EAAS,+BACP,GAAA,CAAI,MAAA,EAAQ,eACd,CAAA,qDAAA,EACE,GAAA,CAAI,IAAA,EAAM,WAAA,IAAe,EAC3B,CAAA,CAAA,CAAA;AAAA,YACA,QAAA,EAAU,CAAA;AAAA,YACV,SAAA,EAAW;AAAA,cACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,cAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,cACtC,IAAA,EAAM,yBAAA;AAAA,cACN,QAAA,EAAU;AAAA,aACZ;AAAA,YACA,eAAA,EAAiB;AAAA;AACnB,SACF;AAAA,MACF;AACA,MAAA,OAAO,EAAC;AAAA,IACV;AAAA;AAEJ,CAAA;AAEO,MAAM,iBAAA,GAAoB,CAC/B,IAAA,KACoBA,4BAAA,CAAsB,MAAM,eAAe;;"}
1
+ {"version":3,"file":"hpas.cjs.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 type { HorizontalPodAutoscaler } from 'kubernetes-models/autoscaling/v2';\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/v2',\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":["detectErrorsInObjects"],"mappings":";;;;AAoBA,MAAM,eAAA,GAA0D;AAAA,EAC9D;AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,IAAA,CAAK,IAAI,IAAA,EAAM,WAAA,IAAe,EAAA,MAAQ,GAAA,CAAI,QAAQ,eAAA,EAAiB;AACjE,QAAA,OAAO;AAAA,UACL;AAAA,YACE,IAAA,EAAM,0BAAA;AAAA,YACN,OAAA,EAAS,+BACP,GAAA,CAAI,MAAA,EAAQ,eACd,CAAA,qDAAA,EACE,GAAA,CAAI,IAAA,EAAM,WAAA,IAAe,EAC3B,CAAA,CAAA,CAAA;AAAA,YACA,QAAA,EAAU,CAAA;AAAA,YACV,SAAA,EAAW;AAAA,cACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,cAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,cACtC,IAAA,EAAM,yBAAA;AAAA,cACN,QAAA,EAAU;AAAA,aACZ;AAAA,YACA,eAAA,EAAiB;AAAA;AACnB,SACF;AAAA,MACF;AACA,MAAA,OAAO,EAAC;AAAA,IACV;AAAA;AAEJ,CAAA;AAEO,MAAM,iBAAA,GAAoB,CAC/B,IAAA,KACoBA,4BAAA,CAAsB,MAAM,eAAe;;"}
@@ -1 +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/v2';\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/v2',\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,eAAA,GAA0D;AAAA,EAC9D;AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,IAAA,CAAK,IAAI,IAAA,EAAM,WAAA,IAAe,EAAA,MAAQ,GAAA,CAAI,QAAQ,eAAA,EAAiB;AACjE,QAAA,OAAO;AAAA,UACL;AAAA,YACE,IAAA,EAAM,0BAAA;AAAA,YACN,OAAA,EAAS,+BACP,GAAA,CAAI,MAAA,EAAQ,eACd,CAAA,qDAAA,EACE,GAAA,CAAI,IAAA,EAAM,WAAA,IAAe,EAC3B,CAAA,CAAA,CAAA;AAAA,YACA,QAAA,EAAU,CAAA;AAAA,YACV,SAAA,EAAW;AAAA,cACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,cAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,cACtC,IAAA,EAAM,yBAAA;AAAA,cACN,QAAA,EAAU;AAAA,aACZ;AAAA,YACA,eAAA,EAAiB;AAAA;AACnB,SACF;AAAA,MACF;AACA,MAAA,OAAO,EAAC;AAAA,IACV;AAAA;AAEJ,CAAA;AAEO,MAAM,iBAAA,GAAoB,CAC/B,IAAA,KACoB,qBAAA,CAAsB,MAAM,eAAe;;"}
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 type { HorizontalPodAutoscaler } from 'kubernetes-models/autoscaling/v2';\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/v2',\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,eAAA,GAA0D;AAAA,EAC9D;AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,IAAA,CAAK,IAAI,IAAA,EAAM,WAAA,IAAe,EAAA,MAAQ,GAAA,CAAI,QAAQ,eAAA,EAAiB;AACjE,QAAA,OAAO;AAAA,UACL;AAAA,YACE,IAAA,EAAM,0BAAA;AAAA,YACN,OAAA,EAAS,+BACP,GAAA,CAAI,MAAA,EAAQ,eACd,CAAA,qDAAA,EACE,GAAA,CAAI,IAAA,EAAM,WAAA,IAAe,EAC3B,CAAA,CAAA,CAAA;AAAA,YACA,QAAA,EAAU,CAAA;AAAA,YACV,SAAA,EAAW;AAAA,cACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,cAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,cACtC,IAAA,EAAM,yBAAA;AAAA,cACN,QAAA,EAAU;AAAA,aACZ;AAAA,YACA,eAAA,EAAiB;AAAA;AACnB,SACF;AAAA,MACF;AACA,MAAA,OAAO,EAAC;AAAA,IACV;AAAA;AAEJ,CAAA;AAEO,MAAM,iBAAA,GAAoB,CAC/B,IAAA,KACoB,qBAAA,CAAsB,MAAM,eAAe;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"pods.cjs.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":["DateTime","lodash","detectErrorsInObjects"],"mappings":";;;;;;;;;;AAsBA,SAAS,0BAAA,CAA2B;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,IACE,eAAA,CAAgB,SAChB,eAAA,CAAgB,KAAA,EAAO,SAAS,SAAA,KAAc,MAAA,IAC9C,CAAC,SAAA,CAAU,cAAA,EACX;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,gBAAgBA,cAAA,CAAS,OAAA;AAAA,IAC7B,eAAA,CAAgB,OAAO,OAAA,EAAS;AAAA,IAG/B,IAAA,CAAK;AAAA,IACJ,OAAA,EAAS,SAAA,CAAU,cAAA,EAAgB,mBAAA,IAAuB;AAAA,GAC3D,EAEA,IAAA,CAAK;AAAA,IACJ,UACG,SAAA,CAAU,cAAA,EAAgB,iBAAiB,CAAA,KAC3C,SAAA,CAAU,gBAAgB,gBAAA,IAAoB,CAAA;AAAA,GAClD,CAAA;AACH,EAAA,OAAO,aAAA,GAAgBA,eAAS,GAAA,EAAI;AACtC;AAOA,MAAM,8BAAA,GAAiC,CAAC,GAAA,KAAuC;AAC7E,EAAA,MAAM,KAAA,GAAQC,uBAAA,CAAO,OAAA,CAAQ,GAAA,CAAI,IAAA,EAAM,cAAc,EAAC,EAAG,CAAA,KAAA,KAAS,KAAA,CAAM,IAAI,CAAA;AAE5E,EAAA,MAAM,SAAmC,EAAC;AAE1C,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;AAAA,SACZ;AAAA,QACA,eAAA,EAAiB;AAAA,OACnB,CAAE,CAAA;AAAA,IACN;AAAA,GACF;AAAA,EACA;AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC,EACvC,MAAA,CAAO,CAAA,EAAA,KAAM,EAAA,CAAG,YAAA,GAAe,CAAC,CAAA,CAChC,GAAA,CAAI,CAAA,EAAA,MAAO;AAAA,QACV,IAAA,EAAM,uBAAA;AAAA,QACN,SAAS,CAAA,UAAA,EAAa,EAAA,CAAG,IAAI,CAAA,WAAA,EAAc,GAAG,YAAY,CAAA,MAAA,CAAA;AAAA,QAC1D,QAAA,EAAU,CAAA;AAAA,QACV,WAAA,EAAa,2BAA2B,GAAG,CAAA;AAAA,QAC3C,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UACtC,IAAA,EAAM,KAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,iBAAiB,EAAA,CAAG;AAAA,OACtB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,kBAAA,GAAqB,CAAC,IAAA,KACjCC,4BAAA,CAAsB,MAAM,eAAe;;"}
1
+ {"version":3,"file":"pods.cjs.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 type { 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":["DateTime","lodash","detectErrorsInObjects"],"mappings":";;;;;;;;;;AAsBA,SAAS,0BAAA,CAA2B;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,IACE,eAAA,CAAgB,SAChB,eAAA,CAAgB,KAAA,EAAO,SAAS,SAAA,KAAc,MAAA,IAC9C,CAAC,SAAA,CAAU,cAAA,EACX;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,gBAAgBA,cAAA,CAAS,OAAA;AAAA,IAC7B,eAAA,CAAgB,OAAO,OAAA,EAAS;AAAA,IAG/B,IAAA,CAAK;AAAA,IACJ,OAAA,EAAS,SAAA,CAAU,cAAA,EAAgB,mBAAA,IAAuB;AAAA,GAC3D,EAEA,IAAA,CAAK;AAAA,IACJ,UACG,SAAA,CAAU,cAAA,EAAgB,iBAAiB,CAAA,KAC3C,SAAA,CAAU,gBAAgB,gBAAA,IAAoB,CAAA;AAAA,GAClD,CAAA;AACH,EAAA,OAAO,aAAA,GAAgBA,eAAS,GAAA,EAAI;AACtC;AAOA,MAAM,8BAAA,GAAiC,CAAC,GAAA,KAAuC;AAC7E,EAAA,MAAM,KAAA,GAAQC,uBAAA,CAAO,OAAA,CAAQ,GAAA,CAAI,IAAA,EAAM,cAAc,EAAC,EAAG,CAAA,KAAA,KAAS,KAAA,CAAM,IAAI,CAAA;AAE5E,EAAA,MAAM,SAAmC,EAAC;AAE1C,EAAA,KAAA,MAAW,EAAA,IAAM,GAAA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B;AAAA,OACnB,CAAE,CAAA;AAAA,IACN;AAAA,GACF;AAAA,EACA;AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC,EACvC,MAAA,CAAO,CAAA,EAAA,KAAM,EAAA,CAAG,YAAA,GAAe,CAAC,CAAA,CAChC,GAAA,CAAI,CAAA,EAAA,MAAO;AAAA,QACV,IAAA,EAAM,uBAAA;AAAA,QACN,SAAS,CAAA,UAAA,EAAa,EAAA,CAAG,IAAI,CAAA,WAAA,EAAc,GAAG,YAAY,CAAA,MAAA,CAAA;AAAA,QAC1D,QAAA,EAAU,CAAA;AAAA,QACV,WAAA,EAAa,2BAA2B,GAAG,CAAA;AAAA,QAC3C,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UACtC,IAAA,EAAM,KAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,iBAAiB,EAAA,CAAG;AAAA,OACtB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,kBAAA,GAAqB,CAAC,IAAA,KACjCC,4BAAA,CAAsB,MAAM,eAAe;;"}
@@ -1 +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":[],"mappings":";;;;AAsBA,SAAS,0BAAA,CAA2B;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,IACE,eAAA,CAAgB,SAChB,eAAA,CAAgB,KAAA,EAAO,SAAS,SAAA,KAAc,MAAA,IAC9C,CAAC,SAAA,CAAU,cAAA,EACX;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,gBAAgB,QAAA,CAAS,OAAA;AAAA,IAC7B,eAAA,CAAgB,OAAO,OAAA,EAAS;AAAA,IAG/B,IAAA,CAAK;AAAA,IACJ,OAAA,EAAS,SAAA,CAAU,cAAA,EAAgB,mBAAA,IAAuB;AAAA,GAC3D,EAEA,IAAA,CAAK;AAAA,IACJ,UACG,SAAA,CAAU,cAAA,EAAgB,iBAAiB,CAAA,KAC3C,SAAA,CAAU,gBAAgB,gBAAA,IAAoB,CAAA;AAAA,GAClD,CAAA;AACH,EAAA,OAAO,aAAA,GAAgB,SAAS,GAAA,EAAI;AACtC;AAOA,MAAM,8BAAA,GAAiC,CAAC,GAAA,KAAuC;AAC7E,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,GAAA,CAAI,IAAA,EAAM,cAAc,EAAC,EAAG,CAAA,KAAA,KAAS,KAAA,CAAM,IAAI,CAAA;AAE5E,EAAA,MAAM,SAAmC,EAAC;AAE1C,EAAA,KAAA,MAAW,EAAA,IAAM,GAAA,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC,EAAG;AACpD,IAAA,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AAAA,IACE,cAAc,CAAA,GAAA,KAAO;AACnB,MAAA,OAAA,CAAQ,GAAA,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC,EACvC,MAAA,CAAO,CAAA,EAAA,KAAM,EAAA,CAAG,YAAA,GAAe,CAAC,CAAA,CAChC,GAAA,CAAI,CAAA,EAAA,MAAO;AAAA,QACV,IAAA,EAAM,uBAAA;AAAA,QACN,SAAS,CAAA,UAAA,EAAa,EAAA,CAAG,IAAI,CAAA,WAAA,EAAc,GAAG,YAAY,CAAA,MAAA,CAAA;AAAA,QAC1D,QAAA,EAAU,CAAA;AAAA,QACV,WAAA,EAAa,2BAA2B,GAAG,CAAA;AAAA,QAC3C,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UACtC,IAAA,EAAM,KAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,iBAAiB,EAAA,CAAG;AAAA,OACtB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,kBAAA,GAAqB,CAAC,IAAA,KACjC,qBAAA,CAAsB,MAAM,eAAe;;"}
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 type { 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":[],"mappings":";;;;AAsBA,SAAS,0BAAA,CAA2B;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,IACE,eAAA,CAAgB,SAChB,eAAA,CAAgB,KAAA,EAAO,SAAS,SAAA,KAAc,MAAA,IAC9C,CAAC,SAAA,CAAU,cAAA,EACX;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,gBAAgB,QAAA,CAAS,OAAA;AAAA,IAC7B,eAAA,CAAgB,OAAO,OAAA,EAAS;AAAA,IAG/B,IAAA,CAAK;AAAA,IACJ,OAAA,EAAS,SAAA,CAAU,cAAA,EAAgB,mBAAA,IAAuB;AAAA,GAC3D,EAEA,IAAA,CAAK;AAAA,IACJ,UACG,SAAA,CAAU,cAAA,EAAgB,iBAAiB,CAAA,KAC3C,SAAA,CAAU,gBAAgB,gBAAA,IAAoB,CAAA;AAAA,GAClD,CAAA;AACH,EAAA,OAAO,aAAA,GAAgB,SAAS,GAAA,EAAI;AACtC;AAOA,MAAM,8BAAA,GAAiC,CAAC,GAAA,KAAuC;AAC7E,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,GAAA,CAAI,IAAA,EAAM,cAAc,EAAC,EAAG,CAAA,KAAA,KAAS,KAAA,CAAM,IAAI,CAAA;AAE5E,EAAA,MAAM,SAAmC,EAAC;AAE1C,EAAA,KAAA,MAAW,EAAA,IAAM,GAAA,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC,EAAG;AACpD,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,EAAA,CAAG,IAAI,CAAA;AAC1B,IAAA,IAAI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MAAA,EAAQ,iBAAA,IAAqB,EAAC,EACvC,MAAA,CAAO,CAAA,EAAA,KAAM,EAAA,CAAG,YAAA,GAAe,CAAC,CAAA,CAChC,GAAA,CAAI,CAAA,EAAA,MAAO;AAAA,QACV,IAAA,EAAM,uBAAA;AAAA,QACN,SAAS,CAAA,UAAA,EAAa,EAAA,CAAG,IAAI,CAAA,WAAA,EAAc,GAAG,YAAY,CAAA,MAAA,CAAA;AAAA,QAC1D,QAAA,EAAU,CAAA;AAAA,QACV,WAAA,EAAa,2BAA2B,GAAG,CAAA;AAAA,QAC3C,SAAA,EAAW;AAAA,UACT,IAAA,EAAM,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,aAAA;AAAA,UAC5B,SAAA,EAAW,GAAA,CAAI,QAAA,EAAU,SAAA,IAAa,mBAAA;AAAA,UACtC,IAAA,EAAM,KAAA;AAAA,UACN,QAAA,EAAU;AAAA,SACZ;AAAA,QACA,iBAAiB,EAAA,CAAG;AAAA,OACtB,CAAE,CAAA;AAAA,IACN;AAAA;AAEJ,CAAA;AAEO,MAAM,kBAAA,GAAqB,CAAC,IAAA,KACjC,qBAAA,CAAsB,MAAM,eAAe;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-kubernetes-common",
3
- "version": "0.9.14",
3
+ "version": "0.9.15-next.0",
4
4
  "description": "Common functionalities for kubernetes, to be shared between kubernetes and kubernetes-backend plugin",
5
5
  "backstage": {
6
6
  "role": "common-library",
@@ -52,16 +52,16 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "@backstage/catalog-model": "^1.10.2",
56
- "@backstage/plugin-permission-common": "^0.9.12",
57
- "@backstage/types": "^1.2.2",
55
+ "@backstage/catalog-model": "1.10.2",
56
+ "@backstage/plugin-permission-common": "0.9.12",
57
+ "@backstage/types": "1.2.2",
58
58
  "@kubernetes/client-node": "1.4.0",
59
- "kubernetes-models": "^4.3.1",
60
59
  "lodash": "^4.17.21",
61
60
  "luxon": "^3.0.0"
62
61
  },
63
62
  "devDependencies": {
64
- "@backstage/cli": "^0.36.7"
63
+ "@backstage/cli": "0.36.8-next.0",
64
+ "kubernetes-models": "^4.3.1"
65
65
  },
66
66
  "typesVersions": {
67
67
  "*": {