@@ -75,32 +75,36 @@ type ParameterViewSpec struct {
7575 // +kubebuilder:validation:MinLength=1
7676 FileName string `json:"fileName"`
7777
78- // FileFormat identifies the file format used by the selected config file.
79- // When omitted, the controller resolves it from the referenced template metadata.
80- //
81- // +optional
82- FileFormat CfgFileFormat `json:"fileFormat,omitempty"`
83-
8478 // Mode controls whether edits are allowed to be translated back into ComponentParameter patches.
8579 //
8680 // +kubebuilder:default="ReadWrite"
8781 // +optional
8882 Mode ParameterViewMode `json:"mode,omitempty"`
8983
90- // SourceGeneration captures the ComponentParameter generation used to build the current view.
91- // Controllers should reject stale writes when this value no longer matches the source object.
92- // It is typically populated and refreshed by the controller.
84+ // ResetToLatest requests the controller to discard the current draft in spec.content
85+ // and rebuild it from the latest observed effective content.
9386 //
94- // +optional
95- SourceGeneration int64 `json:"sourceGeneration,omitempty"`
96-
97- // ContentHash optionally captures the effective source content used to build the current view.
98- // It is typically populated and refreshed by the controller.
87+ // This is a reset-style action rather than a git-style rebase:
88+ // 1. the current draft is dropped;
89+ // 2. spec.content is reconstructed from status.latest;
90+ // 3. status.base is advanced to the rebuilt content revision.
9991 //
10092 // +optional
101- ContentHash string `json:"contentHash ,omitempty"`
93+ ResetToLatest bool `json:"resetToLatest ,omitempty"`
10294
103- // Content is the document for the selected file.
95+ // Content is the current user-facing document for the selected file.
96+ //
97+ // Controllers treat Content as the user's current draft:
98+ // 1. on initialization, Content is populated from the effective content and
99+ // status.base and status.latest point to the same revision;
100+ // 2. while status.base and status.latest remain equal, Content is based on the
101+ // latest observed effective content;
102+ // 3. when status.latest advances and Content is still only a projection of
103+ // status.base, the controller may auto-refresh Content and move status.base
104+ // forward to status.latest;
105+ // 4. when Content has diverged into a real user draft, the controller preserves
106+ // it and uses status.base as the draft base when replaying the draft onto
107+ // status.latest or surfacing a conflict.
104108 //
105109 // +optional
106110 Content ParameterViewContent `json:"content,omitempty"`
@@ -127,6 +131,67 @@ type ParameterViewStatus struct {
127131 //
128132 // +optional
129133 Conditions []metav1.Condition `json:"conditions,omitempty"`
134+
135+ // FileFormat identifies the file format used by the selected config file.
136+ // It is resolved and refreshed by the controller from template metadata.
137+ //
138+ // +optional
139+ FileFormat CfgFileFormat `json:"fileFormat,omitempty"`
140+
141+ // Base records the effective content revision that spec.content is currently based on.
142+ // It is the draft base used to decide whether spec.content is still only a
143+ // projection of the source, or whether it has diverged into a real user draft.
144+ //
145+ // +optional
146+ Base ParameterViewRevision `json:"base,omitempty"`
147+
148+ // Latest records the latest effective content revision observed by the controller.
149+ // When Base and Latest are equal, spec.content is based on the current latest
150+ // effective revision. When they differ, spec.content is either waiting to
151+ // auto-refresh because no real draft exists, or waiting for the controller to
152+ // replay or reject a preserved user draft against the newer latest revision.
153+ //
154+ // +optional
155+ Latest ParameterViewRevision `json:"latest,omitempty"`
156+
157+ // Submissions records recent desired parameter submissions derived from this view.
158+ // Newer entries appear first. The controller may compact older entries, but it
159+ // keeps enough history for users to understand which changes were recently submitted.
160+ //
161+ // +optional
162+ Submissions []ParameterViewSubmission `json:"submissions,omitempty"`
163+ }
164+
165+ // ParameterViewRevision identifies an effective content revision for a view.
166+ type ParameterViewRevision struct {
167+ // Revision records the effective content revision associated with this view state.
168+ // The controller resolves it from the generated ConfigMap revision metadata when available.
169+ //
170+ // +optional
171+ Revision string `json:"revision,omitempty"`
172+
173+ // ContentHash records the hash of the effective file content for this revision.
174+ //
175+ // +optional
176+ ContentHash string `json:"contentHash,omitempty"`
177+ }
178+
179+ // ParameterViewSubmission records the most recent submission derived from a view draft.
180+ type ParameterViewSubmission struct {
181+ // Revision records the effective content revision that the submission was based on.
182+ //
183+ // +optional
184+ Revision ParameterViewRevision `json:"revision,omitempty"`
185+
186+ // SubmittedAt records when the submission entry was created or last refreshed.
187+ //
188+ // +optional
189+ SubmittedAt * metav1.Time `json:"submittedAt,omitempty"`
190+
191+ // Parameters contains the desired parameter updates submitted from the view.
192+ //
193+ // +optional
194+ Parameters ParameterValueMap `json:"parameters,omitempty"`
130195}
131196
132197// ParameterViewMode defines whether a ParameterView can be edited.
@@ -141,12 +206,12 @@ const (
141206
142207// ParameterViewPhase defines the lifecycle state of a ParameterView.
143208// +enum
144- // +kubebuilder:validation:Enum={Pending,Ready ,Conflict,Invalid,Applying}
209+ // +kubebuilder:validation:Enum={Pending,Synced ,Conflict,Invalid,Applying}
145210type ParameterViewPhase string
146211
147212const (
148213 ParameterViewPendingPhase ParameterViewPhase = "Pending"
149- ParameterViewReadyPhase ParameterViewPhase = "Ready "
214+ ParameterViewSyncedPhase ParameterViewPhase = "Synced "
150215 ParameterViewConflictPhase ParameterViewPhase = "Conflict"
151216 ParameterViewInvalidPhase ParameterViewPhase = "Invalid"
152217 ParameterViewApplyingPhase ParameterViewPhase = "Applying"
0 commit comments