oic-sync 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.
- oic_sync-0.1.0/.gitignore +10 -0
- oic_sync-0.1.0/LICENSE +202 -0
- oic_sync-0.1.0/PKG-INFO +331 -0
- oic_sync-0.1.0/README.md +299 -0
- oic_sync-0.1.0/examples/kubernetes/cronjob.yaml +65 -0
- oic_sync-0.1.0/examples/systemd/oic-sync.service +31 -0
- oic_sync-0.1.0/examples/systemd/oic-sync.timer +11 -0
- oic_sync-0.1.0/pyproject.toml +77 -0
- oic_sync-0.1.0/src/oic_sync/__init__.py +5 -0
- oic_sync-0.1.0/src/oic_sync/__main__.py +3 -0
- oic_sync-0.1.0/src/oic_sync/backends/__init__.py +5 -0
- oic_sync-0.1.0/src/oic_sync/backends/base.py +76 -0
- oic_sync-0.1.0/src/oic_sync/backends/openstack.py +461 -0
- oic_sync-0.1.0/src/oic_sync/backends/proxmox.py +639 -0
- oic_sync-0.1.0/src/oic_sync/cli.py +480 -0
- oic_sync-0.1.0/src/oic_sync/engine.py +331 -0
- oic_sync-0.1.0/src/oic_sync/hashing.py +82 -0
- oic_sync-0.1.0/src/oic_sync/http.py +27 -0
- oic_sync-0.1.0/src/oic_sync/index.py +287 -0
- oic_sync-0.1.0/src/oic_sync/signature.py +115 -0
- oic_sync-0.1.0/tests/conftest.py +54 -0
- oic_sync-0.1.0/tests/fakes.py +596 -0
- oic_sync-0.1.0/tests/test_cli.py +145 -0
- oic_sync-0.1.0/tests/test_engine.py +304 -0
- oic_sync-0.1.0/tests/test_hashing.py +63 -0
- oic_sync-0.1.0/tests/test_index.py +105 -0
- oic_sync-0.1.0/tests/test_openstack.py +385 -0
- oic_sync-0.1.0/tests/test_proxmox.py +758 -0
- oic_sync-0.1.0/tests/test_signature.py +246 -0
oic_sync-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
oic_sync-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: oic-sync
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Keep openimages.cloud signed cloud images in sync with OpenStack Glance or Proxmox VE
|
|
5
|
+
Project-URL: Homepage, https://openimages.cloud
|
|
6
|
+
Project-URL: Source, https://github.com/open-img-cloud/oic-sync
|
|
7
|
+
Project-URL: Issues, https://github.com/open-img-cloud/oic-sync/issues
|
|
8
|
+
Author: Open Image Cloud
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cloud-images,cosign,glance,openstack,proxmox,pve,qcow2,sigstore
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: System :: Systems Administration
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: httpx<1,>=0.27
|
|
25
|
+
Requires-Dist: sigstore<5,>=4
|
|
26
|
+
Provides-Extra: openstack
|
|
27
|
+
Requires-Dist: openstacksdk>=3.0; extra == 'openstack'
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == 'test'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="https://openimages.cloud">
|
|
35
|
+
<img src="https://openimages.cloud/img/og.png" alt="openimages.cloud: signed, boot-tested cloud images for OpenStack and Proxmox" width="720">
|
|
36
|
+
</a>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<h1 align="center">oic-sync</h1>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://github.com/open-img-cloud/oic-sync/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/open-img-cloud/oic-sync/actions/workflows/ci.yml/badge.svg"></a>
|
|
43
|
+
<a href="https://openimages.cloud/verify/"><img alt="Verifies Sigstore cosign signatures" src="https://img.shields.io/badge/verifies-Sigstore%20cosign-2459c4"></a>
|
|
44
|
+
<a href="LICENSE"><img alt="License Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-555"></a>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<a href="https://openimages.cloud"><b>Website</b></a> ·
|
|
49
|
+
<a href="https://openimages.cloud/images/">Catalog</a> ·
|
|
50
|
+
<a href="https://images.openimages.cloud/index.json">index.json</a> ·
|
|
51
|
+
<a href="https://github.com/open-img-cloud/docs/blob/main/docs/oic-sync.md">Documentation</a> ·
|
|
52
|
+
<a href="https://github.com/open-img-cloud/oic-sync/issues">Report an issue</a>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
Keep the signed cloud images of [openimages.cloud](https://openimages.cloud) in sync with your
|
|
56
|
+
OpenStack Glance or your Proxmox VE node.
|
|
57
|
+
|
|
58
|
+
`oic-sync` reads the catalog index (`https://images.openimages.cloud/index.json`), verifies the
|
|
59
|
+
cosign signature of each image, imports the versions your cloud does not have yet, gives the
|
|
60
|
+
newest one a stable name ("Debian 13" in Glance, `debian-13` on Proxmox VE) and retires the older
|
|
61
|
+
ones. It keeps no local state and
|
|
62
|
+
can run every day from a systemd timer, a Kubernetes CronJob or a CI job: when everything is up
|
|
63
|
+
to date, it changes nothing.
|
|
64
|
+
|
|
65
|
+
Status: alpha. OpenStack and Proxmox VE (VM templates, tested on Proxmox VE 9.2) are supported,
|
|
66
|
+
see [Proxmox VE](#proxmox-ve).
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
# OpenStack: the backend needs openstacksdk, an optional extra
|
|
72
|
+
pipx install 'oic-sync[openstack]'
|
|
73
|
+
# or the container image (signed with cosign, OpenStack backend included)
|
|
74
|
+
docker run --rm -v ~/.config/openstack:/etc/openstack:ro \
|
|
75
|
+
ghcr.io/open-img-cloud/oic-sync openstack status --cloud mycloud
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Python 3.10 or newer. Credentials come from the standard
|
|
79
|
+
[`clouds.yaml`](https://docs.openstack.org/openstacksdk/latest/user/config/configuration.html)
|
|
80
|
+
(`--cloud`), or from `OS_*` environment variables when no cloud is named. An application
|
|
81
|
+
credential restricted to the image service (plus read access to servers and volumes for
|
|
82
|
+
`--delete`) is enough.
|
|
83
|
+
|
|
84
|
+
Proxmox VE: `pipx install oic-sync` on the node itself, see [Proxmox VE](#proxmox-ve).
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
# What the index offers (no cloud needed)
|
|
90
|
+
oic-sync list
|
|
91
|
+
# Verify the cosign signatures of the index (no cloud needed)
|
|
92
|
+
oic-sync verify --image debian-13
|
|
93
|
+
|
|
94
|
+
# Compare a cloud with the index (read only)
|
|
95
|
+
oic-sync openstack status --cloud mycloud
|
|
96
|
+
# Show what a sync would do (read only, signatures verified)
|
|
97
|
+
oic-sync openstack sync --cloud mycloud --image debian-13 --image ubuntu-24.04 --dry-run
|
|
98
|
+
# Do it
|
|
99
|
+
oic-sync openstack sync --cloud mycloud --image debian-13 --image ubuntu-24.04 --keep 2
|
|
100
|
+
# Operator: public images, and remove versions beyond --keep that nothing uses
|
|
101
|
+
oic-sync openstack sync --cloud admin --visibility public --keep 3 --delete
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
| Option | Meaning |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `--image ID` | image to handle, repeatable (default: every image of the index except the service images `octavia-amphora`, `manila-service-image` and `trove-guest-image` and the test image `cirros`) |
|
|
107
|
+
| `--variant NAME` | only this variant of multi-variant images (`--variant uefi` for Alpine) |
|
|
108
|
+
| `--keep N` | versions kept per image, the current one included (default 2) |
|
|
109
|
+
| `--delete` | delete versions beyond `--keep`, only when no instance and no volume uses them |
|
|
110
|
+
| `--visibility` | `private` (default), `shared`, `community` or `public` (operators) |
|
|
111
|
+
| `--dry-run` | read the cloud and verify signatures, change nothing |
|
|
112
|
+
| `--import-method` | `auto` (default), `web-download`, `glance-direct` or `upload` |
|
|
113
|
+
| `--property K=V` | extra or overriding Glance property (the `oic_*` keys are reserved) |
|
|
114
|
+
| `--with-optional-properties` | add `hw_rng_model=virtio` (flavors must allow `hw_rng:allowed`) |
|
|
115
|
+
| `--no-verify-signature` | skip the cosign check (not recommended) |
|
|
116
|
+
| `--index-url URL` | another index (`$OIC_INDEX_URL`), e.g. a mirror |
|
|
117
|
+
| `--cloud`, `--region` | clouds.yaml entry and region (`$OS_CLOUD`) |
|
|
118
|
+
| `--timeout` | seconds to wait for an import to finish (default 3600) |
|
|
119
|
+
|
|
120
|
+
`openstack status --check` exits with 1 when an image is not up to date, for monitoring.
|
|
121
|
+
Exit codes: 0 success, 1 at least one image failed, 2 invalid arguments or index.
|
|
122
|
+
|
|
123
|
+
## How it works
|
|
124
|
+
|
|
125
|
+
For each selected artifact of the index (an image, in one variant):
|
|
126
|
+
|
|
127
|
+
1. **Find.** Our images are found in Glance by their properties: `oic_id` (and `oic_variant`
|
|
128
|
+
for multi-variant images), owned by the current project. `oic_version` and `oic_sha256`
|
|
129
|
+
tell which version each holds. Nothing else is touched.
|
|
130
|
+
2. **Verify.** When the index sha256 is not present yet, the cosign bundle of the artifact is
|
|
131
|
+
verified against that digest, with the signer identity and OIDC issuer published in the
|
|
132
|
+
index (`signing` block): the image must have been signed by an open-img-cloud build
|
|
133
|
+
workflow through GitHub Actions. The image itself is not downloaded for this. A failed
|
|
134
|
+
verification means no import.
|
|
135
|
+
3. **Import.** The image is created hidden (`os_hidden=true`) under a versioned name, with all
|
|
136
|
+
the Glance properties of the index (`os_distro`, `hw_disk_bus`, `hw_firmware_type`...),
|
|
137
|
+
`min_disk` from the virtual size, and the `oic_*` keys. Then:
|
|
138
|
+
- if Glance offers the `web-download` import method (`/v2/info/import`), Glance downloads
|
|
139
|
+
the image itself; the multihash it computes (`os_hash_algo`/`os_hash_value`, sha512 by
|
|
140
|
+
default) must equal the index sha512;
|
|
141
|
+
- otherwise the image is streamed from the CDN to Glance (`PUT /file`), with sha256, sha512
|
|
142
|
+
and size computed on the fly; they must equal the index, and Glance's own multihash is
|
|
143
|
+
checked too. Nothing is written to disk.
|
|
144
|
+
|
|
145
|
+
On any mismatch or failure, the new image is deleted.
|
|
146
|
+
4. **Promote.** The verified image takes the stable name (the image title, "Debian 13", or
|
|
147
|
+
"Alpine Linux (UEFI)" for a variant) and is unhidden.
|
|
148
|
+
5. **Retire.** Older versions are renamed "Debian 13 (13-20261026-2643)" and hidden: they
|
|
149
|
+
leave image lists but stay usable by ID, so existing servers, rebuilds and Terraform states
|
|
150
|
+
keep working.
|
|
151
|
+
6. **Rotate.** The `--keep` newest versions are kept. With `--delete`, older ones are deleted
|
|
152
|
+
when no server (Nova, `image` filter) and no volume (Cinder, `glance_metadata`) uses them;
|
|
153
|
+
when this cannot be determined (no admin view of other projects for a public image), they
|
|
154
|
+
are kept.
|
|
155
|
+
|
|
156
|
+
Failed or abandoned imports of a previous run (status `killed`, or still queued after 6 hours)
|
|
157
|
+
are removed. A run is idempotent: run it twice, the second changes nothing.
|
|
158
|
+
|
|
159
|
+
### Naming and infrastructure as code
|
|
160
|
+
|
|
161
|
+
The stable name moves to each new version. A Terraform or OpenTofu data source that looks an
|
|
162
|
+
image up by name will therefore pick the new image after a sync, which can plan the
|
|
163
|
+
replacement of existing servers. Look images up by property instead, and ignore image changes
|
|
164
|
+
on long-lived servers:
|
|
165
|
+
|
|
166
|
+
```hcl
|
|
167
|
+
data "openstack_images_image_v2" "debian" {
|
|
168
|
+
properties = { oic_id = "debian-13" }
|
|
169
|
+
most_recent = true
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Trust chain
|
|
174
|
+
|
|
175
|
+
The cosign signature covers the sha256 of the qcow2. The streaming upload checks that digest
|
|
176
|
+
directly. With `web-download`, Glance only computes one digest (sha512 by default), which is
|
|
177
|
+
compared with the sha512 of the index: that value comes from the build MANIFEST, fetched over
|
|
178
|
+
HTTPS with the rest of the index, but is not itself covered by the signature. Use
|
|
179
|
+
`--import-method upload` if you want the signed digest checked on every byte.
|
|
180
|
+
|
|
181
|
+
## Proxmox VE
|
|
182
|
+
|
|
183
|
+
`oic-sync proxmox` keeps one VM template per image version on a Proxmox VE node, ready for
|
|
184
|
+
`qm clone`. It runs on the node, as root (like `pveam`), and talks to the local API through
|
|
185
|
+
`pvesh`: no API token, nothing to configure.
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
# On the node (Proxmox VE 9; 8.x with the "import" content type should work)
|
|
189
|
+
apt install pipx
|
|
190
|
+
pipx install oic-sync # no openstacksdk needed
|
|
191
|
+
# Downloads go to the "import" content of a file storage: enable it once
|
|
192
|
+
# (list the content types the storage already has, plus import)
|
|
193
|
+
pvesm set local --content iso,vztmpl,backup,import
|
|
194
|
+
|
|
195
|
+
oic-sync proxmox status
|
|
196
|
+
oic-sync proxmox sync --image debian-13 --image ubuntu-24.04 --dry-run
|
|
197
|
+
oic-sync proxmox sync --image debian-13 --image ubuntu-24.04 --vmid-base 9000
|
|
198
|
+
# Remove versions beyond --keep that no linked clone uses
|
|
199
|
+
oic-sync proxmox sync --image debian-13 --keep 2 --delete
|
|
200
|
+
|
|
201
|
+
# Use a template
|
|
202
|
+
qm clone 9000 120 --name web1 --full 0
|
|
203
|
+
qm set 120 --sshkeys ~/.ssh/id_ed25519.pub
|
|
204
|
+
qm resize 120 scsi0 +20G && qm start 120
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
`--image`, `--variant`, `--keep`, `--delete`, `--dry-run`, `--timeout`, `--index-url` and
|
|
208
|
+
`--no-verify-signature` work as for OpenStack, and `status --check`/`--json` too. Proxmox
|
|
209
|
+
options:
|
|
210
|
+
|
|
211
|
+
| Option | Meaning |
|
|
212
|
+
|---|---|
|
|
213
|
+
| `--node NAME` | node to work on (default: the node named like this host) |
|
|
214
|
+
| `--import-storage` | file storage with the `import` content type, for downloads (default `local`) |
|
|
215
|
+
| `--disk-storage` | storage of the template disks, EFI vars and cloud-init drive (default `local-lvm`) |
|
|
216
|
+
| `--bridge` | bridge of `net0` (default `vmbr0`) |
|
|
217
|
+
| `--vmid-base N` | first VMID for templates, e.g. 9000 (default: the next free VMID of the cluster) |
|
|
218
|
+
| `--memory MIB`, `--cores N` | template hardware (default 2048 MiB, 2 cores) |
|
|
219
|
+
|
|
220
|
+
### What a template looks like
|
|
221
|
+
|
|
222
|
+
The settings are those of the `qm` commands on each image page of the website:
|
|
223
|
+
|
|
224
|
+
- `virtio-scsi-single` controller, `scsi0` imported from the qcow2 (`discard=on`), boot from
|
|
225
|
+
`scsi0`, `virtio` network on the bridge, serial console (`serial0: socket`, `vga: serial0`);
|
|
226
|
+
- cloud-init drive on `ide2`, `ciuser` set to the image login user, `ipconfig0: ip=dhcp`;
|
|
227
|
+
- QEMU guest agent enabled, except for images that do not ship it
|
|
228
|
+
(`hw_qemu_guest_agent=no` in the index, e.g. CirrOS);
|
|
229
|
+
- UEFI images: `bios: ovmf`, `machine: q35` and an `efidisk0` (4m, no pre-enrolled keys);
|
|
230
|
+
- tags `oic` and `oic-<image id>`, and a description with a machine-readable block that
|
|
231
|
+
oic-sync reads back:
|
|
232
|
+
|
|
233
|
+
````
|
|
234
|
+
```oic-sync
|
|
235
|
+
oic_id=debian-13
|
|
236
|
+
vmid=9000
|
|
237
|
+
version=13-20261111-2659
|
|
238
|
+
sha256=...
|
|
239
|
+
imported_at=2026-11-13T09:00:00Z
|
|
240
|
+
import_file=local:import/oic-9000-debian-13-13-20261111-2659-x86_64.qcow2
|
|
241
|
+
source=https://images.openimages.cloud/...
|
|
242
|
+
```
|
|
243
|
+
````
|
|
244
|
+
|
|
245
|
+
Only VMs with these tags and this block are touched. Add your own tags freely: they are kept.
|
|
246
|
+
A clone copies the tags and the description, but its block names another VMID (`vmid=`): clones
|
|
247
|
+
are never touched.
|
|
248
|
+
|
|
249
|
+
### Import, naming and rotation
|
|
250
|
+
|
|
251
|
+
1. **Verify.** The cosign bundle is verified against the index sha256, as for OpenStack.
|
|
252
|
+
2. **Create** the VM shell (not a template yet) with a free VMID.
|
|
253
|
+
3. **Download** the qcow2 with `pvesh create /nodes/<node>/storage/<storage>/download-url
|
|
254
|
+
--content import --checksum <sha256> --checksum-algorithm sha256`: Proxmox checks the
|
|
255
|
+
signed digest itself.
|
|
256
|
+
4. **Import** the disk (`scsi0: <storage>:0,import-from=<file>`) and add the cloud-init drive.
|
|
257
|
+
5. **Convert** to a template, then delete the downloaded file.
|
|
258
|
+
|
|
259
|
+
On any failure, the VM and the downloaded file are removed. VM names must be DNS names: the
|
|
260
|
+
current version is named after the image id (`debian-13`, `alpine-linux-uefi` for a
|
|
261
|
+
variant), older versions `<image id>-<version>` (`debian-13-13-20261026-2643`). Proxmox has no
|
|
262
|
+
hidden flag: retired versions get the tag `oic-retired`. The name `debian-13` moves to the
|
|
263
|
+
newest template at each sync, so automation should look templates up by tag and name at clone
|
|
264
|
+
time; VMs already cloned (linked or full) are not affected by a rename.
|
|
265
|
+
|
|
266
|
+
With `--delete`, a version beyond `--keep` is destroyed only when no VM of the cluster is a
|
|
267
|
+
linked clone of it (a disk referencing its `base-<vmid>-disk-N` volume). An import that never
|
|
268
|
+
became a template (crashed run) is removed after 6 hours, with its downloaded file.
|
|
269
|
+
|
|
270
|
+
### Limitations
|
|
271
|
+
|
|
272
|
+
- One node per run, through the local API (`pvesh`, as root). Run it on each node that needs
|
|
273
|
+
templates on local storage, or once for a shared storage. No remote mode, no API token.
|
|
274
|
+
- VMs only (no LXC templates). qcow2 artifacts only.
|
|
275
|
+
- Tested on Proxmox VE 9.2 with directory storages (qcow2 disks): BIOS and UEFI templates,
|
|
276
|
+
linked clones, rotation, interrupted runs. LVM-thin, ZFS and Ceph disk storages should work
|
|
277
|
+
but have not been tried yet: start with `--dry-run` and a single `--image`, and report issues.
|
|
278
|
+
- Two runs at the same time on one node may import the same version twice: run it from one
|
|
279
|
+
timer only.
|
|
280
|
+
|
|
281
|
+
Daily timer on the node (as root):
|
|
282
|
+
|
|
283
|
+
```ini
|
|
284
|
+
# /etc/systemd/system/oic-sync-proxmox.service
|
|
285
|
+
[Service]
|
|
286
|
+
Type=oneshot
|
|
287
|
+
ExecStart=/root/.local/bin/oic-sync proxmox sync --image debian-13 --vmid-base 9000 --keep 2
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```ini
|
|
291
|
+
# /etc/systemd/system/oic-sync-proxmox.timer
|
|
292
|
+
[Timer]
|
|
293
|
+
OnCalendar=daily
|
|
294
|
+
RandomizedDelaySec=1h
|
|
295
|
+
Persistent=true
|
|
296
|
+
|
|
297
|
+
[Install]
|
|
298
|
+
WantedBy=timers.target
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Run it periodically
|
|
302
|
+
|
|
303
|
+
- systemd: [`examples/systemd/`](examples/systemd/) (service and daily timer)
|
|
304
|
+
- Kubernetes: [`examples/kubernetes/cronjob.yaml`](examples/kubernetes/cronjob.yaml)
|
|
305
|
+
|
|
306
|
+
The index is rebuilt once a day; a daily run is enough.
|
|
307
|
+
|
|
308
|
+
## Development
|
|
309
|
+
|
|
310
|
+
```sh
|
|
311
|
+
python -m venv .venv && . .venv/bin/activate
|
|
312
|
+
pip install -e '.[test]'
|
|
313
|
+
ruff check . && ruff format --check .
|
|
314
|
+
pytest
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
The tests use fakes for Glance, Nova, Cinder, `pvesh` and HTTP: they never talk to a cloud.
|
|
318
|
+
|
|
319
|
+
Layout:
|
|
320
|
+
|
|
321
|
+
- `oic_sync/index.py`: index schema `oic-index/v1`, parsing and selection
|
|
322
|
+
- `oic_sync/signature.py`: cosign bundle verification (sigstore-python)
|
|
323
|
+
- `oic_sync/engine.py`: platform-neutral planning and execution (import, promote, retire, delete)
|
|
324
|
+
- `oic_sync/backends/base.py`: the backend interface
|
|
325
|
+
- `oic_sync/backends/openstack.py`: Glance, Nova and Cinder calls
|
|
326
|
+
- `oic_sync/backends/proxmox.py`: Proxmox VE templates through `pvesh`
|
|
327
|
+
- `oic_sync/hashing.py`: streaming hash reader for uploads
|
|
328
|
+
|
|
329
|
+
## License
|
|
330
|
+
|
|
331
|
+
Apache-2.0
|