@backstage/plugin-kubernetes 0.7.1-next.0 → 0.7.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 CHANGED
@@ -1,5 +1,35 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 860ed68343: Fixed bug in CronJobsAccordions component that causes an error when cronjobs use a kubernetes alias, such as `@hourly` or `@daily` instead of standard cron syntax.
8
+ - f563b86a5b: Adds namespace column to Kubernetes error reporting table
9
+ - Updated dependencies
10
+ - @backstage/plugin-kubernetes-common@0.4.1
11
+ - @backstage/core-components@0.11.0
12
+ - @backstage/core-plugin-api@1.0.5
13
+ - @backstage/plugin-catalog-react@1.1.3
14
+
15
+ ## 0.7.1-next.2
16
+
17
+ ### Patch Changes
18
+
19
+ - f563b86a5b: Adds namespace column to Kubernetes error reporting table
20
+ - Updated dependencies
21
+ - @backstage/plugin-catalog-react@1.1.3-next.2
22
+ - @backstage/core-components@0.11.0-next.2
23
+
24
+ ## 0.7.1-next.1
25
+
26
+ ### Patch Changes
27
+
28
+ - 860ed68343: Fixed bug in CronJobsAccordions component that causes an error when cronjobs use a kubernetes alias, such as `@hourly` or `@daily` instead of standard cron syntax.
29
+ - Updated dependencies
30
+ - @backstage/core-components@0.10.1-next.1
31
+ - @backstage/plugin-catalog-react@1.1.3-next.1
32
+
3
33
  ## 0.7.1-next.0
4
34
 
5
35
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -173,6 +173,7 @@ declare type DetectedErrorsByCluster = Map<string, DetectedError[]>;
173
173
  interface DetectedError {
174
174
  severity: ErrorSeverity;
175
175
  cluster: string;
176
+ namespace: string;
176
177
  kind: ErrorDetectableKind;
177
178
  names: string[];
178
179
  message: string[];
package/dist/index.esm.js CHANGED
@@ -254,12 +254,17 @@ const ErrorPanel$1 = ({
254
254
  const columns = [
255
255
  {
256
256
  title: "cluster",
257
- width: "15%",
257
+ width: "10%",
258
258
  render: (detectedError) => detectedError.cluster
259
259
  },
260
+ {
261
+ title: "namespace",
262
+ width: "10%",
263
+ render: (detectedError) => detectedError.namespace
264
+ },
260
265
  {
261
266
  title: "kind",
262
- width: "15%",
267
+ width: "10%",
263
268
  render: (detectedError) => detectedError.kind
264
269
  },
265
270
  {
@@ -501,7 +506,7 @@ const podStatusToMemoryUtil = (podStatus) => {
501
506
  };
502
507
 
503
508
  const detectErrorsInObjects = (objects, kind, clusterName, errorMappers) => {
504
- var _a, _b;
509
+ var _a, _b, _c, _d;
505
510
  const errors = /* @__PURE__ */ new Map();
506
511
  for (const object of objects) {
507
512
  for (const errorMapper of errorMappers) {
@@ -510,6 +515,7 @@ const detectErrorsInObjects = (objects, kind, clusterName, errorMappers) => {
510
515
  const dedupKey = message.join("");
511
516
  const value = errors.get(dedupKey);
512
517
  const name = (_b = (_a = object.metadata) == null ? void 0 : _a.name) != null ? _b : "unknown";
518
+ const namespace = (_d = (_c = object.metadata) == null ? void 0 : _c.namespace) != null ? _d : "unknown";
513
519
  if (value !== void 0) {
514
520
  value.names.push(name);
515
521
  errors.set(dedupKey, value);
@@ -519,7 +525,8 @@ const detectErrorsInObjects = (objects, kind, clusterName, errorMappers) => {
519
525
  kind,
520
526
  names: [name],
521
527
  message,
522
- severity: errorMapper.severity
528
+ severity: errorMapper.severity,
529
+ namespace
523
530
  });
524
531
  }
525
532
  }
@@ -1978,6 +1985,24 @@ const CronJobDrawer = ({
1978
1985
  }))));
1979
1986
  };
1980
1987
 
1988
+ const k8sCronAliases = /* @__PURE__ */ new Map([
1989
+ ["@yearly", "0 0 1 1 *"],
1990
+ ["@annually", "0 0 1 1 *"],
1991
+ ["@monthly", "0 0 1 * *"],
1992
+ ["@weekly", "0 0 * * 0"],
1993
+ ["@daily", "0 0 * * *"],
1994
+ ["@midnight", "0 0 * * *"],
1995
+ ["@hourly", "0 * * * *"]
1996
+ ]);
1997
+ const humanizeCron = (schedule) => {
1998
+ const deAliasedSchedule = k8sCronAliases.get(schedule) || schedule;
1999
+ try {
2000
+ return cronstrue.toString(deAliasedSchedule);
2001
+ } catch (e) {
2002
+ return deAliasedSchedule;
2003
+ }
2004
+ };
2005
+
1981
2006
  const CronJobSummary = ({ cronJob }) => {
1982
2007
  var _a, _b;
1983
2008
  return /* @__PURE__ */ React__default.createElement(Grid, {
@@ -2009,7 +2034,7 @@ const CronJobSummary = ({ cronJob }) => {
2009
2034
  item: true
2010
2035
  }, /* @__PURE__ */ React__default.createElement(Typography, {
2011
2036
  variant: "body1"
2012
- }, "Schedule:", " ", ((_b = cronJob.spec) == null ? void 0 : _b.schedule) ? `${cronJob.spec.schedule} (${cronstrue.toString(
2037
+ }, "Schedule:", " ", ((_b = cronJob.spec) == null ? void 0 : _b.schedule) ? `${cronJob.spec.schedule} (${humanizeCron(
2013
2038
  cronJob.spec.schedule
2014
2039
  )})` : "N/A"))));
2015
2040
  };