@backstage/plugin-kubernetes-common 0.9.6 → 0.9.7-next.1
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 +17 -0
- package/dist/catalog-entity-constants.cjs.js.map +1 -1
- package/dist/catalog-entity-constants.esm.js.map +1 -1
- package/dist/certificate-authority-constants.cjs.js.map +1 -1
- package/dist/certificate-authority-constants.esm.js.map +1 -1
- package/dist/error-detection/common.cjs.js.map +1 -1
- package/dist/error-detection/common.esm.js.map +1 -1
- package/dist/error-detection/deployments.cjs.js.map +1 -1
- package/dist/error-detection/deployments.esm.js.map +1 -1
- package/dist/error-detection/error-detection.cjs.js.map +1 -1
- package/dist/error-detection/error-detection.esm.js.map +1 -1
- package/dist/error-detection/hpas.cjs.js.map +1 -1
- package/dist/error-detection/hpas.esm.js.map +1 -1
- package/dist/error-detection/pods.cjs.js.map +1 -1
- package/dist/error-detection/pods.esm.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/permissions.cjs.js.map +1 -1
- package/dist/permissions.esm.js.map +1 -1
- package/dist/util/response.cjs.js.map +1 -1
- package/dist/util/response.esm.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-kubernetes-common
|
|
2
2
|
|
|
3
|
+
## 0.9.7-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @backstage/plugin-permission-common@0.9.2-next.0
|
|
9
|
+
|
|
10
|
+
## 0.9.7-next.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bdd7f95: Make SERVICEACCOUNT_CA_PATH public so it can be imported by external modules.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- @backstage/catalog-model@1.7.5
|
|
17
|
+
- @backstage/types@1.2.2
|
|
18
|
+
- @backstage/plugin-permission-common@0.9.1
|
|
19
|
+
|
|
3
20
|
## 0.9.6
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-entity-constants.cjs.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 * The annotation key used to identify Kubernetes resources in Backstage.\n * This constant represents the standard annotation 'backstage.io/kubernetes-id'\n * which links catalog entities to their corresponding Kubernetes resources.\n *\n * @public\n */\nexport const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';\n\n/**\n * Annotation used to specify a Kubernetes label selector query for filtering resources.\n * When this annotation is added to a catalog entity, it defines criteria for selecting\n * Kubernetes resources based on their labels.\n *\n * @public\n *\n * @remarks\n * The value of this annotation should be a valid Kubernetes label selector query string.\n * For example: 'app=my-app,environment=production'\n */\nexport const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =\n 'backstage.io/kubernetes-label-selector';\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":";;AAuBO,MAAM,
|
|
1
|
+
{"version":3,"file":"catalog-entity-constants.cjs.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 * The annotation key used to identify Kubernetes resources in Backstage.\n * This constant represents the standard annotation 'backstage.io/kubernetes-id'\n * which links catalog entities to their corresponding Kubernetes resources.\n *\n * @public\n */\nexport const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';\n\n/**\n * Annotation used to specify a Kubernetes label selector query for filtering resources.\n * When this annotation is added to a catalog entity, it defines criteria for selecting\n * Kubernetes resources based on their labels.\n *\n * @public\n *\n * @remarks\n * The value of this annotation should be a valid Kubernetes label selector query string.\n * For example: 'app=my-app,environment=production'\n */\nexport const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =\n 'backstage.io/kubernetes-label-selector';\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":";;AAuBO,MAAM,qBAAA,GAAwB;AAa9B,MAAM,0CAAA,GACX;AAOK,MAAM,gCAAA,GAAmC;AAOzC,MAAM,mCAAA,GACX;AAOK,MAAM,mCAAA,GACX;AAOK,MAAM,yCAAA,GACX;AAOK,MAAM,yCAAA,GACX;AAOK,MAAM,qCAAA,GACX;AAOK,MAAM,mCAAA,GACX;AAOK,MAAM,mCAAA,GACX;AAOK,MAAM,0CAAA,GACX;AAOK,MAAM,qCAAA,GACX;AAOK,MAAM,oCAAA,GACX;AAOK,MAAM,qCAAA,GACX;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +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 * The annotation key used to identify Kubernetes resources in Backstage.\n * This constant represents the standard annotation 'backstage.io/kubernetes-id'\n * which links catalog entities to their corresponding Kubernetes resources.\n *\n * @public\n */\nexport const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';\n\n/**\n * Annotation used to specify a Kubernetes label selector query for filtering resources.\n * When this annotation is added to a catalog entity, it defines criteria for selecting\n * Kubernetes resources based on their labels.\n *\n * @public\n *\n * @remarks\n * The value of this annotation should be a valid Kubernetes label selector query string.\n * For example: 'app=my-app,environment=production'\n */\nexport const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =\n 'backstage.io/kubernetes-label-selector';\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":"AAuBO,MAAM,
|
|
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 * The annotation key used to identify Kubernetes resources in Backstage.\n * This constant represents the standard annotation 'backstage.io/kubernetes-id'\n * which links catalog entities to their corresponding Kubernetes resources.\n *\n * @public\n */\nexport const KUBERNETES_ANNOTATION = 'backstage.io/kubernetes-id';\n\n/**\n * Annotation used to specify a Kubernetes label selector query for filtering resources.\n * When this annotation is added to a catalog entity, it defines criteria for selecting\n * Kubernetes resources based on their labels.\n *\n * @public\n *\n * @remarks\n * The value of this annotation should be a valid Kubernetes label selector query string.\n * For example: 'app=my-app,environment=production'\n */\nexport const KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION =\n 'backstage.io/kubernetes-label-selector';\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":"AAuBO,MAAM,qBAAA,GAAwB;AAa9B,MAAM,0CAAA,GACX;AAOK,MAAM,gCAAA,GAAmC;AAOzC,MAAM,mCAAA,GACX;AAOK,MAAM,mCAAA,GACX;AAOK,MAAM,yCAAA,GACX;AAOK,MAAM,yCAAA,GACX;AAOK,MAAM,qCAAA,GACX;AAOK,MAAM,mCAAA,GACX;AAOK,MAAM,mCAAA,GACX;AAOK,MAAM,0CAAA,GACX;AAOK,MAAM,qCAAA,GACX;AAOK,MAAM,oCAAA,GACX;AAOK,MAAM,qCAAA,GACX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate-authority-constants.cjs.js","sources":["../src/certificate-authority-constants.ts"],"sourcesContent":["/*\n * Copyright 2024 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 * A constant that specifies the location of the certificate for the service account.\n *\n * @
|
|
1
|
+
{"version":3,"file":"certificate-authority-constants.cjs.js","sources":["../src/certificate-authority-constants.ts"],"sourcesContent":["/*\n * Copyright 2024 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 * A constant that specifies the location of the certificate for the service account.\n *\n * @public\n */\nexport const SERVICEACCOUNT_CA_PATH =\n '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt';\n"],"names":[],"mappings":";;AAqBO,MAAM,sBAAA,GACX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate-authority-constants.esm.js","sources":["../src/certificate-authority-constants.ts"],"sourcesContent":["/*\n * Copyright 2024 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 * A constant that specifies the location of the certificate for the service account.\n *\n * @
|
|
1
|
+
{"version":3,"file":"certificate-authority-constants.esm.js","sources":["../src/certificate-authority-constants.ts"],"sourcesContent":["/*\n * Copyright 2024 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 * A constant that specifies the location of the certificate for the service account.\n *\n * @public\n */\nexport const SERVICEACCOUNT_CA_PATH =\n '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt';\n"],"names":[],"mappings":"AAqBO,MAAM,sBAAA,GACX;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.cjs.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":";;
|
|
1
|
+
{"version":3,"file":"common.cjs.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":";;AAoBO,MAAM,qBAAA,GAAwB,CACnC,OAAA,EACA,YAAA,KACoB;AACpB,EAAA,OAAO,OAAA,CAAQ,QAAQ,CAAA,CAAA,KAAK;AAC1B,IAAA,OAAO,aAAa,OAAA,CAAQ,CAAA,EAAA,KAAM,EAAA,CAAG,YAAA,CAAa,CAAC,CAAC,CAAA;AAAA,EACtD,CAAC,CAAA;AACH;;;;"}
|
|
@@ -1 +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":"
|
|
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":"AAoBO,MAAM,qBAAA,GAAwB,CACnC,OAAA,EACA,YAAA,KACoB;AACpB,EAAA,OAAO,OAAA,CAAQ,QAAQ,CAAA,CAAA,KAAK;AAC1B,IAAA,OAAO,aAAa,OAAA,CAAQ,CAAA,EAAA,KAAM,EAAA,CAAG,YAAA,CAAa,CAAC,CAAC,CAAA;AAAA,EACtD,CAAC,CAAA;AACH;;;;"}
|
|
@@ -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,
|
|
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 +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,
|
|
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 +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 { 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":";;;;;;;
|
|
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 { 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 +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/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":";;;;;
|
|
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/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 +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,
|
|
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 +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,
|
|
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 +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,0BAA2B,CAAA;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAoC,EAAA;AAClC,EACE,IAAA,eAAA,CAAgB,SAChB,eAAgB,CAAA,KAAA,EAAO,SAAS,SAAc,KAAA,KAAA,CAAA,IAC9C,CAAC,SAAA,CAAU,cACX,EAAA;AACA,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,MAAM,gBAAgBA,cAAS,CAAA,OAAA;AAAA,IAC7B,eAAA,CAAgB,OAAO,OAAS,EAAA;AAAA,IAG/B,IAAK,CAAA;AAAA,IACJ,OAAA,EAAS,SAAU,CAAA,cAAA,EAAgB,mBAAuB,IAAA;AAAA,GAC3D,EAEA,IAAK,CAAA;AAAA,IACJ,UACG,SAAU,CAAA,cAAA,EAAgB,iBAAiB,CAC3C,KAAA,SAAA,CAAU,gBAAgB,gBAAoB,IAAA,CAAA;AAAA,GAClD,CAAA;AACH,EAAO,OAAA,aAAA,GAAgBA,eAAS,GAAI,EAAA;AACtC;AAOA,MAAM,8BAAA,GAAiC,CAAC,GAAuC,KAAA;AAC7E,EAAM,MAAA,KAAA,GAAQC,uBAAO,CAAA,OAAA,CAAQ,GAAI,CAAA,IAAA,EAAM,cAAc,EAAC,EAAG,CAAS,KAAA,KAAA,KAAA,CAAM,IAAI,CAAA;AAE5E,EAAA,MAAM,SAAmC,EAAC;AAE1C,EAAA,KAAA,MAAW,EAAM,IAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAI,EA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AA;AACN,GACF;AAAA,EACA;AAAA,IACE,cAAc,CAAO,GAAA,KAAA;AACnB,MAAA,OAAA,CAAQ,GAAI,CAAA,MAAA,EAAQ,iBAAqB,IAAA,EACtC,EAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,YAAe,GAAA,CAAC,CAChC,CAAA,GAAA,CAAI,CAAO,EAAA,MAAA;AAAA,QACV,IAAM,EAAA,uBAAA;AAAA,QACN,SAAS,CAAa,UAAA,EAAA,EAAA,CAAG,IAAI,CAAA,WAAA,EAAc,GAAG,YAAY,CAAA,MAAA,CAAA;AAAA,QAC1D,QAAU,EAAA,CAAA;AAAA,QACV,WAAA,EAAa,2BAA2B,GAAG,CAAA;AAAA,QAC3C,SAAW,EAAA;AAAA,UACT,IAAA,EAAM,GAAI,CAAA,QAAA,EAAU,IAAQ,IAAA,aAAA;AAAA,UAC5B,SAAA,EAAW,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,mBAAA;AAAA,UACtC,IAAM,EAAA,KAAA;AAAA,UACN,QAAU,EAAA;AAAA,SACZ;AAAA,QACA,iBAAiB,EAAG,CAAA;AAAA,OACpB,CAAA,CAAA;AAAA;AACN;AAEJ,CAAA;AAEO,MAAM,kBAAqB,GAAA,CAAC,IACjC,KAAAC,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 { 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,CAAI,MAAA,EAAQ,iBAAA,IAAqB,EAAC,EAAG;AACpD,IAAA,MAAM,IA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E,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,0BAA2B,CAAA;AAAA,EAClC,SAAA;AAAA,EACA;AACF,CAAoC,EAAA;AAClC,EACE,IAAA,eAAA,CAAgB,SAChB,eAAgB,CAAA,KAAA,EAAO,SAAS,SAAc,KAAA,KAAA,CAAA,IAC9C,CAAC,SAAA,CAAU,cACX,EAAA;AACA,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,MAAM,gBAAgB,QAAS,CAAA,OAAA;AAAA,IAC7B,eAAA,CAAgB,OAAO,OAAS,EAAA;AAAA,IAG/B,IAAK,CAAA;AAAA,IACJ,OAAA,EAAS,SAAU,CAAA,cAAA,EAAgB,mBAAuB,IAAA;AAAA,GAC3D,EAEA,IAAK,CAAA;AAAA,IACJ,UACG,SAAU,CAAA,cAAA,EAAgB,iBAAiB,CAC3C,KAAA,SAAA,CAAU,gBAAgB,gBAAoB,IAAA,CAAA;AAAA,GAClD,CAAA;AACH,EAAO,OAAA,aAAA,GAAgB,SAAS,GAAI,EAAA;AACtC;AAOA,MAAM,8BAAA,GAAiC,CAAC,GAAuC,KAAA;AAC7E,EAAM,MAAA,KAAA,GAAQ,MAAO,CAAA,OAAA,CAAQ,GAAI,CAAA,IAAA,EAAM,cAAc,EAAC,EAAG,CAAS,KAAA,KAAA,KAAA,CAAM,IAAI,CAAA;AAE5E,EAAA,MAAM,SAAmC,EAAC;AAE1C,EAAA,KAAA,MAAW,EAAM,IAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAI,EAAA;AACpD,IAAM,MAAA,IAAA,GAAO,KAAM,CAAA,EAAA,CAAG,IAAI,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,MAAA,OAAA,CAAQ,GAAI,CAAA,MAAA,EAAQ,iBAAqB,IAAA,EACtC,EAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,YAAe,GAAA,CAAC,CAChC,CAAA,GAAA,CAAI,CAAO,EAAA,MAAA;AAAA,QACV,IAAM,EAAA,uBAAA;AAAA,QACN,SAAS,CAAa,UAAA,EAAA,EAAA,CAAG,IAAI,CAAA,WAAA,EAAc,GAAG,YAAY,CAAA,MAAA,CAAA;AAAA,QAC1D,QAAU,EAAA,CAAA;AAAA,QACV,WAAA,EAAa,2BAA2B,GAAG,CAAA;AAAA,QAC3C,SAAW,EAAA;AAAA,UACT,IAAA,EAAM,GAAI,CAAA,QAAA,EAAU,IAAQ,IAAA,aAAA;AAAA,UAC5B,SAAA,EAAW,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,mBAAA;AAAA,UACtC,IAAM,EAAA,KAAA;AAAA,UACN,QAAU,EAAA;AAAA,SACZ;AAAA,QACA,iBAAiB,EAAG,CAAA;AAAA,OACpB,CAAA,CAAA;AAAA;AACN;AAEJ,CAAA;AAEO,MAAM,kBAAqB,GAAA,CAAC,IACjC,KAAA,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 { 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,IAAA,CAAK,SAAS,CAAA,EAAG;AACnB,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C,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/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonValue, JsonObject } from '@backstage/types';
|
|
2
|
-
import { V1Pod, V1Service, V1ConfigMap, V1Deployment,
|
|
2
|
+
import { V1Pod, V1Service, V1ConfigMap, V1Deployment, V1LimitRange, V1ResourceQuota, V1ReplicaSet, V2HorizontalPodAutoscaler, V1Job, V1CronJob, V1Ingress, V1StatefulSet, V1DaemonSet, PodStatus, V1Secret } from '@kubernetes/client-node';
|
|
3
3
|
import { Entity } from '@backstage/catalog-model';
|
|
4
4
|
import * as _backstage_plugin_permission_common from '@backstage/plugin-permission-common';
|
|
5
5
|
import { ObjectsByEntityResponse as ObjectsByEntityResponse$1, FetchResponse as FetchResponse$1 } from '@backstage/plugin-kubernetes-common';
|
|
@@ -313,6 +313,13 @@ declare const ANNOTATION_KUBERNETES_AWS_CLUSTER_ID = "kubernetes.io/x-k8s-aws-id
|
|
|
313
313
|
*/
|
|
314
314
|
declare const ANNOTATION_KUBERNETES_AWS_EXTERNAL_ID = "kubernetes.io/aws-external-id";
|
|
315
315
|
|
|
316
|
+
/**
|
|
317
|
+
* A constant that specifies the location of the certificate for the service account.
|
|
318
|
+
*
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
321
|
+
declare const SERVICEACCOUNT_CA_PATH = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt";
|
|
322
|
+
|
|
316
323
|
/** This permission is used to check access to the proxy endpoint
|
|
317
324
|
* @public
|
|
318
325
|
*/
|
|
@@ -406,4 +413,4 @@ declare const detectErrors: (objects: ObjectsByEntityResponse$1) => DetectedErro
|
|
|
406
413
|
/** @public */
|
|
407
414
|
declare const groupResponses: (fetchResponse: FetchResponse$1[]) => GroupedResponses;
|
|
408
415
|
|
|
409
|
-
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, type AuthProviderType, type ClientContainerStatus, type ClientCurrentResourceUsage, type ClientPodStatus, type ClusterAttributes, type ClusterObjects, type ConfigMapFetchResponse, type CronJobsFetchResponse, type CustomObjectsByEntityRequest, type CustomResourceFetchResponse, type CustomResourceMatcher, type DaemonSetsFetchResponse, type DeploymentFetchResponse, type DeploymentResources, type DetectedError, type DetectedErrorsByCluster, type DocsSolution, type ErrorMapper, type ErrorSeverity, type EventsSolution, type FetchResponse, type GroupedResponses, type HorizontalPodAutoscalersFetchResponse, type IngressesFetchResponse, type JobsFetchResponse, KUBERNETES_ANNOTATION, KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION, type KubernetesErrorTypes, type KubernetesFetchError, type KubernetesRequestAuth, type KubernetesRequestBody, type LimitRangeFetchResponse, type LogSolution, type ObjectsByEntityResponse, type PodFetchResponse, type PodStatusFetchResponse, type ProposedFix, type ProposedFixBase, type RawFetchError, type ReplicaSetsFetchResponse, type ResourceQuotaFetchResponse, type ResourceRef, type SecretsFetchResponse, type ServiceFetchResponse, type StatefulSetsFetchResponse, type StatusError, type WorkloadsByEntityRequest, detectErrors, groupResponses, kubernetesClustersReadPermission, kubernetesPermissions, kubernetesProxyPermission, kubernetesResourcesReadPermission };
|
|
416
|
+
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, type AuthProviderType, type ClientContainerStatus, type ClientCurrentResourceUsage, type ClientPodStatus, type ClusterAttributes, type ClusterObjects, type ConfigMapFetchResponse, type CronJobsFetchResponse, type CustomObjectsByEntityRequest, type CustomResourceFetchResponse, type CustomResourceMatcher, type DaemonSetsFetchResponse, type DeploymentFetchResponse, type DeploymentResources, type DetectedError, type DetectedErrorsByCluster, type DocsSolution, type ErrorMapper, type ErrorSeverity, type EventsSolution, type FetchResponse, type GroupedResponses, type HorizontalPodAutoscalersFetchResponse, type IngressesFetchResponse, type JobsFetchResponse, KUBERNETES_ANNOTATION, KUBERNETES_LABEL_SELECTOR_QUERY_ANNOTATION, type KubernetesErrorTypes, type KubernetesFetchError, type KubernetesRequestAuth, type KubernetesRequestBody, type LimitRangeFetchResponse, type LogSolution, type ObjectsByEntityResponse, type PodFetchResponse, type PodStatusFetchResponse, type ProposedFix, type ProposedFixBase, type RawFetchError, type ReplicaSetsFetchResponse, type ResourceQuotaFetchResponse, type ResourceRef, SERVICEACCOUNT_CA_PATH, type SecretsFetchResponse, type ServiceFetchResponse, type StatefulSetsFetchResponse, type StatusError, type WorkloadsByEntityRequest, detectErrors, groupResponses, kubernetesClustersReadPermission, kubernetesPermissions, kubernetesProxyPermission, kubernetesResourcesReadPermission };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.cjs.js","sources":["../src/permissions.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\nimport { createPermission } from '@backstage/plugin-permission-common';\n\n/** This permission is used to check access to the proxy endpoint\n * @public\n */\nexport const kubernetesProxyPermission = createPermission({\n name: 'kubernetes.proxy',\n attributes: {},\n});\n\n/** This permission is used to check access to the /resources and /services/:serviceId endpoints\n * @public\n */\nexport const kubernetesResourcesReadPermission = createPermission({\n name: 'kubernetes.resources.read',\n attributes: {\n action: 'read',\n },\n});\n\n/** This permission is used to check access to the /clusters endpoint\n * @public\n */\nexport const kubernetesClustersReadPermission = createPermission({\n name: 'kubernetes.clusters.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * List of all Kubernetes permissions.\n * @public\n */\nexport const kubernetesPermissions = [\n kubernetesProxyPermission,\n kubernetesResourcesReadPermission,\n kubernetesClustersReadPermission,\n];\n"],"names":["createPermission"],"mappings":";;;;AAqBO,MAAM,4BAA4BA,
|
|
1
|
+
{"version":3,"file":"permissions.cjs.js","sources":["../src/permissions.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\nimport { createPermission } from '@backstage/plugin-permission-common';\n\n/** This permission is used to check access to the proxy endpoint\n * @public\n */\nexport const kubernetesProxyPermission = createPermission({\n name: 'kubernetes.proxy',\n attributes: {},\n});\n\n/** This permission is used to check access to the /resources and /services/:serviceId endpoints\n * @public\n */\nexport const kubernetesResourcesReadPermission = createPermission({\n name: 'kubernetes.resources.read',\n attributes: {\n action: 'read',\n },\n});\n\n/** This permission is used to check access to the /clusters endpoint\n * @public\n */\nexport const kubernetesClustersReadPermission = createPermission({\n name: 'kubernetes.clusters.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * List of all Kubernetes permissions.\n * @public\n */\nexport const kubernetesPermissions = [\n kubernetesProxyPermission,\n kubernetesResourcesReadPermission,\n kubernetesClustersReadPermission,\n];\n"],"names":["createPermission"],"mappings":";;;;AAqBO,MAAM,4BAA4BA,uCAAA,CAAiB;AAAA,EACxD,IAAA,EAAM,kBAAA;AAAA,EACN,YAAY;AACd,CAAC;AAKM,MAAM,oCAAoCA,uCAAA,CAAiB;AAAA,EAChE,IAAA,EAAM,2BAAA;AAAA,EACN,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ,CAAC;AAKM,MAAM,mCAAmCA,uCAAA,CAAiB;AAAA,EAC/D,IAAA,EAAM,0BAAA;AAAA,EACN,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ,CAAC;AAMM,MAAM,qBAAA,GAAwB;AAAA,EACnC,yBAAA;AAAA,EACA,iCAAA;AAAA,EACA;AACF;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.esm.js","sources":["../src/permissions.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\nimport { createPermission } from '@backstage/plugin-permission-common';\n\n/** This permission is used to check access to the proxy endpoint\n * @public\n */\nexport const kubernetesProxyPermission = createPermission({\n name: 'kubernetes.proxy',\n attributes: {},\n});\n\n/** This permission is used to check access to the /resources and /services/:serviceId endpoints\n * @public\n */\nexport const kubernetesResourcesReadPermission = createPermission({\n name: 'kubernetes.resources.read',\n attributes: {\n action: 'read',\n },\n});\n\n/** This permission is used to check access to the /clusters endpoint\n * @public\n */\nexport const kubernetesClustersReadPermission = createPermission({\n name: 'kubernetes.clusters.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * List of all Kubernetes permissions.\n * @public\n */\nexport const kubernetesPermissions = [\n kubernetesProxyPermission,\n kubernetesResourcesReadPermission,\n kubernetesClustersReadPermission,\n];\n"],"names":[],"mappings":";;AAqBO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"permissions.esm.js","sources":["../src/permissions.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\nimport { createPermission } from '@backstage/plugin-permission-common';\n\n/** This permission is used to check access to the proxy endpoint\n * @public\n */\nexport const kubernetesProxyPermission = createPermission({\n name: 'kubernetes.proxy',\n attributes: {},\n});\n\n/** This permission is used to check access to the /resources and /services/:serviceId endpoints\n * @public\n */\nexport const kubernetesResourcesReadPermission = createPermission({\n name: 'kubernetes.resources.read',\n attributes: {\n action: 'read',\n },\n});\n\n/** This permission is used to check access to the /clusters endpoint\n * @public\n */\nexport const kubernetesClustersReadPermission = createPermission({\n name: 'kubernetes.clusters.read',\n attributes: {\n action: 'read',\n },\n});\n\n/**\n * List of all Kubernetes permissions.\n * @public\n */\nexport const kubernetesPermissions = [\n kubernetesProxyPermission,\n kubernetesResourcesReadPermission,\n kubernetesClustersReadPermission,\n];\n"],"names":[],"mappings":";;AAqBO,MAAM,4BAA4B,gBAAA,CAAiB;AAAA,EACxD,IAAA,EAAM,kBAAA;AAAA,EACN,YAAY;AACd,CAAC;AAKM,MAAM,oCAAoC,gBAAA,CAAiB;AAAA,EAChE,IAAA,EAAM,2BAAA;AAAA,EACN,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ,CAAC;AAKM,MAAM,mCAAmC,gBAAA,CAAiB;AAAA,EAC/D,IAAA,EAAM,0BAAA;AAAA,EACN,UAAA,EAAY;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ,CAAC;AAMM,MAAM,qBAAA,GAAwB;AAAA,EACnC,yBAAA;AAAA,EACA,iCAAA;AAAA,EACA;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.cjs.js","sources":["../../src/util/response.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 { FetchResponse } from '@backstage/plugin-kubernetes-common';\nimport { GroupedResponses } from '../types';\n\n/** @public */\nexport const groupResponses = (\n fetchResponse: FetchResponse[],\n): GroupedResponses => {\n // TODO this could probably be a lodash groupBy\n return fetchResponse.reduce(\n (prev, next) => {\n switch (next.type) {\n case 'deployments':\n prev.deployments.push(...next.resources);\n break;\n case 'pods':\n prev.pods.push(...next.resources);\n break;\n case 'replicasets':\n prev.replicaSets.push(...next.resources);\n break;\n case 'services':\n prev.services.push(...next.resources);\n break;\n case 'configmaps':\n prev.configMaps.push(...next.resources);\n break;\n case 'horizontalpodautoscalers':\n prev.horizontalPodAutoscalers.push(...next.resources);\n break;\n case 'ingresses':\n prev.ingresses.push(...next.resources);\n break;\n case 'jobs':\n prev.jobs.push(...next.resources);\n break;\n case 'cronjobs':\n prev.cronJobs.push(...next.resources);\n break;\n case 'customresources':\n prev.customResources.push(...next.resources);\n break;\n case 'statefulsets':\n prev.statefulsets.push(...next.resources);\n break;\n case 'daemonsets':\n prev.daemonSets.push(...next.resources);\n break;\n default:\n }\n return prev;\n },\n {\n pods: [],\n replicaSets: [],\n deployments: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n daemonSets: [],\n } as GroupedResponses,\n );\n};\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"response.cjs.js","sources":["../../src/util/response.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 { FetchResponse } from '@backstage/plugin-kubernetes-common';\nimport { GroupedResponses } from '../types';\n\n/** @public */\nexport const groupResponses = (\n fetchResponse: FetchResponse[],\n): GroupedResponses => {\n // TODO this could probably be a lodash groupBy\n return fetchResponse.reduce(\n (prev, next) => {\n switch (next.type) {\n case 'deployments':\n prev.deployments.push(...next.resources);\n break;\n case 'pods':\n prev.pods.push(...next.resources);\n break;\n case 'replicasets':\n prev.replicaSets.push(...next.resources);\n break;\n case 'services':\n prev.services.push(...next.resources);\n break;\n case 'configmaps':\n prev.configMaps.push(...next.resources);\n break;\n case 'horizontalpodautoscalers':\n prev.horizontalPodAutoscalers.push(...next.resources);\n break;\n case 'ingresses':\n prev.ingresses.push(...next.resources);\n break;\n case 'jobs':\n prev.jobs.push(...next.resources);\n break;\n case 'cronjobs':\n prev.cronJobs.push(...next.resources);\n break;\n case 'customresources':\n prev.customResources.push(...next.resources);\n break;\n case 'statefulsets':\n prev.statefulsets.push(...next.resources);\n break;\n case 'daemonsets':\n prev.daemonSets.push(...next.resources);\n break;\n default:\n }\n return prev;\n },\n {\n pods: [],\n replicaSets: [],\n deployments: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n daemonSets: [],\n } as GroupedResponses,\n );\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,cAAA,GAAiB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AAA;AAC3C,UAAA;AAAA,QACF,KAAK,cAAA;AACH,UAAA,IAAA,CAAK,YAAA,CAAa,IAAA,CAAK,GAAG,IAAA,CAAK,SAAS,CAAA;AACxC,UAAA;AAAA,QACF,KAAK,YAAA;AACH,UAAA,IAAA,CAAK,UAAA,CAAW,IAAA,CAAK,GAAG,IAAA,CAAK,SAAS,CAAA;AACtC,UAAA;AACF;AAEF,MAAA,OAAO,IAAA;AAAA,IACT,CAAA;AAAA,IACA;AAAA,MACE,MAAM,EAAC;AAAA,MACP,aAAa,EAAC;AAAA,MACd,aAAa,EAAC;AAAA,MACd,UAAU,EAAC;AAAA,MACX,YAAY,EAAC;AAAA,MACb,0BAA0B,EAAC;AAAA,MAC3B,WAAW,EAAC;AAAA,MACZ,MAAM,EAAC;AAAA,MACP,UAAU,EAAC;AAAA,MACX,iBAAiB,EAAC;AAAA,MAClB,cAAc,EAAC;AAAA,MACf,YAAY;AAAC;AACf,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.esm.js","sources":["../../src/util/response.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 { FetchResponse } from '@backstage/plugin-kubernetes-common';\nimport { GroupedResponses } from '../types';\n\n/** @public */\nexport const groupResponses = (\n fetchResponse: FetchResponse[],\n): GroupedResponses => {\n // TODO this could probably be a lodash groupBy\n return fetchResponse.reduce(\n (prev, next) => {\n switch (next.type) {\n case 'deployments':\n prev.deployments.push(...next.resources);\n break;\n case 'pods':\n prev.pods.push(...next.resources);\n break;\n case 'replicasets':\n prev.replicaSets.push(...next.resources);\n break;\n case 'services':\n prev.services.push(...next.resources);\n break;\n case 'configmaps':\n prev.configMaps.push(...next.resources);\n break;\n case 'horizontalpodautoscalers':\n prev.horizontalPodAutoscalers.push(...next.resources);\n break;\n case 'ingresses':\n prev.ingresses.push(...next.resources);\n break;\n case 'jobs':\n prev.jobs.push(...next.resources);\n break;\n case 'cronjobs':\n prev.cronJobs.push(...next.resources);\n break;\n case 'customresources':\n prev.customResources.push(...next.resources);\n break;\n case 'statefulsets':\n prev.statefulsets.push(...next.resources);\n break;\n case 'daemonsets':\n prev.daemonSets.push(...next.resources);\n break;\n default:\n }\n return prev;\n },\n {\n pods: [],\n replicaSets: [],\n deployments: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n daemonSets: [],\n } as GroupedResponses,\n );\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"response.esm.js","sources":["../../src/util/response.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 { FetchResponse } from '@backstage/plugin-kubernetes-common';\nimport { GroupedResponses } from '../types';\n\n/** @public */\nexport const groupResponses = (\n fetchResponse: FetchResponse[],\n): GroupedResponses => {\n // TODO this could probably be a lodash groupBy\n return fetchResponse.reduce(\n (prev, next) => {\n switch (next.type) {\n case 'deployments':\n prev.deployments.push(...next.resources);\n break;\n case 'pods':\n prev.pods.push(...next.resources);\n break;\n case 'replicasets':\n prev.replicaSets.push(...next.resources);\n break;\n case 'services':\n prev.services.push(...next.resources);\n break;\n case 'configmaps':\n prev.configMaps.push(...next.resources);\n break;\n case 'horizontalpodautoscalers':\n prev.horizontalPodAutoscalers.push(...next.resources);\n break;\n case 'ingresses':\n prev.ingresses.push(...next.resources);\n break;\n case 'jobs':\n prev.jobs.push(...next.resources);\n break;\n case 'cronjobs':\n prev.cronJobs.push(...next.resources);\n break;\n case 'customresources':\n prev.customResources.push(...next.resources);\n break;\n case 'statefulsets':\n prev.statefulsets.push(...next.resources);\n break;\n case 'daemonsets':\n prev.daemonSets.push(...next.resources);\n break;\n default:\n }\n return prev;\n },\n {\n pods: [],\n replicaSets: [],\n deployments: [],\n services: [],\n configMaps: [],\n horizontalPodAutoscalers: [],\n ingresses: [],\n jobs: [],\n cronJobs: [],\n customResources: [],\n statefulsets: [],\n daemonSets: [],\n } as GroupedResponses,\n );\n};\n"],"names":[],"mappings":"AAoBO,MAAM,cAAA,GAAiB,CAC5B,aAAA,KACqB;AAErB,EAAA,OAAO,aAAA,CAAc,MAAA;AAAA,IACnB,CAAC,MAAM,IAAA,KAAS;AACd,MAAA,QAAQ,KAAK,IAAA;AAAM,QACjB,KAAK,aAAA;AACH,UAAA,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,IAAA,CAAK,SAAS,CAAA;AACvC,UAAA;AAAA,QACF,KAAK,MAAA;AACH,UAAA,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,GAAG,IAAA,CAAK,SAAS,CAAA;AAChC,UAAA;AAAA,QACF,KAAK,aAAA;AACH,UAAA,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,IAAA,CAAK,SAAS,CAAA;AACvC,UAAA;AAAA,QACF,KAAK,UAAA;AACH,UAAA,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,GAAG,IAAA,CAAK,SAAS,CAAA;AACpC,UAAA;AAAA,QACF,KAAK,YAAA;AACH,UAAA,IAAA,CAAK,UAAA,CAAW,IAAA,CAAK,GAAG,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|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-kubernetes-common",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7-next.1",
|
|
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": "
|
|
56
|
-
"@backstage/plugin-permission-common": "
|
|
57
|
-
"@backstage/types": "
|
|
55
|
+
"@backstage/catalog-model": "1.7.5",
|
|
56
|
+
"@backstage/plugin-permission-common": "0.9.2-next.0",
|
|
57
|
+
"@backstage/types": "1.2.2",
|
|
58
58
|
"@kubernetes/client-node": "1.1.2",
|
|
59
59
|
"kubernetes-models": "^4.3.1",
|
|
60
60
|
"lodash": "^4.17.21",
|
|
61
61
|
"luxon": "^3.0.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@backstage/cli": "
|
|
64
|
+
"@backstage/cli": "0.34.4-next.1"
|
|
65
65
|
},
|
|
66
66
|
"typesVersions": {
|
|
67
67
|
"*": {
|