Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

feat: Implement Machine and NixosConfiguration types with kstatus compliance #3

Description

@kitsunoff

⚠️ TDD MANDATORY

Tests MUST be written BEFORE implementation code. No exceptions.

Write unit tests for type validation, default values, and kubebuilder markers FIRST.


Description

Implement Go types for Machine and NixosConfiguration CRDs with full kstatus compliance.

Tasks

Machine Type

  • Write tests for MachineSpec validation (required fields, patterns)
  • Write tests for MachineStatus fields and conditions
  • Implement MachineSpec with fields: host, sshUser, sshKeySecretRef, sshPasswordSecretRef
  • Implement MachineStatus with observedGeneration
  • Add status fields: discoverable, hasConfiguration, appliedConfiguration, appliedCommit, hardwareFacts, nixFacterResult
  • Add standard conditions: Ready, Reconciling, Stalled, Discoverable, HardwareScanned
  • Add kubebuilder markers for validation
  • Add printer columns
  • Verify all tests pass

NixosConfiguration Type

  • Write tests for NixosConfigurationSpec validation
  • Write tests for NixosConfigurationStatus fields and conditions
  • Write tests for OperationState transitions
  • Implement NixosConfigurationSpec with all fields (including jobTemplate)
  • Implement NixosConfigurationStatus with observedGeneration
  • Add OperationState for tracking long-running jobs
  • Add status fields: fullDiskInstallCompleted, appliedCommit, configurationHash, additionalFilesHash
  • Add standard conditions: Ready, Reconciling, Stalled, Applied, GitSynced
  • Add kubebuilder markers for validation
  • Add printer columns
  • Verify all tests pass

Shared Types

  • Write tests for condition helpers
  • Define condition type constants
  • Define reason constants
  • Implement SecretReference type (same-namespace only)
  • Implement MachineReference type
  • Implement AdditionalFile type
  • Implement JobTemplate type for job customization

Architecture Notes

  • Machine addressing: Single host field (IP or hostname) - user provides working address
  • Secret references: Same-namespace only (no cross-namespace) - projected volumes only work within namespace

Reference

See docs/kubebuilder-migration-analysis.md sections 3, 6, 7 for detailed type definitions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions