Overview
Follow-up from PR #7 code review feedback. These are breaking API changes that were deferred from the initial implementation to manage risk properly.
Background
PR #7 implemented the initial FlameCluster CRD. During code review, architectural improvements were identified that require API structural changes. These have been deferred to this follow-up issue to:
- Avoid breaking changes in the initial release
- Allow proper design and migration planning
- Bundle related changes together
Improvements
1. Strong Typing for Resources (Slot)
Current: SessionManagerSpec.Slot is a string ("cpu=1,mem=1g")
Proposed: Use dedicated struct with resource.Quantity fields
type SlotSpec struct {
CPU resource.Quantity `json:"cpu,omitempty"`
Memory resource.Quantity `json:"memory,omitempty"`
GPU resource.Quantity `json:"gpu,omitempty"`
}
Benefits:
- Standard K8s unit handling
- Free validation
- No custom parsing required
2. Secret Management (Storage)
Current: SessionManagerSpec.Storage accepts raw connection string
Proposed: Use SecretKeySelector for credentials
type StorageConfig struct {
Type string `json:"type"`
SecretRef *corev1.SecretKeySelector `json:"secretRef,omitempty"`
Path string `json:"path,omitempty"`
}
Benefits:
- No credentials exposed in CRD
- Standard K8s Secret integration
- Security best practice
⚠️ Security Note: Until this is implemented, users should be aware that storage connection strings are stored in plain text in the CRD.
3. Storage Definition Clarity (ObjectCache)
Current: ObjectCacheSpec.Storage is an ambiguous string
Proposed: Use corev1.VolumeSource for explicit storage configuration
VolumeSource corev1.VolumeSource `json:"volumeSource,omitempty"`
Benefits:
- Clear semantics (EmptyDir vs PVC vs HostPath)
- Standard K8s volume handling
- Explicit persistence guarantees
4. Enum Validation Markers
Current: Shim and Policy are open strings
Proposed: Add kubebuilder validation markers
// +kubebuilder:validation:Enum=host;docker;kubernetes
Shim string `json:"shim,omitempty"`
// +kubebuilder:validation:Enum=priority;fifo;fair
Policy string `json:"policy,omitempty"`
Note: Requires confirmation of supported values.
Acceptance Criteria
Priority
Medium-High - The Secret management improvement is security-critical and should be prioritized.
Related
Overview
Follow-up from PR #7 code review feedback. These are breaking API changes that were deferred from the initial implementation to manage risk properly.
Background
PR #7 implemented the initial FlameCluster CRD. During code review, architectural improvements were identified that require API structural changes. These have been deferred to this follow-up issue to:
Improvements
1. Strong Typing for Resources (Slot)
Current:
SessionManagerSpec.Slotis a string ("cpu=1,mem=1g")Proposed: Use dedicated struct with
resource.QuantityfieldsBenefits:
2. Secret Management (Storage)
Current:
SessionManagerSpec.Storageaccepts raw connection stringProposed: Use
SecretKeySelectorfor credentialsBenefits:
3. Storage Definition Clarity (ObjectCache)
Current:
ObjectCacheSpec.Storageis an ambiguous stringProposed: Use
corev1.VolumeSourcefor explicit storage configurationBenefits:
4. Enum Validation Markers
Current:
ShimandPolicyare open stringsProposed: Add kubebuilder validation markers
Note: Requires confirmation of supported values.
Acceptance Criteria
Priority
Medium-High - The Secret management improvement is security-critical and should be prioritized.
Related