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
10 changes: 5 additions & 5 deletions HANDOFF.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ We are deliberately executing a **two-stage operator engineering workflow**:
- Custom Prometheus metrics (`uds_vm_compliance_verified`, `uds_vm_storage_overhead_ratio`, `uds_vm_phase_status`, `uds_vm_reconcile_total`).
- Declarative Grafana dashboard (`dashboards/uds-vm-overview.json`) visualizing fleet telemetry and real-time cATO evidence.
- Updated CI/CD workflow (`.github/workflows/ci.yaml`) with Lula validation and pure Go analysis.
- **v0.5.0 (Phases 5A & 5B) — CDI DataSource Fast Cloning, Persistent `dataDisks`, & Zarf v0.5.0 Bundle (PR #10, PR #11):**
- Added `sourceType: dataSource` (`dataSourceName`, `dataSourceNamespace`) and `spec.dataDisks[]` (`retentionPolicy: Retain|Delete`) with live cross-namespace CoW clone and PVC retention verification on `kubevirt-sandbox`.
- Extended `uds-vmctl prep` with `--golden-image`, `--data-source-name`, and `--data-source-ns`.
- Updated `zarf.yaml` and operator image to `v0.5.0` with `golden-image-datasource` and `fast-clone-vm` components; verified live `zarf package deploy`.
- **v0.5.0 — Golden Images, Persistent `dataDisks`, Zarf v0.5.0 Bundle & `UDSVirtualMachinePool` (PR #10, PR #11, PR #12):**
- **Phase 5A (PR #10):** Added `sourceType: dataSource` (`dataSourceName`, `dataSourceNamespace`) and `spec.dataDisks[]` (`retentionPolicy: Retain|Delete`) with live cross-namespace CoW clone and PVC retention verification on `kubevirt-sandbox`; extended `uds-vmctl prep` with `--golden-image`, `--data-source-name`, and `--data-source-ns`.
- **Phase 5B (PR #11):** Updated `zarf.yaml` and operator image to `v0.5.0` with `golden-image-datasource` (`noWait: true`) and `fast-clone-vm` components; verified live `zarf package deploy`.
- **Phase 5C (PR #12):** Added `UDSVirtualMachinePool` (`udsvmpool`) CRD, `PoolReconciler` (`maxSurge`/`maxUnavailable` rolling fleet updates), `datavolumes/source` RBAC, and `docs/adr/0001`–`0003`; verified live 2-replica rolling update (`f1f8bc544e` $\rightarrow$ `278ee74bbc`) on `kubevirt-sandbox`.

---

## 5. Production Readiness & Roadmap Summary

Milestones [v0.1.0](https://github.com/celttechie/uds-vm-operator/milestone/1) through [v0.4.0](https://github.com/celttechie/uds-vm-operator/milestone/4) are **100% complete**, and **v0.5.0 Phases 5A & 5B** are **complete and live-verified** against the K3s / KubeVirt cluster using Defense Unicorns' toolchain (`zarf`, `lula`, `client-go`). Phase 5C (`UDSVirtualMachinePool` rolling fleet updates and expanded Lula OSCAL rules) is next.
All 5 roadmap milestones ([v0.1.0](https://github.com/celttechie/uds-vm-operator/milestone/1) $\rightarrow$ [v0.2.0](https://github.com/celttechie/uds-vm-operator/milestone/2) $\rightarrow$ [v0.3.0](https://github.com/celttechie/uds-vm-operator/milestone/3) $\rightarrow$ [v0.4.0](https://github.com/celttechie/uds-vm-operator/milestone/4) $\rightarrow$ **v0.5.0**) are **100% complete, tested (48/48 Go unit tests with `-race`), and live-validated** against the K3s / KubeVirt cluster using Defense Unicorns' toolchain (`zarf`, `lula`, `client-go`).

28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# UDS Virtual Machine Operator (`uds-vm-operator`)

[![Go Unit Tests](https://img.shields.io/badge/go%20tests-39%2F39%20passed%20-brightgreen.svg)](pkg/controller/reconciler_test.go)
[![Go Unit Tests](https://img.shields.io/badge/go%20tests-48%2F48%20passed-brightgreen.svg)](pkg/controller/reconciler_test.go)
[![Lula OSCAL](https://img.shields.io/badge/Lula%20OSCAL-100%25%20Satisfied%20(cATO)-brightgreen.svg)](compliance/oscal-component.yaml)
[![Zarf Package](https://img.shields.io/badge/zarf-v0.85%2B%20air--gap-blue.svg)](zarf.yaml)
[![Compliance](https://img.shields.io/badge/NIST%20800--53-SC--7%20%7C%20AC--3%20%7C%20SI--7%20%7C%20IA--5-blue.svg)](compliance/oscal-component.yaml)
[![Upstream CDI PR](https://img.shields.io/badge/CDI%20PR-%234340%20Under%20Review-orange.svg)](https://github.com/kubevirt/containerized-data-importer/pull/4340)
[![Roadmap](https://img.shields.io/badge/Roadmap-v0.5.0%20In%20Progress-purple.svg)](ROADMAP.md)
[![Roadmap](https://img.shields.io/badge/Roadmap-v0.5.0%20Completed-purple.svg)](ROADMAP.md)

An air-gap ready reference implementation and contribution-ready Kubernetes operator declaratively managing secure, NIST 800-53 compliant virtual machines on **KubeVirt** and **Containerized Data Importer (CDI)** within [Defense Unicorns](https://defenseunicorns.com) Unicorn Delivery Service (UDS) environments.

> 📍 **Product Roadmap:** See [ROADMAP.md](ROADMAP.md) for phased capability milestones ([v0.1.0 (Core Operator)](https://github.com/celttechie/uds-vm-operator/milestone/1) $\rightarrow$ [v0.2.0 (Windows Automation)](https://github.com/celttechie/uds-vm-operator/milestone/2) $\rightarrow$ [v0.3.0 (Go CLI & Zarf)](https://github.com/celttechie/uds-vm-operator/milestone/3) $\rightarrow$ [v0.4.0 (Observability & Continuous ATO)](https://github.com/celttechie/uds-vm-operator/milestone/4) $\rightarrow$ [v0.5.0 Architecture Proposal (Golden Images, Rolling Updates & Persistence)](docs/plan-golden-images-rolling-updates-persistence.md)).
> 📍 **Product Roadmap:** See [ROADMAP.md](ROADMAP.md) for phased capability milestones ([v0.1.0 (Core Operator)](https://github.com/celttechie/uds-vm-operator/milestone/1) $\rightarrow$ [v0.2.0 (Windows Automation)](https://github.com/celttechie/uds-vm-operator/milestone/2) $\rightarrow$ [v0.3.0 (Go CLI & Zarf)](https://github.com/celttechie/uds-vm-operator/milestone/3) $\rightarrow$ [v0.4.0 (Observability & Continuous ATO)](https://github.com/celttechie/uds-vm-operator/milestone/4) $\rightarrow$ [v0.5.0 (Golden Images, Rolling Updates & Persistence)](docs/plan-golden-images-rolling-updates-persistence.md)).

---

Expand Down Expand Up @@ -40,7 +40,7 @@ flowchart TD

subgraph Stage2["Phase 2: Production Conversion (Go / controller-runtime)"]
E[pkg/apis/uds/v1alpha1] --> F[pkg/controller/reconciler.go]
F -->|1:1 Parity Unit Tests| G["go test: 33/33 Passing (-race, 74% cov)"]
F -->|1:1 Parity Unit Tests| G["go test: 48/48 Passing (-race)"]
G --> H[cmd/uds-vm-operator/main.go & cmd/uds-vmctl]
H --> I[bin/uds-vm-operator & bin/uds-vmctl]
end
Expand All @@ -60,7 +60,7 @@ flowchart TD
- Preserved in `archive/prototype-kopf/` with 10 passing `pytest` unit tests for historical reference.
2. **Stage 2 — Production Go Controller & CLI (`pkg/` and `cmd/`):**
- Transferred 1:1 into Go using `controller-runtime` and `client-go`.
- Verified with 33 Go unit tests across controller (87.7% cov), CLI (73.7% cov), API types (92.2% cov), and CLI subcommands running with data race detection (`-race`).
- Verified with 48 Go unit tests across controller, pool reconciler, CLI, API types, and CLI subcommands running with data race detection (`-race`).
- Executed live controller takeover (`reconciledBy: "kopf-python"` $\rightarrow$ `reconciledBy: "controller-go"`) with zero VM downtime.

### Architectural Decision Record (ADR): Prototyping in Kopf Before Go Conversion
Expand Down Expand Up @@ -144,7 +144,7 @@ python3 archive/prototype-kopf/vm_prep.py --image /path/to/tactical-sensor.raw -
| **Binary Footprint** | Python runtime + pip dependencies (~150MB) | Single static binary (`bin/uds-vm-operator`, ~55MB) |
| **Memory Footprint** | ~75 MiB RSS | ~28 MiB RSS |
| **Startup / Reconcile Latency** | ~1.5s cold start | < 20ms startup |
| **Unit Test Execution** | `pytest`: 10 tests in ~0.74s (archived) | `go test`: 33 tests in **~1.0s** (`-race`, 74% cov) |
| **Unit Test Execution** | `pytest`: 10 tests in ~0.74s (archived) | `go test`: 48 tests in **~1.1s** (`-race`) |
| **Concurrency / Worker Model** | Asyncio threadpool + periodic timer | Goroutine event loop with client cache & informer |
| **CRD Status Field** | `reconciledBy: "kopf-python"` | `reconciledBy: "controller-go"` |

Expand Down Expand Up @@ -300,7 +300,7 @@ A production-ready declarative dashboard is provided in [`dashboards/uds-vm-over
# Compile both the controller and CLI with embedded git commit & version metadata:
make build

# Run full project unit test suite (39 tests across controller, CLI, API types) with data-race detection:
# Run full project unit test suite (48 tests across controller, pool reconciler, CLI, API types) with data-race detection:
make test

# Run live Defense Unicorns Lula OSCAL compliance validation:
Expand All @@ -314,11 +314,11 @@ make zarf-build

---

## 13. Current Architecture Phase: Golden Images, Rolling Fleet Updates & Storage Persistence (Milestone v0.5.0)
## 13. Enterprise Fleet Management & Golden Images (Milestone v0.5.0 — Completed)

With single-instance air-gap lifecycle verification, Continuous ATO, and Prometheus telemetry validated in `v0.4.0`, **Milestone v0.5.0** transitions the operator to automated enterprise fleet management.

The complete architectural proposal, CRD schemas, and verification matrix are detailed in **[`docs/plan-golden-images-rolling-updates-persistence.md`](docs/plan-golden-images-rolling-updates-persistence.md)**.
The complete architectural proposal, CRD schemas, and verification matrix are detailed in **[`docs/plan-golden-images-rolling-updates-persistence.md`](docs/plan-golden-images-rolling-updates-persistence.md)**, and key architectural choices are recorded in **[`docs/adr/`](docs/adr/)**.

### Architectural Pillars of Milestone v0.5.0:

Expand All @@ -328,12 +328,12 @@ The complete architectural proposal, CRD schemas, and verification matrix are de
2. **Dual Storage Topology (`Phase 5A` — Implemented in PR #10):**
- **Stateless Fleets:** Disposable, immutable virtual machines where the root operating system disk is replaced or destroyed on demand.
- **Stateful Workloads:** Decoupled secondary `spec.dataDisks[]` bound to independent PVCs (`retentionPolicy: Retain` omits `OwnerReferences` so data survives VM recreation).
3. **Zarf v0.5.0 Air-Gap Golden Image Bundle (`Phase 5B` — PR #11):**
- `zarf.yaml` bundles `crds`, `operator:v0.5.0`, `golden-image-datasource`, and `fast-clone-vm` into a single air-gap `.tar.zst` distribution.
4. **Zero-Downtime Rolling Fleet Updates (`Phase 5C` — Planned):**
- Introduction of `UDSVirtualMachinePool` orchestrating coordinated rolling updates across VM instances (`maxSurge: 1`, `maxUnavailable: 0`) with guest readiness verification.
3. **Zarf v0.5.0 Air-Gap Golden Image Bundle (`Phase 5B` — Implemented in PR #11):**
- `zarf.yaml` bundles `crds`, `operator:v0.5.0`, `golden-image-datasource` (`noWait: true`), and `fast-clone-vm` into a single air-gap `.tar.zst` distribution.
4. **Zero-Downtime Rolling Fleet Updates (`Phase 5C` — Implemented in PR #12):**
- `UDSVirtualMachinePool` (`udsvmpool`) and `PoolReconciler` orchestrate coordinated rolling updates across VM instances (`maxSurge: 1`, `maxUnavailable: 0`) with deterministic template revision hashing and readiness-gated draining.

For full architectural diagrams, implementation phases, and test scenarios, review the [Architecture Proposal Document](docs/plan-golden-images-rolling-updates-persistence.md).
For full architectural diagrams, implementation phases, and design rationale, review the [Architecture Proposal Document](docs/plan-golden-images-rolling-updates-persistence.md) and [Architecture Decision Records](docs/adr/).



27 changes: 11 additions & 16 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ gantt
v0.2.0 Windows VM Automation & STIG :done, 2026-11-11, 2026-11-11
v0.3.0 Go CLI (uds-vmctl) & Zarf Pkg :done, 2026-11-11, 2026-11-11
v0.4.0 Lula cATO & Prometheus Metrics :done, 2026-11-11, 2026-11-11
section Planned
v0.5.0 Golden Images, Fleet Updates & Persistence :active, 2026-11-12, 2026-11-30
v0.5.0 Golden Images, Fleet Updates & Persistence :done, 2026-11-12, 2026-11-13
```

---
Expand Down Expand Up @@ -91,28 +90,24 @@ Bridge the gap between Kubernetes orchestration and federal authorization by imp

---

## [Milestone v0.5.0](docs/plan-golden-images-rolling-updates-persistence.md) — Golden Image Caching, Fleet Updates & Storage Persistence (IN PROGRESS)
## [Milestone v0.5.0](docs/plan-golden-images-rolling-updates-persistence.md) — Golden Image Caching, Fleet Updates & Storage Persistence (COMPLETED)

### Objective:
Transition the operator from single-instance validation to automated enterprise fleet management, enabling zero-downtime rolling updates, centralized golden image caching via CDI `DataSource` objects, and stateful storage persistence.

Detailed architectural specifications, CRD schemas, and testing runbooks are maintained in the [Architecture Proposal Document](docs/plan-golden-images-rolling-updates-persistence.md).
Detailed architectural specifications, CRD schemas, and decisions are maintained in the [Architecture Proposal Document](docs/plan-golden-images-rolling-updates-persistence.md) and [Architecture Decision Records](docs/adr/).

### Delivered Capabilities (Phases 5A & 5B):
- **Centralized Image Caching & Fast Copy-on-Write (CoW) Cloning (PR #10):**
### Delivered Capabilities (Phases 5A, 5B & 5C):
- **Centralized Image Caching & Fast Copy-on-Write (CoW) Cloning (Phase 5A, PR #10):**
- Added `sourceType: dataSource` (`dataSourceName`, `dataSourceNamespace`) to `UDSVirtualMachine` and `BuildDataVolume` (`spec.sourceRef`).
- Extended `uds-vmctl prep` with `--golden-image`, `--data-source-name`, and `--data-source-ns` to emit central CDI `DataVolume`/`DataSource` manifests alongside consumer VM manifests.
- Verified live cross-namespace CoW cloning (`uds-golden-images` $\rightarrow$ `default`) on `kubevirt-sandbox`.
- **Dual Storage Topology (`spec.dataDisks[]`, PR #10):**
- **Dual Storage Topology (`spec.dataDisks[]`, Phase 5A, PR #10):**
- Added decoupled secondary `dataDisks` supporting `virtio`/`sata` buses and `retentionPolicy: Retain` vs `Delete` (omitting `OwnerReferences` on retained PVCs so data survives VM deletion).
- **Zarf v0.5.0 Air-Gap Golden Image Bundle (PR #11):**
- Updated `zarf.yaml` to `0.5.0` with `golden-image-datasource` and `fast-clone-vm` components and verified live `zarf package deploy` on `kubevirt-sandbox`.

### Remaining Planned Capabilities (Phase 5C):
- **Zero-Downtime Rolling Fleet Updates (`UDSVirtualMachinePool`):**
- Orchestrate coordinated rolling updates across VM instances (`maxSurge: 1`, `maxUnavailable: 0`).
- Enforce guest readiness verification (QEMU Guest Agent health, application port probes, and answer-script completion) before traffic cutover.
- **Lula OSCAL Updates for DataDisks & DataSources:**
- Extend `compliance/oscal-component.yaml` to validate `DataSource` and retained `dataDisks` compliance.
- **Zarf v0.5.0 Air-Gap Golden Image Bundle (Phase 5B, PR #11):**
- Updated `zarf.yaml` to `0.5.0` with `golden-image-datasource` (`noWait: true`) and `fast-clone-vm` components and verified live `zarf package deploy` on `kubevirt-sandbox`.
- **Zero-Downtime Rolling Fleet Updates (`UDSVirtualMachinePool`, Phase 5C, PR #12):**
- Added `UDSVirtualMachinePool` (`udsvmpool`) CRD and `PoolReconciler` orchestrating coordinated rolling updates (`maxSurge: 1`, `maxUnavailable: 0`) with deterministic template revision hashing and readiness-gated draining.
- Formalized Architecture Decision Records in [`docs/adr/`](docs/adr/) (`0001`, `0002`, `0003`).


2 changes: 1 addition & 1 deletion cmd/uds-vmctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var (
version = "v0.4.0"
version = "v0.5.0"
commit = "none"
date = "unknown"

Expand Down
71 changes: 71 additions & 0 deletions pkg/apis/uds/v1alpha1/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,74 @@ func TestUDSVirtualMachineList_DeepCopy(t *testing.T) {
t.Errorf("expected nil for nilList.DeepCopy()")
}
}

func TestUDSVirtualMachinePool_DeepCopy(t *testing.T) {
rep := int32(2)
surge := int32(1)
unavail := int32(0)
orig := &UDSVirtualMachinePool{
ObjectMeta: metav1.ObjectMeta{Name: "pool-1", Namespace: "default"},
Spec: UDSVirtualMachinePoolSpec{
Replicas: &rep,
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"app": "web"}},
Strategy: RollingUpdateStrategySpec{
Type: "RollingUpdate",
RollingUpdate: &RollingUpdateConfig{
MaxSurge: &surge,
MaxUnavailable: &unavail,
},
},
Template: UDSVirtualMachineTemplateSpec{
Metadata: metav1.ObjectMeta{Labels: map[string]string{"app": "web"}},
Spec: UDSVirtualMachineSpec{
CPUs: 2,
Memory: "2Gi",
Disk: DiskSpec{SourceType: "dataSource", DataSourceName: "golden"},
},
},
},
Status: UDSVirtualMachinePoolStatus{
Conditions: []metav1.Condition{{Type: "Ready", Status: metav1.ConditionTrue}},
},
}

copied := orig.DeepCopy()
if copied == nil || copied.DeepCopyObject() == nil {
t.Fatal("expected non-nil DeepCopy and DeepCopyObject")
}
*copied.Spec.Replicas = 5
*copied.Spec.Strategy.RollingUpdate.MaxSurge = 3
*copied.Spec.Strategy.RollingUpdate.MaxUnavailable = 2
copied.Spec.Selector.MatchLabels["app"] = "db"
copied.Status.Conditions[0].Status = metav1.ConditionFalse

if *orig.Spec.Replicas != 2 || *orig.Spec.Strategy.RollingUpdate.MaxSurge != 1 || *orig.Spec.Strategy.RollingUpdate.MaxUnavailable != 0 {
t.Errorf("pool DeepCopy mutated original pointer fields")
}
if orig.Spec.Selector.MatchLabels["app"] != "web" || orig.Status.Conditions[0].Status != metav1.ConditionTrue {
t.Errorf("pool DeepCopy mutated original selector or conditions")
}

var nilPool *UDSVirtualMachinePool
if nilPool.DeepCopy() != nil || nilPool.DeepCopyObject() != nil {
t.Errorf("expected nil for nil pool DeepCopy")
}
}

func TestUDSVirtualMachinePoolList_DeepCopy(t *testing.T) {
orig := &UDSVirtualMachinePoolList{
Items: []UDSVirtualMachinePool{{ObjectMeta: metav1.ObjectMeta{Name: "p1"}}},
}
copied := orig.DeepCopy()
if copied == nil || copied.DeepCopyObject() == nil {
t.Fatal("expected non-nil pool list DeepCopy")
}
copied.Items[0].Name = "mutated"
if orig.Items[0].Name == "mutated" {
t.Errorf("pool list DeepCopy mutated original")
}
var nilList *UDSVirtualMachinePoolList
if nilList.DeepCopy() != nil || nilList.DeepCopyObject() != nil {
t.Errorf("expected nil for nil pool list DeepCopy")
}
}
Loading
Loading