kubedelos 0.1.0__tar.gz
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.
- kubedelos-0.1.0/LICENSE +201 -0
- kubedelos-0.1.0/NOTICE +4 -0
- kubedelos-0.1.0/PKG-INFO +70 -0
- kubedelos-0.1.0/README.md +209 -0
- kubedelos-0.1.0/README.pypi.md +28 -0
- kubedelos-0.1.0/kubedelos/__init__.py +5 -0
- kubedelos-0.1.0/kubedelos/__main__.py +9 -0
- kubedelos-0.1.0/kubedelos/analytics.py +76 -0
- kubedelos-0.1.0/kubedelos/cli.py +345 -0
- kubedelos-0.1.0/kubedelos/config.py +214 -0
- kubedelos-0.1.0/kubedelos/hints.py +29 -0
- kubedelos-0.1.0/kubedelos/kube/__init__.py +1 -0
- kubedelos-0.1.0/kubedelos/kube/client.py +184 -0
- kubedelos-0.1.0/kubedelos/kube/facts.py +446 -0
- kubedelos-0.1.0/kubedelos/kube/inventory.py +490 -0
- kubedelos-0.1.0/kubedelos/kube/owners.py +13 -0
- kubedelos-0.1.0/kubedelos/kube/rbac.py +253 -0
- kubedelos-0.1.0/kubedelos/mcp_server/__init__.py +5 -0
- kubedelos-0.1.0/kubedelos/mcp_server/prompts.py +134 -0
- kubedelos-0.1.0/kubedelos/mcp_server/server.py +281 -0
- kubedelos-0.1.0/kubedelos/mcp_server/tools.py +518 -0
- kubedelos-0.1.0/kubedelos/models.py +225 -0
- kubedelos-0.1.0/kubedelos/registry/__init__.py +1 -0
- kubedelos-0.1.0/kubedelos/registry/access.py +53 -0
- kubedelos-0.1.0/kubedelos/registry/dockerconfig.py +121 -0
- kubedelos-0.1.0/kubedelos/registry/pullsecrets.py +78 -0
- kubedelos-0.1.0/kubedelos/risk.py +204 -0
- kubedelos-0.1.0/kubedelos/scan/__init__.py +0 -0
- kubedelos-0.1.0/kubedelos/scan/service.py +303 -0
- kubedelos-0.1.0/kubedelos/scheduler.py +71 -0
- kubedelos-0.1.0/kubedelos/scope.py +36 -0
- kubedelos-0.1.0/kubedelos/store/__init__.py +1 -0
- kubedelos-0.1.0/kubedelos/store/accepted.py +202 -0
- kubedelos-0.1.0/kubedelos/store/db.py +331 -0
- kubedelos-0.1.0/kubedelos/store/diff.py +139 -0
- kubedelos-0.1.0/kubedelos/store/intel.py +77 -0
- kubedelos-0.1.0/kubedelos/store/queries.py +1113 -0
- kubedelos-0.1.0/kubedelos/store/queue.py +168 -0
- kubedelos-0.1.0/kubedelos/store/repo.py +268 -0
- kubedelos-0.1.0/kubedelos/store/retention.py +56 -0
- kubedelos-0.1.0/kubedelos/store/runlock.py +139 -0
- kubedelos-0.1.0/kubedelos/store/workloads.py +143 -0
- kubedelos-0.1.0/kubedelos/threatintel.py +299 -0
- kubedelos-0.1.0/kubedelos/trivy/__init__.py +1 -0
- kubedelos-0.1.0/kubedelos/trivy/binary.py +139 -0
- kubedelos-0.1.0/kubedelos/trivy/cache.py +115 -0
- kubedelos-0.1.0/kubedelos/trivy/layers.py +106 -0
- kubedelos-0.1.0/kubedelos/trivy/parse.py +45 -0
- kubedelos-0.1.0/kubedelos/trivy/pins.py +40 -0
- kubedelos-0.1.0/kubedelos/trivy/runner.py +468 -0
- kubedelos-0.1.0/kubedelos/web/__init__.py +4 -0
- kubedelos-0.1.0/kubedelos/web/app.py +232 -0
- kubedelos-0.1.0/kubedelos/web/assets.py +14 -0
- kubedelos-0.1.0/kubedelos/web/identity.py +26 -0
- kubedelos-0.1.0/kubedelos/web/jobs.py +289 -0
- kubedelos-0.1.0/kubedelos/web/pages.py +230 -0
- kubedelos-0.1.0/kubedelos/web/routes/__init__.py +1 -0
- kubedelos-0.1.0/kubedelos/web/routes/about.py +79 -0
- kubedelos-0.1.0/kubedelos/web/routes/accepted.py +197 -0
- kubedelos-0.1.0/kubedelos/web/routes/dashboard.py +281 -0
- kubedelos-0.1.0/kubedelos/web/routes/diff.py +85 -0
- kubedelos-0.1.0/kubedelos/web/routes/failed.py +282 -0
- kubedelos-0.1.0/kubedelos/web/routes/findings.py +210 -0
- kubedelos-0.1.0/kubedelos/web/routes/health.py +31 -0
- kubedelos-0.1.0/kubedelos/web/routes/namespaces.py +144 -0
- kubedelos-0.1.0/kubedelos/web/routes/reports.py +167 -0
- kubedelos-0.1.0/kubedelos/web/routes/scans.py +408 -0
- kubedelos-0.1.0/kubedelos/web/routes/settings.py +270 -0
- kubedelos-0.1.0/kubedelos/web/routes/times.py +60 -0
- kubedelos-0.1.0/kubedelos/web/security.py +294 -0
- kubedelos-0.1.0/kubedelos/web/server.py +86 -0
- kubedelos-0.1.0/kubedelos/web/static/app.css +1664 -0
- kubedelos-0.1.0/kubedelos/web/static/htmx.min.js +1 -0
- kubedelos-0.1.0/kubedelos/web/static/logo.svg +15 -0
- kubedelos-0.1.0/kubedelos/web/templates/about.html +44 -0
- kubedelos-0.1.0/kubedelos/web/templates/accept_form.html +42 -0
- kubedelos-0.1.0/kubedelos/web/templates/accepted.html +71 -0
- kubedelos-0.1.0/kubedelos/web/templates/base.html +72 -0
- kubedelos-0.1.0/kubedelos/web/templates/dashboard.html +198 -0
- kubedelos-0.1.0/kubedelos/web/templates/diff.html +98 -0
- kubedelos-0.1.0/kubedelos/web/templates/error.html +9 -0
- kubedelos-0.1.0/kubedelos/web/templates/failed.html +109 -0
- kubedelos-0.1.0/kubedelos/web/templates/findings.html +136 -0
- kubedelos-0.1.0/kubedelos/web/templates/namespaces.html +73 -0
- kubedelos-0.1.0/kubedelos/web/templates/partials/macros.html +21 -0
- kubedelos-0.1.0/kubedelos/web/templates/partials/registry_test.html +14 -0
- kubedelos-0.1.0/kubedelos/web/templates/partials/run_line.html +43 -0
- kubedelos-0.1.0/kubedelos/web/templates/partials/scan_progress.html +71 -0
- kubedelos-0.1.0/kubedelos/web/templates/partials/scan_queue.html +45 -0
- kubedelos-0.1.0/kubedelos/web/templates/report.html +71 -0
- kubedelos-0.1.0/kubedelos/web/templates/reports.html +79 -0
- kubedelos-0.1.0/kubedelos/web/templates/scans.html +131 -0
- kubedelos-0.1.0/kubedelos/web/templates/settings.html +93 -0
- kubedelos-0.1.0/kubedelos/web/templates/times.html +43 -0
- kubedelos-0.1.0/kubedelos/web/worker.py +162 -0
- kubedelos-0.1.0/kubedelos.egg-info/PKG-INFO +70 -0
- kubedelos-0.1.0/kubedelos.egg-info/SOURCES.txt +112 -0
- kubedelos-0.1.0/kubedelos.egg-info/dependency_links.txt +1 -0
- kubedelos-0.1.0/kubedelos.egg-info/entry_points.txt +2 -0
- kubedelos-0.1.0/kubedelos.egg-info/requires.txt +18 -0
- kubedelos-0.1.0/kubedelos.egg-info/top_level.txt +1 -0
- kubedelos-0.1.0/pyproject.toml +82 -0
- kubedelos-0.1.0/setup.cfg +4 -0
- kubedelos-0.1.0/tests/test_analytics.py +66 -0
- kubedelos-0.1.0/tests/test_cli.py +647 -0
- kubedelos-0.1.0/tests/test_config.py +272 -0
- kubedelos-0.1.0/tests/test_hints.py +32 -0
- kubedelos-0.1.0/tests/test_main.py +18 -0
- kubedelos-0.1.0/tests/test_models.py +125 -0
- kubedelos-0.1.0/tests/test_packaging.py +76 -0
- kubedelos-0.1.0/tests/test_risk.py +190 -0
- kubedelos-0.1.0/tests/test_scheduler.py +63 -0
- kubedelos-0.1.0/tests/test_scope.py +94 -0
- kubedelos-0.1.0/tests/test_threatintel.py +395 -0
kubedelos-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
kubedelos-0.1.0/NOTICE
ADDED
kubedelos-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kubedelos
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Scan the container images running in a Kubernetes cluster with Trivy
|
|
5
|
+
Author: The kubedelos Authors
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/k8s-servant/kubedelos
|
|
8
|
+
Project-URL: Issues, https://github.com/k8s-servant/kubedelos/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/k8s-servant/kubedelos/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Security, https://github.com/k8s-servant/kubedelos/security/policy
|
|
11
|
+
Keywords: kubernetes,trivy,security,vulnerability,container-images,cli
|
|
12
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
License-File: NOTICE
|
|
24
|
+
Requires-Dist: typer<1,>=0.29
|
|
25
|
+
Requires-Dist: pydantic<3,>=2.14
|
|
26
|
+
Requires-Dist: pydantic-settings<3,>=2.16
|
|
27
|
+
Requires-Dist: kubernetes<38,>=37
|
|
28
|
+
Requires-Dist: pyyaml<7,>=6.0
|
|
29
|
+
Requires-Dist: httpx<1,>=0.28
|
|
30
|
+
Requires-Dist: platformdirs<5,>=4.14
|
|
31
|
+
Requires-Dist: fastapi<1,>=0.162
|
|
32
|
+
Requires-Dist: jinja2<4,>=3.1
|
|
33
|
+
Requires-Dist: uvicorn<1,>=0.54
|
|
34
|
+
Requires-Dist: apscheduler<4,>=3.11
|
|
35
|
+
Requires-Dist: mcp<3,>=2.3
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest<10,>=9; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov<8,>=7; extra == "dev"
|
|
39
|
+
Requires-Dist: ruff<1,>=0.17; extra == "dev"
|
|
40
|
+
Requires-Dist: pre-commit<5,>=4; extra == "dev"
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
|
|
43
|
+
# kubedelos
|
|
44
|
+
|
|
45
|
+
Scan the container images running in a Kubernetes cluster with Trivy, from a local web UI.
|
|
46
|
+
|
|
47
|
+
Status: pre-alpha. Interfaces and output may change.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pipx install kubedelos # or: uv tool install kubedelos
|
|
51
|
+
kubedelos ui
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`kubedelos ui` opens a local web UI against your current kube-context. Start a scan on the Scans page: kubedelos lists
|
|
55
|
+
the images running in the cluster (read-only, never reading Secrets), scans each unique image once with a pinned,
|
|
56
|
+
checksum-verified Trivy, and keeps every run in a local SQLite database. The dashboard shows:
|
|
57
|
+
|
|
58
|
+
- the Critical and High findings that have a fix, grouped by fix or by image;
|
|
59
|
+
- the images worst hit, and the images that failed to scan, with a registry login hint;
|
|
60
|
+
- the change since the last comparable run.
|
|
61
|
+
|
|
62
|
+
Trivy does the scanning and kubedelos doesn't replace it; kubedelos is for what comes after the report, across a whole
|
|
63
|
+
cluster and over time. An in-cluster mode with scheduled scans and reports to namespace owners is next on the roadmap.
|
|
64
|
+
|
|
65
|
+
Documentation, configuration and compatibility: <https://github.com/k8s-servant/kubedelos#readme>
|
|
66
|
+
|
|
67
|
+
kubedelos is built on [Trivy](https://github.com/aquasecurity/trivy), an open source scanner by Aqua Security, licensed
|
|
68
|
+
under Apache-2.0. kubedelos is an independent project, not affiliated with or endorsed by Aqua Security.
|
|
69
|
+
|
|
70
|
+
License: Apache-2.0
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# kubedelos
|
|
2
|
+
|
|
3
|
+
[](https://github.com/k8s-servant/kubedelos/actions/workflows/ci.yml)
|
|
4
|
+
[](https://scorecard.dev/viewer/?uri=github.com/k8s-servant/kubedelos)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
Scan the container images running in a Kubernetes cluster with Trivy.
|
|
8
|
+
|
|
9
|
+
Status: pre-alpha. Interfaces and output may change.
|
|
10
|
+
|
|
11
|
+
<picture>
|
|
12
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/images/dashboard-dark.png">
|
|
13
|
+
<img alt="The kubedelos dashboard: counts per severity, the worst images and the fix-first list ordered by risk score" src="docs/images/dashboard-light.png">
|
|
14
|
+
</picture>
|
|
15
|
+
|
|
16
|
+
## Why kubedelos
|
|
17
|
+
|
|
18
|
+
[Trivy](https://github.com/aquasecurity/trivy) does the scanning, and kubedelos doesn't replace it: `trivy image` and
|
|
19
|
+
`trivy k8s` tell you what is vulnerable right now. kubedelos is for what comes after that report, across a whole cluster
|
|
20
|
+
and over time:
|
|
21
|
+
|
|
22
|
+
- **What actually runs.** It lists the images running in the cluster, including init and ephemeral containers, CronJobs
|
|
23
|
+
and workloads scaled to zero. Access is read-only and Secrets are not read (in `serve`, except opt-in pod pull
|
|
24
|
+
secrets, see below). Each unique image is scanned once per platform.
|
|
25
|
+
- **What to fix first.** The dashboard puts the Critical and High findings that have a fix on top, grouped by fix or by
|
|
26
|
+
image and ordered by a risk score that weighs exposure and known exploitation, with the images worst hit and the
|
|
27
|
+
images that failed to scan, plus a hint on which registry to log in to.
|
|
28
|
+
- **What changed.** Every run is kept in a local SQLite database, so the dashboard shows the change since the last
|
|
29
|
+
comparable run, and the findings of any earlier run can be opened again.
|
|
30
|
+
- **One command, nothing to install in the cluster.** `kubedelos ui` opens a local web UI against your current
|
|
31
|
+
kube-context. There is no operator, CRD or host app such as Lens or Headlamp to set up first.
|
|
32
|
+
- **Cheap repeat scans.** Results are cached by image, so a rescan only scans what changed.
|
|
33
|
+
- **Careful by default.** Trivy is pinned and checksum-verified, never "latest", and registry tokens are never written
|
|
34
|
+
to disk or logs.
|
|
35
|
+
|
|
36
|
+
kubedelos doesn't gate CI pipelines: Trivy already does that well. The in-cluster mode is installed with Helm and
|
|
37
|
+
has scheduled scans and the same UI for each cluster; reports sent to each namespace's owners by email, Slack or Teams
|
|
38
|
+
are next on the roadmap.
|
|
39
|
+
|
|
40
|
+
## Quickstart
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pipx install git+https://github.com/k8s-servant/kubedelos # after the first release: pipx install kubedelos
|
|
44
|
+
kubedelos ui
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`kubedelos ui` opens a local web UI against your current kube-context. Start a scan on the Scans page: kubedelos lists
|
|
48
|
+
the workloads in the cluster, scans each unique image once with Trivy, and shows the results on the dashboard. Owners
|
|
49
|
+
are read from the `kubedelos.io/owner-email` namespace annotation. [Install](docs/install.md) has the requirements, the
|
|
50
|
+
cluster permissions, uv and the Helm chart.
|
|
51
|
+
|
|
52
|
+

|
|
53
|
+
|
|
54
|
+
## Contents
|
|
55
|
+
|
|
56
|
+
- [Documentation](#documentation)
|
|
57
|
+
- [Local web UI](#local-web-ui)
|
|
58
|
+
- [In a cluster](#in-a-cluster)
|
|
59
|
+
- [What gets scanned](#what-gets-scanned)
|
|
60
|
+
- [What to fix first](#what-to-fix-first)
|
|
61
|
+
- [Ask your agent](#ask-your-agent)
|
|
62
|
+
- [Configuration](#configuration)
|
|
63
|
+
- [Compatibility](#compatibility)
|
|
64
|
+
- [Trivy](#trivy)
|
|
65
|
+
- [Private registries](#private-registries)
|
|
66
|
+
- [Contributing and security](#contributing-and-security)
|
|
67
|
+
- [License](#license)
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
The [documentation index](docs/README.md) lists every guide. The main ones:
|
|
72
|
+
|
|
73
|
+
| Guide | For |
|
|
74
|
+
|---|---|
|
|
75
|
+
| [Install](docs/install.md) | Installing on your machine or in a cluster, permissions, upgrading and uninstalling |
|
|
76
|
+
| [The local web UI](docs/ui.md) | What each page shows |
|
|
77
|
+
| [Configuration](docs/configuration.md) | Every `KUBEDELOS_*` setting |
|
|
78
|
+
| [Running kubedelos in a cluster](docs/in-cluster.md) | The Helm chart, exposing the UI and the security model |
|
|
79
|
+
| [How a scan works](docs/how-scans-work.md) | What a scan reads, downloads and keeps, and tuning a slow scan |
|
|
80
|
+
| [Risk score](docs/risk-score.md) and [attack-surface facts](docs/attack-surface.md) | Why the fix-first list is in that order |
|
|
81
|
+
| [Ask your agent](docs/mcp.md) | `kubedelos mcp` for Claude Code, VS Code Copilot and others |
|
|
82
|
+
|
|
83
|
+
## Local web UI
|
|
84
|
+
|
|
85
|
+
`kubedelos ui` serves a web UI over the scan data in your local SQLite database, and starts scans of any context in
|
|
86
|
+
your kubeconfig. It listens on loopback only and prints a URL with a token:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
kubedelos ui # http://127.0.0.1:9370/?token=...
|
|
90
|
+
kubedelos ui --port 9400 --no-browser
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The dashboard shows the latest run with the change since the previous comparable one, the fix-first list, the worst
|
|
94
|
+
images and the images that failed to scan. Other pages list and filter the findings (with a CSV download), rank
|
|
95
|
+
namespaces, compare two runs, print a report, keep an accepted risk register, start and follow scans, and show where a
|
|
96
|
+
scan's time went. Add `?run_id=N` to pin a page to one run. [The local web UI](docs/ui.md) describes every page and how
|
|
97
|
+
to use it on a remote machine over SSH.
|
|
98
|
+
|
|
99
|
+
## In a cluster
|
|
100
|
+
|
|
101
|
+
`kubedelos serve`, installed with the Helm chart, serves the UI of one cluster, sweeps it on a cron schedule and keeps
|
|
102
|
+
the results:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
helm install kubedelos oci://ghcr.io/k8s-servant/charts/kubedelos --set clusterName=my-cluster
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The chart runs one hardened replica with a volume for the data, a read-only ClusterRole and a NetworkPolicy, and the
|
|
109
|
+
image bundles the pinned Trivy. Until the first release, [Install](docs/install.md#in-a-cluster) shows how to install it
|
|
110
|
+
from a clone.
|
|
111
|
+
|
|
112
|
+
**Anyone who can reach `serve` can read the whole vulnerability inventory, and by default can also write**: start
|
|
113
|
+
scans within the configured scope, retry or cancel them, and accept or revoke risks. Set `readOnly: true`, put it
|
|
114
|
+
behind an authenticating proxy, or keep it cluster-internal. [Running kubedelos in a cluster](docs/in-cluster.md) has
|
|
115
|
+
every value, the security model, how to expose the UI and how to verify the signed image and chart with cosign; [an
|
|
116
|
+
example](docs/exposure-oauth2-proxy-envoy-gateway.md) puts it behind oauth2-proxy and Envoy Gateway.
|
|
117
|
+
|
|
118
|
+
## What gets scanned
|
|
119
|
+
|
|
120
|
+
A scan covers the images of running pods, including init and ephemeral containers, plus the pod templates of CronJobs
|
|
121
|
+
and of Deployments and StatefulSets scaled to zero. Namespaces, namespace and pod label selectors and image exclusions
|
|
122
|
+
narrow it, and OS packages, application libraries or both can be scanned. Results are cached for 24 hours by image
|
|
123
|
+
digest, so a repeat scan only scans what changed. A namespace or resource kubedelos may not list is skipped with a
|
|
124
|
+
warning and the run is marked incomplete, never clean. [How a scan works](docs/how-scans-work.md) explains each step,
|
|
125
|
+
the caches and DBs, parallelism, time limits and how to speed up a slow scan.
|
|
126
|
+
|
|
127
|
+
## What to fix first
|
|
128
|
+
|
|
129
|
+
Severity alone ranks a Critical CVE in a pod nothing can reach above a High one that attackers already exploit, in a pod
|
|
130
|
+
on the internet with a cluster-admin token. So kubedelos gives each finding a risk score from 0 to 100: severity, plus
|
|
131
|
+
points for known exploitation (CISA KEV and EPSS), how far the workload is exposed, whether it can reach the node and
|
|
132
|
+
what its ServiceAccount may do. The fix-first lists are ordered by it, the findings page sorts by it (`sort=risk`), and
|
|
133
|
+
each score comes with the factors behind it. Missing facts count as unknown, never as safe. See [Risk
|
|
134
|
+
score](docs/risk-score.md).
|
|
135
|
+
|
|
136
|
+
The exposure, host access and rights come from the [attack-surface facts](docs/attack-surface.md) each scan records per
|
|
137
|
+
workload container, from list calls only and without reading a Secret. The two threat feeds are downloaded at most once
|
|
138
|
+
a day with plain GETs that send nothing about the cluster. `KUBEDELOS_ATTACK_SURFACE=false` and
|
|
139
|
+
`KUBEDELOS_THREAT_FEEDS=false` turn them off.
|
|
140
|
+
|
|
141
|
+
<picture>
|
|
142
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/images/fix-first-dark.png">
|
|
143
|
+
<img alt="The fix-first list with its top fix opened: risk 73 from critical +40, EPSS 0.88 +15, external +15 and root unknown +3, and the images it affects" src="docs/images/fix-first-light.png">
|
|
144
|
+
</picture>
|
|
145
|
+
|
|
146
|
+
## Ask your agent
|
|
147
|
+
|
|
148
|
+
`kubedelos mcp` is a read-only MCP server over stdio, so the agent you already use (Claude Code, VS Code Copilot) can
|
|
149
|
+
answer "what should I fix first in my-cluster?" from your local scan results. It never reaches the cluster, calls no
|
|
150
|
+
LLM and needs no API key: `claude mcp add kubedelos -- kubedelos mcp`. See [Ask your agent](docs/mcp.md).
|
|
151
|
+
|
|
152
|
+
## Configuration
|
|
153
|
+
|
|
154
|
+
Settings come from `KUBEDELOS_*` environment variables, such as `KUBEDELOS_NAMESPACES`, `KUBEDELOS_PARALLELISM` and
|
|
155
|
+
`KUBEDELOS_PKG_TYPES`; list variables take a JSON list:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
KUBEDELOS_NAMESPACES='["team-a","team-b"]' kubedelos ui
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
[Configuration](docs/configuration.md) lists every setting with its default, and the UI's Settings page shows the ones
|
|
162
|
+
in use and where each value came from.
|
|
163
|
+
|
|
164
|
+
## Compatibility
|
|
165
|
+
|
|
166
|
+
| Area | Supported | Notes |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| Python | 3.12, 3.13, 3.14 | Each is tested in CI. |
|
|
169
|
+
| Runs on | Linux and macOS, amd64 and arm64 | Windows is not supported. |
|
|
170
|
+
| Trivy | v0.76.1, pinned and checksum-verified | `KUBEDELOS_TRIVY_PATH` runs your own binary; its results are not cached. |
|
|
171
|
+
| Kubernetes | 1.35, tested on kind | Read-only `list` calls on stable APIs only: `v1` namespaces, pods and nodes, `apps/v1` Deployments and StatefulSets, `batch/v1` CronJobs. Secrets are not read, except the opt-in pod pull secrets of `serve` (`get` on `secrets` in the namespaces you list). |
|
|
172
|
+
| Image platforms | Linux images | Tested on `linux/arm64` nodes. Windows nodes' images are scanned for their own platform but are untested. |
|
|
173
|
+
| Registries | Public registries, and private ones through your Docker credentials | Tested with Docker Hub and `registry.k8s.io`. See [Private registries](#private-registries) for ACR, Artifact Registry and ECR logins. |
|
|
174
|
+
|
|
175
|
+
Managed clusters (AKS, EKS, GKE) are not yet verified; they come with the in-cluster mode.
|
|
176
|
+
|
|
177
|
+
## Trivy
|
|
178
|
+
|
|
179
|
+
kubedelos runs a pinned Trivy release (v0.76.1) as one standalone process per image, sharing one locked DB cache. It runs on Linux and macOS (amd64 and arm64); Windows is not supported. `kubedelos trivy install` downloads it
|
|
180
|
+
and checks it against an embedded SHA-256. It never resolves "latest". Set `KUBEDELOS_TRIVY_PATH` to bring your own binary; it must be Trivy v0.54.0 or later, the first with
|
|
181
|
+
`--pkg-types`, or every image fails. Results from your own binary are not cached and the run records its Trivy version as `custom`.
|
|
182
|
+
|
|
183
|
+
kubedelos is built on [Trivy](https://github.com/aquasecurity/trivy), an open source scanner by Aqua Security,
|
|
184
|
+
licensed under Apache-2.0. kubedelos is an independent project, not affiliated with or endorsed by Aqua Security.
|
|
185
|
+
|
|
186
|
+
## Private registries
|
|
187
|
+
|
|
188
|
+
kubedelos uses the Docker credentials you already have (`DOCKER_CONFIG` or `~/.docker/config.json`, including
|
|
189
|
+
credential helpers), so log in the way you normally would, for example `docker login registry.example` or
|
|
190
|
+
`az acr login --name myregistry`. `kubedelos registry test registry.example/team/app:1.2.3` checks access to one image,
|
|
191
|
+
and when images fail registry auth in a scan, the dashboard names the registry to log in to. See
|
|
192
|
+
[Install](docs/install.md#private-registries).
|
|
193
|
+
|
|
194
|
+
In a cluster, `kubedelos serve` reads private registries with a cloud workload identity, mounted Docker config Secrets
|
|
195
|
+
and, if you opt in, the pull secrets of the pods it scans:
|
|
196
|
+
|
|
197
|
+
- [Azure Container Registry from AKS](docs/registries/acr.md)
|
|
198
|
+
- [Amazon ECR from EKS](docs/registries/ecr.md)
|
|
199
|
+
- [Google Artifact Registry from GKE](docs/registries/gar.md)
|
|
200
|
+
- [Pull secrets and Docker configs](docs/registries/pull-secrets.md)
|
|
201
|
+
|
|
202
|
+
## Contributing and security
|
|
203
|
+
|
|
204
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) to build and test kubedelos, and [SECURITY.md](SECURITY.md) to report a
|
|
205
|
+
vulnerability privately.
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
Apache-2.0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# kubedelos
|
|
2
|
+
|
|
3
|
+
Scan the container images running in a Kubernetes cluster with Trivy, from a local web UI.
|
|
4
|
+
|
|
5
|
+
Status: pre-alpha. Interfaces and output may change.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pipx install kubedelos # or: uv tool install kubedelos
|
|
9
|
+
kubedelos ui
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`kubedelos ui` opens a local web UI against your current kube-context. Start a scan on the Scans page: kubedelos lists
|
|
13
|
+
the images running in the cluster (read-only, never reading Secrets), scans each unique image once with a pinned,
|
|
14
|
+
checksum-verified Trivy, and keeps every run in a local SQLite database. The dashboard shows:
|
|
15
|
+
|
|
16
|
+
- the Critical and High findings that have a fix, grouped by fix or by image;
|
|
17
|
+
- the images worst hit, and the images that failed to scan, with a registry login hint;
|
|
18
|
+
- the change since the last comparable run.
|
|
19
|
+
|
|
20
|
+
Trivy does the scanning and kubedelos doesn't replace it; kubedelos is for what comes after the report, across a whole
|
|
21
|
+
cluster and over time. An in-cluster mode with scheduled scans and reports to namespace owners is next on the roadmap.
|
|
22
|
+
|
|
23
|
+
Documentation, configuration and compatibility: <https://github.com/k8s-servant/kubedelos#readme>
|
|
24
|
+
|
|
25
|
+
kubedelos is built on [Trivy](https://github.com/aquasecurity/trivy), an open source scanner by Aqua Security, licensed
|
|
26
|
+
under Apache-2.0. kubedelos is an independent project, not affiliated with or endorsed by Aqua Security.
|
|
27
|
+
|
|
28
|
+
License: Apache-2.0
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Run the CLI with ``python -m kubedelos``, the same entry point as the ``kubedelos`` console script.
|
|
2
|
+
|
|
3
|
+
The guard keeps a plain import of this module (by a tool that walks the package, say) from running the CLI.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from kubedelos.cli import app
|
|
7
|
+
|
|
8
|
+
if __name__ == "__main__":
|
|
9
|
+
app()
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Pure helpers that turn stored run facts into the labels and numbers the UI shows.
|
|
2
|
+
|
|
3
|
+
No SQL and no I/O live here, so the rules (what counts as a whole-cluster run, when a run is stale, how a scope reads to
|
|
4
|
+
a person) are testable on their own and shared by every page.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from datetime import datetime, timedelta
|
|
8
|
+
|
|
9
|
+
STALE_AFTER = timedelta(hours=24)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def is_cluster_scope(scope: dict | None) -> bool:
|
|
13
|
+
"""True for a run that covered the whole cluster; mirrors ``store.queries.CLUSTER_SCOPE_SQL``.
|
|
14
|
+
|
|
15
|
+
Exclusions do not narrow a scope, but an explicit namespace list or a selector does. A run with no recorded scope
|
|
16
|
+
is never treated as whole-cluster.
|
|
17
|
+
"""
|
|
18
|
+
if scope is None:
|
|
19
|
+
return False
|
|
20
|
+
return not scope.get("namespaces") and scope.get("namespace_selector") is None and scope.get("selector") is None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def describe_scope(scope: dict | None) -> str:
|
|
24
|
+
if scope is None:
|
|
25
|
+
return "scope not recorded"
|
|
26
|
+
parts: list[str] = []
|
|
27
|
+
if is_cluster_scope(scope):
|
|
28
|
+
parts.append("whole cluster")
|
|
29
|
+
else:
|
|
30
|
+
namespaces = scope.get("namespaces") or []
|
|
31
|
+
if len(namespaces) == 1:
|
|
32
|
+
parts.append(f"namespace {namespaces[0]}")
|
|
33
|
+
elif namespaces:
|
|
34
|
+
parts.append(f"namespaces {', '.join(namespaces)}")
|
|
35
|
+
if scope.get("namespace_selector") is not None:
|
|
36
|
+
parts.append(f"namespaces matching {scope['namespace_selector']}")
|
|
37
|
+
if scope.get("selector") is not None:
|
|
38
|
+
parts.append(f"pods matching {scope['selector']}")
|
|
39
|
+
if scope.get("exclude_namespaces"):
|
|
40
|
+
parts.append(f"excluding namespaces {', '.join(scope['exclude_namespaces'])}")
|
|
41
|
+
if scope.get("exclude_images"):
|
|
42
|
+
parts.append(f"excluding images {', '.join(scope['exclude_images'])}")
|
|
43
|
+
return ", ".join(parts)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def describe_pkg_types(pkg_types: str | None) -> str:
|
|
47
|
+
if pkg_types is None:
|
|
48
|
+
return "package types not recorded"
|
|
49
|
+
kinds = set(pkg_types.split(","))
|
|
50
|
+
if kinds == {"library", "os"}:
|
|
51
|
+
return "os + library packages"
|
|
52
|
+
if kinds == {"os"}:
|
|
53
|
+
return "OS packages only"
|
|
54
|
+
if kinds == {"library"}:
|
|
55
|
+
return "library packages only"
|
|
56
|
+
return pkg_types
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def ago(then: datetime, now: datetime) -> str:
|
|
60
|
+
seconds = (now - then).total_seconds()
|
|
61
|
+
if seconds < 60:
|
|
62
|
+
return "just now"
|
|
63
|
+
if seconds < 3600:
|
|
64
|
+
return f"{int(seconds // 60)} min ago"
|
|
65
|
+
hours = int(seconds // 3600)
|
|
66
|
+
if hours < 48:
|
|
67
|
+
return f"{hours} h ago"
|
|
68
|
+
return f"{hours // 24} days ago"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def is_stale(finished_at: datetime | None, now: datetime) -> bool:
|
|
72
|
+
return finished_at is None or now - finished_at > STALE_AFTER
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def delta(current: int, previous: int | None) -> int | None:
|
|
76
|
+
return None if previous is None else current - previous
|