@@ -29,6 +29,8 @@ import {
|
||||
} from '@backstage/plugin-kubernetes-common';
|
||||
import fixture1 from '../src/__fixtures__/1-deployments.json';
|
||||
import fixture2 from '../src/__fixtures__/2-deployments.json';
|
||||
import fixture3 from '../src/__fixtures__/1-cronjobs.json';
|
||||
import fixture4 from '../src/__fixtures__/2-cronjobs.json';
|
||||
import { TestApiProvider } from '@backstage/test-utils';
|
||||
|
||||
const mockEntity: Entity = {
|
||||
@@ -102,5 +104,31 @@ createDevApp()
|
||||
</TestApiProvider>
|
||||
),
|
||||
})
|
||||
.addPage({
|
||||
path: '/fixture-3',
|
||||
title: 'Fixture 3',
|
||||
element: (
|
||||
<TestApiProvider
|
||||
apis={[[kubernetesApiRef, new MockKubernetesClient(fixture3)]]}
|
||||
>
|
||||
<EntityProvider entity={mockEntity}>
|
||||
<EntityKubernetesContent />
|
||||
</EntityProvider>
|
||||
</TestApiProvider>
|
||||
),
|
||||
})
|
||||
.addPage({
|
||||
path: '/fixture-4',
|
||||
title: 'Fixture 4',
|
||||
element: (
|
||||
<TestApiProvider
|
||||
apis={[[kubernetesApiRef, new MockKubernetesClient(fixture4)]]}
|
||||
>
|
||||
<EntityProvider entity={mockEntity}>
|
||||
<EntityKubernetesContent />
|
||||
</EntityProvider>
|
||||
</TestApiProvider>
|
||||
),
|
||||
})
|
||||
.registerPlugin(kubernetesPlugin)
|
||||
.render();
|
||||
|
||||
@@ -0,0 +1,446 @@
|
||||
{
|
||||
"cronJobs": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob",
|
||||
"namespace": "default",
|
||||
"uid": "9ea073bc-7a4b-4b99-8321-0305bce85568",
|
||||
"resourceVersion": "1362732552",
|
||||
"creationTimestamp": "2021-07-16T22:39:58Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"schedule": "30 5 * * *",
|
||||
"startingDeadlineSeconds": 1800,
|
||||
"concurrencyPolicy": "Forbid",
|
||||
"suspend": false,
|
||||
"jobTemplate": {
|
||||
"metadata": { "creationTimestamp": null },
|
||||
"spec": {
|
||||
"backoffLimit": 2,
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "busybox",
|
||||
"image": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"]
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"successfulJobsHistoryLimit": 2,
|
||||
"failedJobsHistoryLimit": 2
|
||||
},
|
||||
"status": {
|
||||
"active": [
|
||||
{
|
||||
"kind": "Job",
|
||||
"namespace": "default",
|
||||
"name": "dice-roller-cronjob-1637028600",
|
||||
"uid": "32be1b89-5b53-45b2-aa84-277e75214f61",
|
||||
"apiVersion": "batch/v1",
|
||||
"resourceVersion": "1361174163"
|
||||
}
|
||||
],
|
||||
"lastScheduleTime": "2021-11-16T02:10:00Z"
|
||||
}
|
||||
}
|
||||
],
|
||||
"jobs": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637025000",
|
||||
"namespace": "default",
|
||||
"uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"resourceVersion": "1361029181",
|
||||
"creationTimestamp": "2021-11-16T01:10:24Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "CronJob",
|
||||
"name": "dice-roller-cronjob",
|
||||
"uid": "9ea073bc-7a4b-4b99-8321-0305bce85568",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"parallelism": 1,
|
||||
"completions": 1,
|
||||
"backoffLimit": 2,
|
||||
"selector": {
|
||||
"matchLabels": {
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a"
|
||||
}
|
||||
},
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"job-name": "dice-roller-cronjob-1637025000"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"conditions": [
|
||||
{
|
||||
"type": "Complete",
|
||||
"status": "True",
|
||||
"lastProbeTime": "2021-11-16T01:11:31Z",
|
||||
"lastTransitionTime": "2021-11-16T01:11:31Z"
|
||||
}
|
||||
],
|
||||
"startTime": "2021-11-16T01:10:24Z",
|
||||
"completionTime": "2021-11-16T01:11:31Z",
|
||||
"succeeded": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637028600",
|
||||
"namespace": "default",
|
||||
"uid": "32be1b89-5b53-45b2-aa84-277e75214f61",
|
||||
"resourceVersion": "1361174166",
|
||||
"creationTimestamp": "2021-11-16T02:10:22Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "CronJob",
|
||||
"name": "dice-roller-cronjob",
|
||||
"uid": "9ea073bc-7a4b-4b99-8321-0305bce85568",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"parallelism": 1,
|
||||
"completions": 1,
|
||||
"backoffLimit": 2,
|
||||
"selector": {
|
||||
"matchLabels": {
|
||||
"controller-uid": "32be1b89-5b53-45b2-aa84-277e75214f61"
|
||||
}
|
||||
},
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "32be1b89-5b53-45b2-aa84-277e75214f61",
|
||||
"job-name": "dice-roller-cronjob-1637028600"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": { "startTime": "2021-11-16T02:10:22Z", "active": 1 }
|
||||
}
|
||||
],
|
||||
"pods": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637025000-gstc4",
|
||||
"generateName": "dice-roller-cronjob-1637025000-",
|
||||
"namespace": "default",
|
||||
"uid": "3b0f2b65-5ae2-441a-beda-bdc92bcafaf0",
|
||||
"resourceVersion": "1361029179",
|
||||
"creationTimestamp": "2021-11-16T01:10:24Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"job-name": "dice-roller-cronjob-1637025000"
|
||||
},
|
||||
"annotations": {},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
"name": "dice-roller-cronjob-1637025000",
|
||||
"uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"volumes": [],
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"serviceAccountName": "default",
|
||||
"serviceAccount": "default",
|
||||
"nodeName": "minikube",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler",
|
||||
"tolerations": [
|
||||
{
|
||||
"key": "node.kubernetes.io/not-ready",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
},
|
||||
{
|
||||
"key": "node.kubernetes.io/unreachable",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
}
|
||||
],
|
||||
"priority": 0,
|
||||
"enableServiceLinks": true
|
||||
},
|
||||
"status": {
|
||||
"phase": "Succeeded",
|
||||
"conditions": [
|
||||
{
|
||||
"type": "Initialized",
|
||||
"status": "True",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T01:10:27Z",
|
||||
"reason": "PodCompleted"
|
||||
},
|
||||
{
|
||||
"type": "Ready",
|
||||
"status": "False",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T01:11:31Z",
|
||||
"reason": "PodCompleted"
|
||||
},
|
||||
{
|
||||
"type": "ContainersReady",
|
||||
"status": "False",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T01:11:31Z",
|
||||
"reason": "PodCompleted"
|
||||
},
|
||||
{
|
||||
"type": "PodScheduled",
|
||||
"status": "True",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T01:10:24Z"
|
||||
}
|
||||
],
|
||||
"hostIP": "192.168.49.2",
|
||||
"podIP": "172.17.0.25",
|
||||
"podIPs": [{ "ip": "172.17.0.25" }],
|
||||
"startTime": "2021-11-16T01:10:24Z",
|
||||
"containerStatuses": [
|
||||
{
|
||||
"name": "busybox",
|
||||
"state": {
|
||||
"terminated": {
|
||||
"exitCode": 0,
|
||||
"reason": "Completed",
|
||||
"startedAt": "2021-11-16T01:10:31Z",
|
||||
"finishedAt": "2021-11-16T01:11:30Z",
|
||||
"containerID": "docker://1062343e1bb3625e36717bc15617c1bbca976366c3c9dd87035c71f33d015615"
|
||||
}
|
||||
},
|
||||
"lastState": {},
|
||||
"ready": false,
|
||||
"restartCount": 0,
|
||||
"image": "busybox:latest/node",
|
||||
"imageID": "docker-pullable://busybox@sha256:e7157b6d7ebbe2cce5eaa8cfe8aa4fa82d173999b9f90a9ec42e57323546c353",
|
||||
"containerID": "docker://1062343e1bb3625e36717bc15617c1bbca976366c3c9dd87035c71f33d015615",
|
||||
"started": false
|
||||
}
|
||||
],
|
||||
"qosClass": "Burstable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637028600-p4mlc",
|
||||
"generateName": "dice-roller-cronjob-1637028600-",
|
||||
"namespace": "default",
|
||||
"uid": "acddd5d2-ac7f-473b-a9d8-17a89f99ac39",
|
||||
"resourceVersion": "1361174579",
|
||||
"creationTimestamp": "2021-11-16T02:10:22Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "32be1b89-5b53-45b2-aa84-277e75214f61",
|
||||
"job-name": "dice-roller-cronjob-1637028600"
|
||||
},
|
||||
"annotations": {},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
"name": "dice-roller-cronjob-1637028600",
|
||||
"uid": "32be1b89-5b53-45b2-aa84-277e75214f61",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"volumes": [],
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"serviceAccountName": "default",
|
||||
"serviceAccount": "default",
|
||||
"nodeName": "minikube",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler",
|
||||
"tolerations": [
|
||||
{
|
||||
"key": "node.kubernetes.io/not-ready",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
},
|
||||
{
|
||||
"key": "node.kubernetes.io/unreachable",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
}
|
||||
],
|
||||
"priority": 0,
|
||||
"enableServiceLinks": true
|
||||
},
|
||||
"status": {
|
||||
"phase": "Running",
|
||||
"conditions": [
|
||||
{
|
||||
"type": "Initialized",
|
||||
"status": "True",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T02:10:25Z"
|
||||
},
|
||||
{
|
||||
"type": "Ready",
|
||||
"status": "True",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T02:10:35Z"
|
||||
},
|
||||
{
|
||||
"type": "ContainersReady",
|
||||
"status": "True",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T02:10:35Z"
|
||||
},
|
||||
{
|
||||
"type": "PodScheduled",
|
||||
"status": "True",
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-16T02:10:22Z"
|
||||
}
|
||||
],
|
||||
"hostIP": "192.168.49.2",
|
||||
"podIP": "172.17.0.25",
|
||||
"podIPs": [{ "ip": "172.17.0.25" }],
|
||||
"startTime": "2021-11-16T02:10:22Z",
|
||||
"containerStatuses": [
|
||||
{
|
||||
"name": "busybox",
|
||||
"state": {
|
||||
"running": { "startedAt": "2021-11-16T02:10:31Z" }
|
||||
},
|
||||
"lastState": {},
|
||||
"ready": true,
|
||||
"restartCount": 0,
|
||||
"image": "busybox:latest",
|
||||
"imageID": "docker-pullable://busybox@sha256:e7157b6d7ebbe2cce5eaa8cfe8aa4fa82d173999b9f90a9ec42e57323546c353",
|
||||
"containerID": "docker://1062343e1bb3625e36717bc15617c1bbca976366c3c9dd87035c71f33d015615",
|
||||
"started": true
|
||||
}
|
||||
],
|
||||
"qosClass": "Burstable"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,385 @@
|
||||
{
|
||||
"cronJobs": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob",
|
||||
"namespace": "default",
|
||||
"uid": "9ea073bc-7a4b-4b99-8321-0305bce85568",
|
||||
"resourceVersion": "1362732552",
|
||||
"creationTimestamp": "2021-07-16T22:39:58Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"schedule": "* */2 * * *",
|
||||
"startingDeadlineSeconds": 1800,
|
||||
"concurrencyPolicy": "Forbid",
|
||||
"suspend": true,
|
||||
"jobTemplate": {
|
||||
"metadata": { "creationTimestamp": null },
|
||||
"spec": {
|
||||
"backoffLimit": 2,
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "busybox",
|
||||
"image": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"]
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"successfulJobsHistoryLimit": 2,
|
||||
"failedJobsHistoryLimit": 2
|
||||
},
|
||||
"status": {
|
||||
"lastScheduleTime": "2021-11-16T02:10:00Z"
|
||||
}
|
||||
}
|
||||
],
|
||||
"jobs": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637025000",
|
||||
"namespace": "default",
|
||||
"uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"resourceVersion": "1361029181",
|
||||
"creationTimestamp": "2021-11-16T01:10:24Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "CronJob",
|
||||
"name": "dice-roller-cronjob",
|
||||
"uid": "9ea073bc-7a4b-4b99-8321-0305bce85568",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"parallelism": 1,
|
||||
"completions": 1,
|
||||
"backoffLimit": 2,
|
||||
"selector": {
|
||||
"matchLabels": {
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a"
|
||||
}
|
||||
},
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"job-name": "dice-roller-cronjob-1637025000"
|
||||
},
|
||||
"annotations": {}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler"
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"conditions": [
|
||||
{
|
||||
"type": "Failed",
|
||||
"status": "True",
|
||||
"reason": "BackoffLimitExceeded",
|
||||
"lastProbeTime": "2021-11-16T01:11:31Z",
|
||||
"lastTransitionTime": "2021-11-16T01:11:31Z"
|
||||
}
|
||||
],
|
||||
"startTime": "2021-11-16T01:10:24Z",
|
||||
"failed": 2
|
||||
}
|
||||
}
|
||||
],
|
||||
"pods": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637025000-gstc4",
|
||||
"generateName": "dice-roller-cronjob-1637025000-",
|
||||
"namespace": "default",
|
||||
"uid": "3b0f2b65-5ae2-441a-beda-bdc92bcafaf0",
|
||||
"resourceVersion": "1361029179",
|
||||
"creationTimestamp": "2021-11-16T01:10:24Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"job-name": "dice-roller-cronjob-1637025000"
|
||||
},
|
||||
"annotations": {},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
"name": "dice-roller-cronjob-1637025000",
|
||||
"uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"volumes": [],
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"serviceAccountName": "default",
|
||||
"serviceAccount": "default",
|
||||
"nodeName": "minikube",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler",
|
||||
"tolerations": [
|
||||
{
|
||||
"key": "node.kubernetes.io/not-ready",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
},
|
||||
{
|
||||
"key": "node.kubernetes.io/unreachable",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
}
|
||||
],
|
||||
"priority": 0,
|
||||
"enableServiceLinks": true
|
||||
},
|
||||
"status": {
|
||||
"phase": "Failed",
|
||||
"conditions": [
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:10:13Z",
|
||||
"status": "True",
|
||||
"type": "Initialized"
|
||||
},
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:11:02Z",
|
||||
"message": "containers with unready status: [busybox]",
|
||||
"reason": "ContainersNotReady",
|
||||
"status": "False",
|
||||
"type": "Ready"
|
||||
},
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:11:02Z",
|
||||
"message": "containers with unready status: [busybox]",
|
||||
"reason": "ContainersNotReady",
|
||||
"status": "False",
|
||||
"type": "ContainersReady"
|
||||
},
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:10:08Z",
|
||||
"status": "True",
|
||||
"type": "PodScheduled"
|
||||
}
|
||||
],
|
||||
"hostIP": "192.168.49.2",
|
||||
"podIP": "172.17.0.25",
|
||||
"podIPs": [{ "ip": "172.17.0.25" }],
|
||||
"startTime": "2021-11-18T19:10:08Z",
|
||||
"containerStatuses": [
|
||||
{
|
||||
"name": "busybox",
|
||||
"state": {
|
||||
"terminated": {
|
||||
"exitCode": 1,
|
||||
"finishedAt": "2021-11-18T19:11:01Z",
|
||||
"reason": "Error",
|
||||
"startedAt": "2021-11-18T19:10:17Z",
|
||||
"containerID": "docker://1062343e1bb3625e36717bc15617c1bbca976366c3c9dd87035c71f33d015615"
|
||||
}
|
||||
},
|
||||
"lastState": {},
|
||||
"ready": false,
|
||||
"restartCount": 0,
|
||||
"image": "busybox:latest",
|
||||
"imageID": "docker-pullable://busybox@sha256:e7157b6d7ebbe2cce5eaa8cfe8aa4fa82d173999b9f90a9ec42e57323546c353",
|
||||
"containerID": "docker://1062343e1bb3625e36717bc15617c1bbca976366c3c9dd87035c71f33d015615",
|
||||
"started": false
|
||||
}
|
||||
],
|
||||
"qosClass": "Burstable"
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "dice-roller-cronjob-1637025000-p4mlc",
|
||||
"generateName": "dice-roller-cronjob-1637025000-",
|
||||
"namespace": "default",
|
||||
"uid": "acddd5d2-ac7f-473b-a9d8-17a89f99ac39",
|
||||
"resourceVersion": "1361174579",
|
||||
"creationTimestamp": "2021-11-16T02:10:22Z",
|
||||
"labels": {
|
||||
"backstage.io/kubernetes-id": "dice-roller",
|
||||
"controller-uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"job-name": "dice-roller-cronjob-1637025000"
|
||||
},
|
||||
"annotations": {},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "batch/v1",
|
||||
"kind": "Job",
|
||||
"name": "dice-roller-cronjob-1637025000",
|
||||
"uid": "69d5d242-a9a4-47b8-b9c7-c536ae8f151a",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"volumes": [],
|
||||
"containers": [
|
||||
{
|
||||
"command": ["/bin/sh", "-c", "date; echo Rolling a die!"],
|
||||
"image": "busybox",
|
||||
"imagePullPolicy": "IfNotPresent",
|
||||
"name": "busybox",
|
||||
"resources": {},
|
||||
"terminationMessagePath": "/dev/termination-log",
|
||||
"terminationMessagePolicy": "File"
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Never",
|
||||
"terminationGracePeriodSeconds": 30,
|
||||
"dnsPolicy": "ClusterFirst",
|
||||
"serviceAccountName": "default",
|
||||
"serviceAccount": "default",
|
||||
"nodeName": "minikube",
|
||||
"securityContext": {},
|
||||
"schedulerName": "default-scheduler",
|
||||
"tolerations": [
|
||||
{
|
||||
"key": "node.kubernetes.io/not-ready",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
},
|
||||
{
|
||||
"key": "node.kubernetes.io/unreachable",
|
||||
"operator": "Exists",
|
||||
"effect": "NoExecute",
|
||||
"tolerationSeconds": 300
|
||||
}
|
||||
],
|
||||
"priority": 0,
|
||||
"enableServiceLinks": true
|
||||
},
|
||||
"status": {
|
||||
"phase": "Failed",
|
||||
"conditions": [
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:10:13Z",
|
||||
"status": "True",
|
||||
"type": "Initialized"
|
||||
},
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:11:02Z",
|
||||
"message": "containers with unready status: [busybox]",
|
||||
"reason": "ContainersNotReady",
|
||||
"status": "False",
|
||||
"type": "Ready"
|
||||
},
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:11:02Z",
|
||||
"message": "containers with unready status: [busybox]",
|
||||
"reason": "ContainersNotReady",
|
||||
"status": "False",
|
||||
"type": "ContainersReady"
|
||||
},
|
||||
{
|
||||
"lastProbeTime": null,
|
||||
"lastTransitionTime": "2021-11-18T19:10:08Z",
|
||||
"status": "True",
|
||||
"type": "PodScheduled"
|
||||
}
|
||||
],
|
||||
"hostIP": "192.168.49.2",
|
||||
"podIP": "172.17.0.25",
|
||||
"podIPs": [{ "ip": "172.17.0.25" }],
|
||||
"startTime": "2021-11-16T02:10:22Z",
|
||||
"containerStatuses": [
|
||||
{
|
||||
"name": "busybox",
|
||||
"state": {
|
||||
"terminated": {
|
||||
"exitCode": 1,
|
||||
"finishedAt": "2021-11-18T19:11:01Z",
|
||||
"reason": "Error",
|
||||
"startedAt": "2021-11-18T19:10:17Z",
|
||||
"containerID": "docker://2659c4d0f8a68f2b49863c18738322f1686d5b87275428e5e641fd9fd9e06739"
|
||||
}
|
||||
},
|
||||
"lastState": {},
|
||||
"ready": true,
|
||||
"restartCount": 0,
|
||||
"image": "busybox:latest",
|
||||
"imageID": "docker-pullable://busybox@sha256:e7157b6d7ebbe2cce5eaa8cfe8aa4fa82d173999b9f90a9ec42e57323546c353",
|
||||
"containerID": "docker://2659c4d0f8a68f2b49863c18738322f1686d5b87275428e5e641fd9fd9e06739",
|
||||
"started": true
|
||||
}
|
||||
],
|
||||
"qosClass": "Burstable"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { CronJobsAccordions } from './CronJobsAccordions';
|
||||
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
|
||||
import * as twoCronJobsFixture from '../../__fixtures__/2-cronjobs.json';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { kubernetesProviders } from '../../hooks/test-utils';
|
||||
|
||||
describe('CronJobsAccordions', () => {
|
||||
it('should render 1 active cronjobs', async () => {
|
||||
const wrapper = kubernetesProviders(oneCronJobsFixture, []);
|
||||
|
||||
const { getByText } = render(
|
||||
wrapper(wrapInTestApp(<CronJobsAccordions />)),
|
||||
);
|
||||
|
||||
expect(getByText('dice-roller-cronjob')).toBeInTheDocument();
|
||||
expect(getByText('CronJob')).toBeInTheDocument();
|
||||
expect(getByText('namespace: default')).toBeInTheDocument();
|
||||
expect(getByText('Active')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render 1 suspended cronjobs', async () => {
|
||||
const wrapper = kubernetesProviders(twoCronJobsFixture, []);
|
||||
|
||||
const { getByText } = render(
|
||||
wrapper(wrapInTestApp(<CronJobsAccordions />)),
|
||||
);
|
||||
|
||||
expect(getByText('dice-roller-cronjob')).toBeInTheDocument();
|
||||
expect(getByText('CronJob')).toBeInTheDocument();
|
||||
expect(getByText('namespace: default')).toBeInTheDocument();
|
||||
expect(getByText('Suspended')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
AccordionSummary,
|
||||
Divider,
|
||||
Grid,
|
||||
Typography,
|
||||
} from '@material-ui/core';
|
||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||
import { V1CronJob, V1Job } from '@kubernetes/client-node';
|
||||
@@ -75,11 +76,14 @@ const CronJobSummary = ({ cronJob }: CronJobSummaryProps) => {
|
||||
)}
|
||||
</Grid>
|
||||
<Grid item>
|
||||
Schedule:{' '}
|
||||
{cronJob.spec?.schedule
|
||||
? `${cronJob.spec.schedule} (
|
||||
${cronstrue.toString(cronJob.spec.schedule)})`
|
||||
: '???'}
|
||||
<Typography variant="body1">
|
||||
Schedule:{' '}
|
||||
{cronJob.spec?.schedule
|
||||
? `${cronJob.spec.schedule} (${cronstrue.toString(
|
||||
cronJob.spec.schedule,
|
||||
)})`
|
||||
: '???'}
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { CronJobDrawer } from './CronJobsDrawer';
|
||||
|
||||
describe('CronJobDrawer', () => {
|
||||
it('should render cronJob drawer', async () => {
|
||||
const { getByText, getAllByText } = await renderInTestApp(
|
||||
<CronJobDrawer
|
||||
cronJob={(oneCronJobsFixture as any).cronJobs[0]}
|
||||
expanded
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(getAllByText('dice-roller-cronjob')).toHaveLength(2);
|
||||
expect(getAllByText('CronJob')).toHaveLength(2);
|
||||
expect(getByText('YAML')).toBeInTheDocument();
|
||||
expect(getByText('Schedule')).toBeInTheDocument();
|
||||
expect(getByText('30 5 * * *')).toBeInTheDocument();
|
||||
expect(getByText('Starting Deadline Seconds')).toBeInTheDocument();
|
||||
expect(getByText('Last Schedule Time')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { JobsAccordions } from './JobsAccordions';
|
||||
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { kubernetesProviders } from '../../hooks/test-utils';
|
||||
import { V1Job, ObjectSerializer } from '@kubernetes/client-node';
|
||||
|
||||
describe('JobsAccordions', () => {
|
||||
it('should render 2 jobs', async () => {
|
||||
const wrapper = kubernetesProviders(oneCronJobsFixture, []);
|
||||
|
||||
const jobs: V1Job[] = oneCronJobsFixture.jobs.map(
|
||||
job => ObjectSerializer.deserialize(job, 'V1Job') as V1Job,
|
||||
);
|
||||
|
||||
const { getByText } = render(
|
||||
wrapper(wrapInTestApp(<JobsAccordions jobs={jobs} />)),
|
||||
);
|
||||
|
||||
expect(getByText('dice-roller-cronjob-1637028600')).toBeInTheDocument();
|
||||
expect(getByText('Running')).toBeInTheDocument();
|
||||
|
||||
expect(getByText('dice-roller-cronjob-1637025000')).toBeInTheDocument();
|
||||
expect(getByText('Succeeded')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -76,9 +76,11 @@ const JobSummary = ({ job }: JobSummaryProps) => {
|
||||
{job.status?.active && <StatusPending>Running</StatusPending>}
|
||||
{job.status?.failed && <StatusError>Failed</StatusError>}
|
||||
</Grid>
|
||||
<Grid item>Start time: {job.status?.startTime}</Grid>
|
||||
<Grid item>Start time: {job.status?.startTime?.toString()}</Grid>
|
||||
{job.status?.completionTime && (
|
||||
<Grid item>Completion time: {job.status.completionTime}</Grid>
|
||||
<Grid item>
|
||||
Completion time: {job.status.completionTime.toString()}
|
||||
</Grid>
|
||||
)}
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import * as oneCronJobsFixture from '../../__fixtures__/1-cronjobs.json';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { JobDrawer } from './JobsDrawer';
|
||||
|
||||
describe('JobDrawer', () => {
|
||||
it('should render job drawer', async () => {
|
||||
const { getByText, getAllByText } = await renderInTestApp(
|
||||
<JobDrawer job={(oneCronJobsFixture as any).jobs[0]} expanded />,
|
||||
);
|
||||
|
||||
expect(getAllByText('dice-roller-cronjob-1637025000')).toHaveLength(2);
|
||||
expect(getAllByText('Job')).toHaveLength(2);
|
||||
expect(getByText('YAML')).toBeInTheDocument();
|
||||
expect(getByText('Parallelism')).toBeInTheDocument();
|
||||
expect(getByText('Completions')).toBeInTheDocument();
|
||||
expect(getByText('Back Off Limit')).toBeInTheDocument();
|
||||
expect(getByText('Start Time')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user