Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 136 additions & 0 deletions config/base/crd/metal.datumapis.com.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,143 @@ spec:
type: object
properties:
phase: {type: string}
resolvedImage:
type: object
required: [name, digest]
properties:
name: {type: string, minLength: 1}
digest: {type: string, pattern: '^sha256:[a-f0-9]{64}$'}
completedAt: {type: string, format: date-time}
conditions:
type: array
items: {type: object, x-kubernetes-preserve-unknown-fields: true}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machineimages.metal.datumapis.com
annotations:
discovery.miloapis.com/parent-contexts: Project
spec:
group: metal.datumapis.com
names: {kind: MachineImage, listKind: MachineImageList, plural: machineimages, singular: machineimage, shortNames: [mimg]}
scope: Namespaced
versions:
- name: v1alpha1
served: true
storage: true
subresources: {status: {}}
additionalPrinterColumns:
- {name: Availability, type: string, jsonPath: .spec.availability}
schema:
openAPIV3Schema:
type: object
properties:
apiVersion: {type: string}
kind: {type: string}
metadata: {type: object}
spec:
type: object
x-kubernetes-validations:
- rule: >-
(has(self.definition) && !has(self.source) && has(self.availability)) ||
(!has(self.definition) && has(self.source) && !has(self.availability))
message: an image is either a provider definition with an availability or a published source reference
- rule: >-
has(self.definition) == has(oldSelf.definition) &&
(!has(self.definition) || self.definition == oldSelf.definition) &&
(!has(self.source) || self.source == oldSelf.source)
message: an image's definition and source are immutable
properties:
definition:
type: object
required: [family, version, architecture, firmwareModes, digest]
properties:
family: {type: string, minLength: 1, maxLength: 63}
version: {type: string, minLength: 1, maxLength: 63}
architecture: {type: string, minLength: 1, maxLength: 63}
firmwareModes:
type: array
minItems: 1
maxItems: 2
x-kubernetes-list-type: set
items: {type: string, enum: [UEFI, BIOS]}
bootstrapFormats:
type: array
maxItems: 1
x-kubernetes-list-type: set
items: {type: string, enum: [NoCloud]}
digest: {type: string, pattern: '^sha256:[a-f0-9]{64}$'}
source:
type: object
required: [publisherRef, name]
properties:
publisherRef:
type: object
required: [kind, name]
x-kubernetes-validations:
- rule: '(self.kind == "Project" && has(self.apiGroup) && self.apiGroup == "resourcemanager.miloapis.com") || (self.kind == "Namespace" && (!has(self.apiGroup) || self.apiGroup == ""))'
message: a publisher is a Milo Project or a standalone Namespace
properties:
apiGroup: {type: string}
kind: {type: string, minLength: 1}
name: {type: string, minLength: 1}
name: {type: string, minLength: 1}
availability: {type: string, enum: [Available, Withdrawn]}
status:
type: object
properties:
resolved: {type: object, x-kubernetes-preserve-unknown-fields: true}
conditions:
type: array
items: {type: object, x-kubernetes-preserve-unknown-fields: true}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machineimagepublications.metal.datumapis.com
annotations:
discovery.miloapis.com/parent-contexts: Project
spec:
group: metal.datumapis.com
names: {kind: MachineImagePublication, listKind: MachineImagePublicationList, plural: machineimagepublications, singular: machineimagepublication}
scope: Namespaced
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
apiVersion: {type: string}
kind: {type: string}
metadata: {type: object}
spec:
type: object
x-kubernetes-validations:
- {rule: 'self == oldSelf', message: a publication record is immutable}
required: [consumerRef, image, source, digest]
properties:
consumerRef:
type: object
required: [kind, name]
x-kubernetes-validations:
- rule: '(self.kind == "Project" && has(self.apiGroup) && self.apiGroup == "resourcemanager.miloapis.com") || (self.kind == "Namespace" && (!has(self.apiGroup) || self.apiGroup == ""))'
message: a consumer is a Milo Project or a standalone Namespace
properties:
apiGroup: {type: string}
kind: {type: string, minLength: 1}
name: {type: string, minLength: 1}
image:
type: object
required: [namespace, name]
properties:
namespace: {type: string, minLength: 1}
name: {type: string, minLength: 1}
source:
type: object
required: [name]
properties:
name: {type: string, minLength: 1}
digest: {type: string, pattern: '^sha256:[a-f0-9]{64}$'}
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,14 @@ spec:
digest:
type: string
pattern: ^sha256:[0-9a-f]{64}$
firmwareModes:
type: array
maxItems: 2
items:
type: string
enum:
- UEFI
- BIOS
downloads:
type: array
maxItems: 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ resources:
- machinecapacity.yaml
- machineallocation.yaml
- installation.yaml
- machineimage.yaml
- machineimagepublication.yaml
14 changes: 14 additions & 0 deletions config/components/iam/protected-resources/machineimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: iam.miloapis.com/v1alpha1
kind: ProtectedResource
metadata:
name: metal.datumapis.com-machineimage
spec:
serviceRef:
name: metal.datumapis.com
kind: MachineImage
plural: machineimages
singular: machineimage
permissions: [list, get, watch, create, update, patch, delete, updateStatus, use]
parentResources:
- apiGroup: resourcemanager.miloapis.com
kind: Project
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: iam.miloapis.com/v1alpha1
kind: ProtectedResource
metadata:
name: metal.datumapis.com-machineimagepublication
spec:
serviceRef:
name: metal.datumapis.com
kind: MachineImagePublication
plural: machineimagepublications
singular: machineimagepublication
permissions: [list, get, watch, create, delete]
parentResources:
- apiGroup: resourcemanager.miloapis.com
kind: Project
1 change: 1 addition & 0 deletions config/components/iam/roles/claimant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
includedPermissions:
- metal.datumapis.com/machineclasses.use
- metal.datumapis.com/machineprofiles.use
- metal.datumapis.com/machineimages.use
- metal.datumapis.com/machines.create
- metal.datumapis.com/machines.update
- metal.datumapis.com/machines.patch
Expand Down
1 change: 1 addition & 0 deletions config/components/iam/roles/consumer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
- metal.datumapis.com/machineprofiles.patch
- metal.datumapis.com/machineprofiles.delete
- metal.datumapis.com/machineprofiles.use
- metal.datumapis.com/machineimages.use
- metal.datumapis.com/machines.create
- metal.datumapis.com/machines.update
- metal.datumapis.com/machines.patch
Expand Down
4 changes: 4 additions & 0 deletions config/components/iam/roles/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ spec:
- metal.datumapis.com/machineallocations.patch
- metal.datumapis.com/machineallocations.updateStatus
- metal.datumapis.com/installations.updateStatus
# Admission resolves an image through its publication record.
- metal.datumapis.com/machineimagepublications.list
- metal.datumapis.com/machineimagepublications.get
- metal.datumapis.com/machineimagepublications.watch
8 changes: 8 additions & 0 deletions config/components/iam/roles/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ spec:
- metal.datumapis.com/machineprofiles.patch
- metal.datumapis.com/machineprofiles.delete
- metal.datumapis.com/machineprofiles.use
- metal.datumapis.com/machineimages.list
- metal.datumapis.com/machineimages.get
- metal.datumapis.com/machineimages.watch
- metal.datumapis.com/machineimages.create
- metal.datumapis.com/machineimages.update
- metal.datumapis.com/machineimages.patch
- metal.datumapis.com/machineimages.delete
- metal.datumapis.com/machineimages.use
- metal.datumapis.com/machinecapacities.list
- metal.datumapis.com/machinecapacities.get
- metal.datumapis.com/machinecapacities.watch
Expand Down
12 changes: 12 additions & 0 deletions config/components/iam/roles/publisher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,15 @@ spec:
- metal.datumapis.com/machineprofiles.patch
- metal.datumapis.com/machineprofiles.delete
- metal.datumapis.com/machineprofiles.updateStatus
# Publishing an image writes the consumer copy and the provider's
# publication record. Unpublishing deletes both, which is also how a
# publication is repaired after its copy or source is recreated.
# Customers hold no write on either kind.
- metal.datumapis.com/machineimages.create
- metal.datumapis.com/machineimages.update
- metal.datumapis.com/machineimages.patch
- metal.datumapis.com/machineimages.delete
- metal.datumapis.com/machineimages.updateStatus
- metal.datumapis.com/machineimagepublications.get
- metal.datumapis.com/machineimagepublications.create
- metal.datumapis.com/machineimagepublications.delete
3 changes: 3 additions & 0 deletions config/components/iam/roles/viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ spec:
- metal.datumapis.com/installations.list
- metal.datumapis.com/installations.get
- metal.datumapis.com/installations.watch
- metal.datumapis.com/machineimages.list
- metal.datumapis.com/machineimages.get
- metal.datumapis.com/machineimages.watch
2 changes: 1 addition & 1 deletion config/site/base/enrollment.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"fleet-provider/synthetic-device-central-01": {"bmcEndpoint": "https://[2001:db8::51]", "systemUUID": "00000000-0000-4000-8000-000000000051", "bootMACAddress": "52:54:00:77:00:02", "bmcPublicKeySHA256": "5151515151515151515151515151515151515151515151515151515151515151", "disks": ["disk-0"], "hardware": {"cpu": {"architecture": "amd64", "cores": 2}, "memory": "2Gi", "disks": [{"name": "disk-0", "capacity": "2Gi"}], "interfaces": [{"name": "primary", "macAddress": "52:54:00:77:00:02"}]}}}
{"fleet-provider/synthetic-device-central-01": {"bmcEndpoint": "https://[2001:db8::51]", "systemUUID": "00000000-0000-4000-8000-000000000051", "bootMACAddress": "52:54:00:77:00:02", "bmcPublicKeySHA256": "5151515151515151515151515151515151515151515151515151515151515151", "disks": ["disk-0"], "hardware": {"bootMode": "BIOS", "cpu": {"architecture": "amd64", "cores": 2}, "memory": "2Gi", "disks": [{"name": "disk-0", "capacity": "2Gi"}], "interfaces": [{"name": "primary", "macAddress": "52:54:00:77:00:02"}]}}}
18 changes: 16 additions & 2 deletions config/standalone/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ spec:
bmc: {endpoint: "https://[2001:db8::21]"}
interfaces: [{name: primary, macAddress: "02:00:00:00:00:21"}]
---
# The provider's one image release. The allocate phase publishes it into the
# first consumer namespace, which stands in for a consumer project.
apiVersion: metal.datumapis.com/v1alpha1
kind: MachineImage
metadata: {name: debian-12, namespace: fleet-provider}
spec:
definition:
family: debian
version: "12"
architecture: amd64
firmwareModes: [UEFI]
digest: "sha256:9f4ad8d8b8a6f6fc64d2cf2c7e70b9184b74f089adf8c36d84f4fcb99892f3cb"
availability: Available
---
# The synthetic site overwrites its one disk and reads it back, so the
# fixture policy claims only Clear.
apiVersion: fleet.datumapis.com/v1alpha1
Expand Down Expand Up @@ -82,12 +96,12 @@ metadata: {name: debian-12, namespace: fleet-project-a}
spec:
machineRef: {name: allocation}
expectedPredecessor: {type: None}
imageRef: {name: "debian-12@sha256:9f4ad8d8b8a6f6fc64d2cf2c7e70b9184b74f089adf8c36d84f4fcb99892f3cb"}
imageRef: {name: debian-12}
---
apiVersion: metal.datumapis.com/v1alpha1
kind: Installation
metadata: {name: debian-12-reinstall, namespace: fleet-project-a}
spec:
machineRef: {name: allocation}
expectedPredecessor: {type: Installation, name: debian-12}
imageRef: {name: "debian-12@sha256:9f4ad8d8b8a6f6fc64d2cf2c7e70b9184b74f089adf8c36d84f4fcb99892f3cb"}
imageRef: {name: debian-12}
21 changes: 21 additions & 0 deletions config/standalone/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ rules:
- apiGroups: [fleet.datumapis.com]
resources: [deviceinstallations]
verbs: [get, list, create]
# As the provider's publisher, it reads the image it publishes and records
# each publication; as the provider, it resolves images through them.
- apiGroups: [metal.datumapis.com]
resources: [machineimages]
resourceNames: [debian-12]
verbs: [get]
- apiGroups: [metal.datumapis.com]
resources: [machineimagepublications]
verbs: [get, create, delete]
- apiGroups: [fleet.datumapis.com]
resources: [devices, devicecustodies, devicecommissionings, devicecommissioningplans, devicecommissioningplanapprovals]
verbs: [get, list]
Expand All @@ -64,6 +73,18 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: {name: fleet-synthetic-consumer-writer, namespace: fleet-project-a}
rules:
# The publisher's copy of the provider image.
- apiGroups: [metal.datumapis.com]
resources: [machineimages]
verbs: [create]
- apiGroups: [metal.datumapis.com]
resources: [machineimages]
resourceNames: [debian-12]
verbs: [get]
- apiGroups: [metal.datumapis.com]
resources: [machineimages/status]
resourceNames: [debian-12]
verbs: [get, update]
- apiGroups: [metal.datumapis.com]
resources: [machines]
resourceNames: [allocation]
Expand Down
2 changes: 1 addition & 1 deletion config/standalone/site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ kind: ConfigMap
metadata: {name: fleet-simulator-enrollment, namespace: fleet-system}
data:
enrollment.json: |
{"fleet-provider/synthetic-device-central-01": {"bmcEndpoint": "https://[2001:db8::21]", "systemUUID": "00000000-0000-4000-8000-000000000021", "bootMACAddress": "02:00:00:00:00:21", "bmcPublicKeySHA256": "2121212121212121212121212121212121212121212121212121212121212121", "disks": ["disk-0"], "hardware": {"cpu": {"architecture": "amd64", "model": "synthetic", "sockets": 2, "cores": 24}, "memory": "128Gi", "disks": [{"name": "disk-0", "capacity": "960Gi"}], "interfaces": [{"name": "primary", "macAddress": "02:00:00:00:00:21"}]}, "firmware": [{"component": "BMC", "version": "synthetic-1.0"}]}}
{"fleet-provider/synthetic-device-central-01": {"bmcEndpoint": "https://[2001:db8::21]", "systemUUID": "00000000-0000-4000-8000-000000000021", "bootMACAddress": "02:00:00:00:00:21", "bmcPublicKeySHA256": "2121212121212121212121212121212121212121212121212121212121212121", "disks": ["disk-0"], "hardware": {"bootMode": "UEFI", "cpu": {"architecture": "amd64", "model": "synthetic", "sockets": 2, "cores": 24}, "memory": "128Gi", "disks": [{"name": "disk-0", "capacity": "960Gi"}], "interfaces": [{"name": "primary", "macAddress": "02:00:00:00:00:21"}]}, "firmware": [{"component": "BMC", "version": "synthetic-1.0"}]}}
---
# The custody coordinator: the only writer of custody and of operation
# status. It delivers admitted operations to the simulator site and reports
Expand Down
6 changes: 6 additions & 0 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ smoke and both multi-plane runs verify it. The end-to-end failure scenarios
The [power kind's control plane](device-custody.md#device-power-operations)
is implemented on the same custody, and nothing creates power operations yet.

[OS images and bootstrap data](machine-images.md) has its image catalog
**implemented**: a provider-published, digest-pinned `MachineImage` that
admission resolves through a publication record and checks against the
server's architecture and firmware mode. The sealed bootstrap store is
proposed.

The opt-in [multi-plane acceptance harness](../operations/multiplane.md) composes
the [local VM site](../operations/local-vm.md) with native Milo project APIs, the
custody coordinator, and actual Karmada delivery. On the selected cell the site
Expand Down
Loading
Loading