Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Add hosted tenant runtime contract reconcile command
rcourtmanb577164a1d77
diff --git a/cmd/pulse-control-plane/main.go b/cmd/pulse-control-plane/main.goindex 3c972de5ea..8a20616b29 100644--- a/cmd/pulse-control-plane/main.go+++ b/cmd/pulse-control-plane/main.go@@ -45,6 +45,7 @@ func newTenantRuntimeCmd() *cobra.Command {Short: "Operate on hosted tenant runtime containers",}cmd.AddCommand(newTenantRuntimeRolloutCmd())+ cmd.AddCommand(newTenantRuntimeReconcileCmd())return cmd}@@ -101,6 +102,140 @@ func newTenantRuntimeRolloutCmd() *cobra.Command {return cmd}+func newTenantRuntimeReconcileCmd() *cobra.Command {+ var tenantIDs []string+ var all bool+ var dryRun bool+ var runID string+ var snapshotRoot string+ var healthTimeout time.Duration+ var prunePrevious bool++ cmd := &cobra.Command{+ Use: "reconcile",+ Short: "Reconcile hosted tenant runtime contract drift without changing each tenant's image line",+ RunE: func(cmd *cobra.Command, args []string) error {+ cfg, err := cloudcp.LoadConfig()+ if err != nil {+ return fmt.Errorf("load control plane config: %w", err)+ }+ plan, err := cloudcp.PlanTenantRuntimeContractReconcile(cmd.Context(), cfg, cloudcp.TenantRuntimeContractReconcilePlanOptions{+ TenantIDs: tenantIDs,+ All: all,+ })+ if err != nil {+ return err+ }++ if dryRun {+ printTenantRuntimeReconcilePlan(plan)+ return nil+ }++ rolloutCount := 0+ noopCount := 0+ skipCount := 0+ failureCount := 0+ for _, item := range plan.Tenants {+ if item == nil {+ continue+ }+ switch item.Action {+ case "skip":+ skipCount+++ fmt.Printf("tenant_id=%s\nstatus=skip\nreason=%s\n\n", item.TenantID, item.Reason)+ continue+ case "noop":+ noopCount+++ fmt.Printf("tenant_id=%s\nstatus=noop\nimage_ref=%s\nreason=%s\n\n", item.TenantID, item.ImageRef, item.Reason)+ continue+ }++ result, err := cloudcp.RolloutTenantRuntime(cmd.Context(), cfg, cloudcp.TenantRuntimeRolloutOptions{+ TenantID: item.TenantID,+ Image: item.ImageRef,+ RunID: runID,+ SnapshotRoot: snapshotRoot,+ HealthTimeout: healthTimeout,+ PrunePrevious: prunePrevious,+ })+ if err != nil {+ failureCount+++ fmt.Printf("tenant_id=%s\nstatus=error\nimage_ref=%s\nerror=%v\n\n", item.TenantID, item.ImageRef, err)+ continue+ }+ rolloutCount+++ fmt.Printf("tenant_id=%s\nstatus=rolled\nactive_container_id=%s\nactive_image_ref=%s\nactive_image_id=%s\nreconciled_only=%t\n",+ result.TenantID,+ result.ActiveContainerID,+ result.ActiveImageRef,+ result.ActiveImageID,+ result.ReconciledOnly,+ )+ if result.PreviousContainerID != "" {+ fmt.Printf("previous_container_id=%s\n", result.PreviousContainerID)+ }+ if result.BackupContainerName != "" {+ fmt.Printf("backup_container_name=%s\n", result.BackupContainerName)+ }+ fmt.Println()+ }++ fmt.Printf("summary_rollout=%d\nsummary_noop=%d\nsummary_skip=%d\nsummary_error=%d\n", rolloutCount, noopCount, skipCount, failureCount)+ if failureCount > 0 {+ return fmt.Errorf("%d tenant runtime reconciles failed", failureCount)+ }+ return nil+ },+ }+ cmd.Flags().StringArrayVar(&tenantIDs, "tenant-id", nil, "Hosted tenant ID to reconcile (repeatable)")+ cmd.Flags().BoolVar(&all, "all", false, "Reconcile all registered tenants")+ cmd.Flags().BoolVar(&dryRun, "dry-run", false, "Print the reconcile plan without mutating tenant runtimes")+ cmd.Flags().StringVar(&runID, "run-id", "", "Operator-visible reconcile run identifier")+ cmd.Flags().StringVar(&snapshotRoot, "snapshot-root", "", "Override tenant snapshot root (default: <CP_DATA_DIR>/backups/rollout)")+ cmd.Flags().DurationVar(&healthTimeout, "health-timeout", 90*time.Second, "How long to wait for the target runtime to become healthy")+ cmd.Flags().BoolVar(&prunePrevious, "prune-previous", false, "Remove the preserved pre-rollout container after success")+ return cmd+}++func printTenantRuntimeReconcilePlan(plan *cloudcp.TenantRuntimeContractReconcilePlan) {+ if plan == nil {+ fmt.Println("summary_total=0")+ return+ }+ rolloutCount := 0+ noopCount := 0+ skipCount := 0+ for _, item := range plan.Tenants {+ if item == nil {+ continue+ }+ switch item.Action {+ case "rollout":+ rolloutCount+++ case "noop":+ noopCount+++ default:+ skipCount+++ }+ fmt.Printf("tenant_id=%s\naction=%s\nreason=%s\n", item.TenantID, item.Action, item.Reason)+ if item.LiveContainerID != "" {+ fmt.Printf("live_container_id=%s\n", item.LiveContainerID)+ }+ if item.ImageRef != "" {+ fmt.Printf("image_ref=%s\n", item.ImageRef)+ }+ if item.LiveRouteHost != "" || item.DesiredRouteHost != "" {+ fmt.Printf("live_route_host=%s\ndesired_route_host=%s\n", item.LiveRouteHost, item.DesiredRouteHost)+ }+ if item.LivePublicURL != "" || item.DesiredPublicURL != "" {+ fmt.Printf("live_public_url=%s\ndesired_public_url=%s\n", item.LivePublicURL, item.DesiredPublicURL)+ }+ fmt.Println()+ }+ fmt.Printf("summary_rollout=%d\nsummary_noop=%d\nsummary_skip=%d\nsummary_total=%d\n", rolloutCount, noopCount, skipCount, len(plan.Tenants))+}+func init() {rootCmd.AddCommand(versionCmd)rootCmd.AddCommand(newTenantRuntimeCmd())diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex fbb0137be1..1fabdc009a 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -79,7 +79,7 @@ server-side update execution surfaces.5. Add or change local dev-runtime orchestration, managed ownership, browser-runtime proof wiring, frontend/backend coherence diagnostics, canonical developer entry wrappers, or dev-runtime helper control surfaces through `scripts/hot-dev.sh`, `scripts/hot-dev-bg.sh`, `Makefile`, `package.json`, `frontend-modern/package.json`, `scripts/dev-check.sh`, `scripts/toggle-mock.sh`, `scripts/clean-mock-alerts.sh`, `scripts/dev-launchd-setup.sh`, `scripts/dev-launchd-wrapper.sh`, `scripts/com.pulse.hot-dev.plist.template`, `tests/integration/scripts/managed-dev-runtime.mjs`, `tests/integration/playwright.config.ts`, `tests/integration/tests/helpers.ts`, `tests/integration/tests/runtime-defaults.ts`, `tests/integration/README.md`, and `tests/integration/QUICK_START.md`6. Add or change governed release-promotion workflow inputs, operator-facing promotion metadata, artifact publication lineage enforcement, or stable-promotion rehearsal summaries through `.github/workflows/create-release.yml`, `.github/workflows/helm-pages.yml`, `.github/workflows/publish-docker.yml`, `.github/workflows/publish-helm-chart.yml`, `.github/workflows/promote-floating-tags.yml`, `.github/workflows/release-dry-run.yml`, `.github/workflows/update-demo-server.yml`, `docs/releases/V6_PRERELEASE_RUNBOOK.md`, `scripts/check-workflow-dispatch-inputs.py`, `scripts/trigger-release.sh`, and `scripts/trigger-release-dry-run.sh`7. Preserve release-matched installer and Helm operator documentation links through `scripts/install.sh`, `.github/workflows/helm-pages.yml`, `.github/workflows/publish-helm-chart.yml`, and the chart metadata itself so deployment guidance and packaged chart metadata do not drift back to branch-tip `main` docs when a release line or promoted tag already exists.-8. Add or change operator-facing hosted tenant runtime canary rollout, canonical hosted route/public URL generation, or control-plane runtime-registry reconciliation through `cmd/pulse-control-plane/main.go`, `internal/cloudcp/docker/manager.go`, `internal/cloudcp/docker/labels.go`, and `internal/cloudcp/tenant_runtime_rollout.go`+8. Add or change operator-facing hosted tenant runtime canary rollout, batch runtime contract reconciliation, canonical hosted route/public URL generation, or control-plane runtime-registry reconciliation through `cmd/pulse-control-plane/main.go`, `internal/cloudcp/docker/manager.go`, `internal/cloudcp/docker/labels.go`, and `internal/cloudcp/tenant_runtime_rollout.go`## Forbidden Paths@@ -210,6 +210,13 @@ route host and `PULSE_PUBLIC_URL`, keep that addressing lowercase-safe formixed-case tenant IDs, and treat same-image runtime routing drift as rolloutdrift that requires a canonical recreate rather than silently reconciling theregistry against stale Traefik labels or runtime env.+That same operator boundary also owns fleet remediation of that runtime+contract. `cmd/pulse-control-plane/main.go` and+`internal/cloudcp/tenant_runtime_rollout.go` must expose one canonical+batch-reconcile path that preserves each tenant runtime's current image line,+supports dry-run planning before mutation, and converges existing hosted+tenants onto the canonical runtime contract without relying on ad hoc host+scripts or one-off manual tenant loops.That same rule applies to live runtime behavior too: config loading and reloadwatching may not treat `mock.env` as a parallel primary-path control surface.Supported mock-mode runtime state must come from the canonical `.env` contract,diff --git a/internal/cloudcp/tenant_runtime_rollout.go b/internal/cloudcp/tenant_runtime_rollout.goindex 418c0069c1..b21de3e236 100644--- a/internal/cloudcp/tenant_runtime_rollout.go+++ b/internal/cloudcp/tenant_runtime_rollout.go@@ -45,8 +45,36 @@ type TenantRuntimeRolloutResult struct {ReconciledOnly bool}+type TenantRuntimeContractReconcilePlanOptions struct {+ TenantIDs []string+ All bool+}++type TenantRuntimeContractReconcilePlanItem struct {+ TenantID string+ LiveContainerID string+ ImageRef string+ LiveRouteHost string+ DesiredRouteHost string+ LivePublicURL string+ DesiredPublicURL string+ Action string+ Reason string+}++type TenantRuntimeContractReconcilePlan struct {+ Tenants []*TenantRuntimeContractReconcilePlanItem+}++const (+ tenantRuntimeContractActionNoop = "noop"+ tenantRuntimeContractActionRollout = "rollout"+ tenantRuntimeContractActionSkip = "skip"+)+type tenantRuntimeRolloutRegistry interface {Get(tenantID string) (*registry.Tenant, error)+ List() ([]*registry.Tenant, error)Update(t *registry.Tenant) error}@@ -93,18 +121,45 @@ func RolloutTenantRuntime(ctx context.Context, cfg *CPConfig, opts TenantRuntime}opts.Image = image+ service, cleanup, err := newTenantRuntimeRolloutServiceFromConfig(cfg, image)+ if err != nil {+ return nil, err+ }+ defer cleanup()+ return service.Rollout(ctx, opts)+}++func PlanTenantRuntimeContractReconcile(+ ctx context.Context,+ cfg *CPConfig,+ opts TenantRuntimeContractReconcilePlanOptions,+) (*TenantRuntimeContractReconcilePlan, error) {+ service, cleanup, err := newTenantRuntimeRolloutServiceFromConfig(cfg, strings.TrimSpace(cfg.PulseImage))+ if err != nil {+ return nil, err+ }+ defer cleanup()+ return service.PlanContractReconcile(ctx, opts)+}++func newTenantRuntimeRolloutServiceFromConfig(+ cfg *CPConfig,+ image string,+) (*tenantRuntimeRolloutService, func(), error) {+ if cfg == nil {+ return nil, nil, fmt.Errorf("control plane config is required")+ }if err := os.MkdirAll(cfg.TenantsDir(), 0o755); err != nil {- return nil, fmt.Errorf("ensure tenants dir: %w", err)+ return nil, nil, fmt.Errorf("ensure tenants dir: %w", err)}if err := os.MkdirAll(cfg.ControlPlaneDir(), 0o755); err != nil {- return nil, fmt.Errorf("ensure control-plane dir: %w", err)+ return nil, nil, fmt.Errorf("ensure control-plane dir: %w", err)}reg, err := registry.NewTenantRegistry(cfg.ControlPlaneDir())if err != nil {- return nil, fmt.Errorf("open tenant registry: %w", err)+ return nil, nil, fmt.Errorf("open tenant registry: %w", err)}- defer reg.Close()dockerMgr, err := cpDocker.NewManager(cpDocker.ManagerConfig{Image: image,@@ -116,10 +171,14 @@ func RolloutTenantRuntime(ctx context.Context, cfg *CPConfig, opts TenantRuntimeCPUShares: cfg.TenantCPUShares,})if err != nil {- return nil, fmt.Errorf("create docker manager: %w", err)+ _ = reg.Close()+ return nil, nil, fmt.Errorf("create docker manager: %w", err)}- defer dockerMgr.Close()+ cleanup := func() {+ _ = dockerMgr.Close()+ _ = reg.Close()+ }service := &tenantRuntimeRolloutService{registry: reg,docker: dockerMgr,@@ -130,7 +189,7 @@ func RolloutTenantRuntime(ctx context.Context, cfg *CPConfig, opts TenantRuntimehealthTimeout: defaultTenantRuntimeRolloutHealthTimeout,healthPoll: defaultTenantRuntimeRolloutHealthPoll,}- return service.Rollout(ctx, opts)+ return service, cleanup, nil}// Rollout performs the tenant runtime rollout or a drift reconciliation if the@@ -325,6 +384,113 @@ func tenantRuntimeMatchesContract(return live.RouteHost == desiredRouting.Host && live.PublicURL == desiredRouting.PublicURL}+func (s *tenantRuntimeRolloutService) PlanContractReconcile(+ ctx context.Context,+ opts TenantRuntimeContractReconcilePlanOptions,+) (*TenantRuntimeContractReconcilePlan, error) {+ if s == nil {+ return nil, fmt.Errorf("rollout service is nil")+ }+ tenants, err := s.selectContractReconcileTenants(opts)+ if err != nil {+ return nil, err+ }+ plan := &TenantRuntimeContractReconcilePlan{+ Tenants: make([]*TenantRuntimeContractReconcilePlanItem, 0, len(tenants)),+ }+ for _, tenant := range tenants {+ item := &TenantRuntimeContractReconcilePlanItem{+ TenantID: strings.TrimSpace(tenant.ID),+ }+ live, err := s.resolveLiveContainer(ctx, tenant)+ if err != nil {+ item.Action = tenantRuntimeContractActionSkip+ item.Reason = err.Error()+ plan.Tenants = append(plan.Tenants, item)+ continue+ }+ item.LiveContainerID = strings.TrimSpace(live.ID)+ item.ImageRef = strings.TrimSpace(live.ImageRef)+ item.LiveRouteHost = strings.TrimSpace(live.RouteHost)+ item.LivePublicURL = strings.TrimSpace(live.PublicURL)++ desiredRouting := s.docker.DesiredRuntimeRouting(tenant.ID)+ item.DesiredRouteHost = desiredRouting.Host+ item.DesiredPublicURL = desiredRouting.PublicURL++ if item.ImageRef == "" {+ item.Action = tenantRuntimeContractActionSkip+ item.Reason = "live runtime image reference is empty"+ plan.Tenants = append(plan.Tenants, item)+ continue+ }++ if tenantRuntimeMatchesContract(live, tenantRuntimeContainerName(tenant.ID), item.ImageRef, desiredRouting) {+ item.Action = tenantRuntimeContractActionNoop+ item.Reason = "runtime already matches canonical hosted contract"+ } else {+ item.Action = tenantRuntimeContractActionRollout+ item.Reason = "runtime contract drift detected"+ }+ plan.Tenants = append(plan.Tenants, item)+ }+ return plan, nil+}++func (s *tenantRuntimeRolloutService) selectContractReconcileTenants(+ opts TenantRuntimeContractReconcilePlanOptions,+) ([]*registry.Tenant, error) {+ if s == nil {+ return nil, fmt.Errorf("rollout service is nil")+ }+ if opts.All && len(dedupeNonEmptyStrings(opts.TenantIDs)) > 0 {+ return nil, fmt.Errorf("choose either --all or one or more tenant ids")+ }+ if opts.All {+ tenants, err := s.registry.List()+ if err != nil {+ return nil, fmt.Errorf("list tenants: %w", err)+ }+ return tenants, nil+ }++ tenantIDs := dedupeNonEmptyStrings(opts.TenantIDs)+ if len(tenantIDs) == 0 {+ return nil, fmt.Errorf("at least one tenant id or --all is required")+ }++ tenants := make([]*registry.Tenant, 0, len(tenantIDs))+ for _, tenantID := range tenantIDs {+ tenant, err := s.registry.Get(tenantID)+ if err != nil {+ return nil, fmt.Errorf("load tenant %s: %w", tenantID, err)+ }+ if tenant == nil {+ tenants = append(tenants, ®istry.Tenant{ID: tenantID})+ continue+ }+ tenants = append(tenants, tenant)+ }+ return tenants, nil+}++func dedupeNonEmptyStrings(values []string) []string {+ result := make([]string, 0, len(values))+ seen := make(map[string]struct{}, len(values))+ for _, value := range values {+ value = strings.TrimSpace(value)+ if value == "" {+ continue+ }+ if _, ok := seen[value]; ok {+ continue+ }+ seen[value] = struct{}{}+ result = append(result, value)+ }+ return result+}+func (s *tenantRuntimeRolloutService) resolveLiveContainer(ctx context.Context, tenant *registry.Tenant) (*cpDocker.RuntimeContainerInfo, error) {if tenant == nil {return nil, fmt.Errorf("tenant is nil")diff --git a/internal/cloudcp/tenant_runtime_rollout_test.go b/internal/cloudcp/tenant_runtime_rollout_test.goindex c7b76322d6..c0536203f6 100644--- a/internal/cloudcp/tenant_runtime_rollout_test.go+++ b/internal/cloudcp/tenant_runtime_rollout_test.go@@ -305,6 +305,98 @@ func TestTenantRuntimeRollout_RecreatesSameImageWhenRoutingContractDrifts(t *tes}}+func TestTenantRuntimeContractReconcilePlan_AllTenantsClassifiesNoopRolloutAndSkip(t *testing.T) {+ tenantNoop := ®istry.Tenant{ID: "t-NOOP12345", ContainerID: "noop-live"}+ tenantDrift := ®istry.Tenant{ID: "t-Drift1234", ContainerID: "drift-live"}+ tenantMissing := ®istry.Tenant{ID: "t-MISSING01", ContainerID: ""}+ reg := &fakeTenantRuntimeRolloutRegistry{+ tenant: tenantNoop,+ tenants: []*registry.Tenant{tenantNoop, tenantDrift, tenantMissing},+ }+ docker := newFakeTenantRuntimeRolloutDocker()+ routingNoop := docker.DesiredRuntimeRouting(tenantNoop.ID)+ routingDrift := docker.DesiredRuntimeRouting(tenantDrift.ID)+ docker.addContainer(&cpDocker.RuntimeContainerInfo{+ ID: "noop-live",+ Name: tenantRuntimeContainerName(tenantNoop.ID),+ ImageRef: "pulse-runtime:stable",+ ImageID: "sha256:stable",+ Running: true,+ RouteHost: routingNoop.Host,+ PublicURL: routingNoop.PublicURL,+ })+ docker.addContainer(&cpDocker.RuntimeContainerInfo{+ ID: "drift-live",+ Name: tenantRuntimeContainerName(tenantDrift.ID),+ ImageRef: "pulse-runtime:stable",+ ImageID: "sha256:stable",+ Running: true,+ RouteHost: "t-Drift1234.cloud.pulserelay.pro",+ PublicURL: "https://t-Drift1234.cloud.pulserelay.pro",+ })++ service := newTestTenantRuntimeRolloutService(reg, docker, &fakeTenantRuntimeRolloutSynchronizer{}, newFakeTenantRuntimeRolloutClock())+ plan, err := service.PlanContractReconcile(context.Background(), TenantRuntimeContractReconcilePlanOptions{All: true})+ if err != nil {+ t.Fatalf("PlanContractReconcile() error = %v", err)+ }+ if len(plan.Tenants) != 3 {+ t.Fatalf("plan tenant count = %d, want 3", len(plan.Tenants))+ }++ got := make(map[string]*TenantRuntimeContractReconcilePlanItem, len(plan.Tenants))+ for _, item := range plan.Tenants {+ got[item.TenantID] = item+ }+ if got[tenantNoop.ID].Action != tenantRuntimeContractActionNoop {+ t.Fatalf("noop tenant action = %q, want %q", got[tenantNoop.ID].Action, tenantRuntimeContractActionNoop)+ }+ if got[tenantDrift.ID].Action != tenantRuntimeContractActionRollout {+ t.Fatalf("drift tenant action = %q, want %q", got[tenantDrift.ID].Action, tenantRuntimeContractActionRollout)+ }+ if got[tenantDrift.ID].DesiredRouteHost != routingDrift.Host {+ t.Fatalf("drift tenant desired route host = %q, want %q", got[tenantDrift.ID].DesiredRouteHost, routingDrift.Host)+ }+ if got[tenantMissing.ID].Action != tenantRuntimeContractActionSkip {+ t.Fatalf("missing tenant action = %q, want %q", got[tenantMissing.ID].Action, tenantRuntimeContractActionSkip)+ }+}++func TestTenantRuntimeContractReconcilePlan_ExplicitTenantIDsDedupesAndPreservesOrder(t *testing.T) {+ tenantA := ®istry.Tenant{ID: "t-EXPLICIT1", ContainerID: "explicit-a"}+ tenantB := ®istry.Tenant{ID: "t-EXPLICIT2", ContainerID: "explicit-b"}+ reg := &fakeTenantRuntimeRolloutRegistry{+ tenant: tenantA,+ tenants: []*registry.Tenant{tenantA, tenantB},+ }+ docker := newFakeTenantRuntimeRolloutDocker()+ for _, tenant := range []*registry.Tenant{tenantA, tenantB} {+ routing := docker.DesiredRuntimeRouting(tenant.ID)+ docker.addContainer(&cpDocker.RuntimeContainerInfo{+ ID: tenant.ContainerID,+ Name: tenantRuntimeContainerName(tenant.ID),+ ImageRef: "pulse-runtime:stable",+ ImageID: "sha256:stable",+ Running: true,+ RouteHost: routing.Host,+ PublicURL: routing.PublicURL,+ })+ }+ service := newTestTenantRuntimeRolloutService(reg, docker, &fakeTenantRuntimeRolloutSynchronizer{}, newFakeTenantRuntimeRolloutClock())+ plan, err := service.PlanContractReconcile(context.Background(), TenantRuntimeContractReconcilePlanOptions{+ TenantIDs: []string{"t-EXPLICIT2", "t-EXPLICIT1", "t-EXPLICIT2", ""},+ })+ if err != nil {+ t.Fatalf("PlanContractReconcile() error = %v", err)+ }+ if len(plan.Tenants) != 2 {+ t.Fatalf("plan tenant count = %d, want 2", len(plan.Tenants))+ }+ if plan.Tenants[0].TenantID != "t-EXPLICIT2" || plan.Tenants[1].TenantID != "t-EXPLICIT1" {+ t.Fatalf("tenant order = [%s %s], want [t-EXPLICIT2 t-EXPLICIT1]", plan.Tenants[0].TenantID, plan.Tenants[1].TenantID)+ }+}+func newTestTenantRuntimeRolloutService(reg tenantRuntimeRolloutRegistry,docker tenantRuntimeRolloutDocker,@@ -329,16 +421,43 @@ func tTempDirForRolloutService() string {type fakeTenantRuntimeRolloutRegistry struct {tenant *registry.Tenant+ tenants []*registry.TenantupdatedTenant registry.TenantupdateCount int}func (f *fakeTenantRuntimeRolloutRegistry) Get(tenantID string) (*registry.Tenant, error) {- if f.tenant == nil || f.tenant.ID != tenantID {- return nil, nil+ if f.tenant != nil && f.tenant.ID == tenantID {+ copy := *f.tenant+ return ©, nil}- copy := *f.tenant- return ©, nil+ for _, tenant := range f.tenants {+ if tenant == nil || tenant.ID != tenantID {+ continue+ }+ copy := *tenant+ return ©, nil+ }+ return nil, nil+}++func (f *fakeTenantRuntimeRolloutRegistry) List() ([]*registry.Tenant, error) {+ if len(f.tenants) == 0 {+ if f.tenant == nil {+ return nil, nil+ }+ copy := *f.tenant+ return []*registry.Tenant{©}, nil+ }+ result := make([]*registry.Tenant, 0, len(f.tenants))+ for _, tenant := range f.tenants {+ if tenant == nil {+ continue+ }+ copy := *tenant+ result = append(result, ©)+ }+ return result, nil}func (f *fakeTenantRuntimeRolloutRegistry) Update(t *registry.Tenant) error {@@ -348,6 +467,20 @@ func (f *fakeTenantRuntimeRolloutRegistry) Update(t *registry.Tenant) error {f.updatedTenant = *tf.updateCount++f.tenant = &f.updatedTenant+ replaced := false+ for i, tenant := range f.tenants {+ if tenant == nil || tenant.ID != t.ID {+ continue+ }+ copy := *t+ f.tenants[i] = ©+ replaced = true+ break+ }+ if !replaced && len(f.tenants) > 0 {+ copy := *t+ f.tenants = append(f.tenants, ©)+ }return nil}