@@ -121,118 +121,116 @@ As an end user using encryption at rest, whenever the key change is detected we
121
121
## Design Details
122
122
123
123
### APIs to move
124
- #### We will move following [ APIs] ( https://github.com/kubernetes-sigs/kube-storage-version-migrator/blob/60dee538334c2366994c2323c0db5db8ab4d2838/pkg/apis/migration/v1alpha1/types.go ) in-tree:
125
- - ` v1alpha1 ` of ` storageversionmigrations.migration.k8s.io `
126
-
127
- ``` go
128
- // StorageVersionMigration represents a migration of stored data to the latest
129
- // storage version.
130
- type StorageVersionMigration struct {
131
- metav1.TypeMeta ` json:",inline"`
132
- // Standard object metadata.
133
- // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
134
- // +optional
135
- metav1.ObjectMeta ` json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
136
- // Specification of the migration.
137
- // +optional
138
- Spec StorageVersionMigrationSpec ` json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
139
- // Status of the migration.
140
- // +optional
141
- Status StorageVersionMigrationStatus ` json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
142
- }
143
-
144
- // Spec of the storage version migration.
145
- type StorageVersionMigrationSpec struct {
146
- // The resource that is being migrated. The migrator sends requests to
147
- // the endpoint serving the resource.
148
- // Immutable.
149
- Resource GroupVersionResource ` json:"resource" protobuf:"bytes,1,opt,name=resource"`
150
- // The token used in the list options to get the next chunk of objects
151
- // to migrate. When the .status.conditions indicates the migration is
152
- // "Running", users can use this token to check the progress of the
153
- // migration.
154
- // +optional
155
- ContinueToken string ` json:"continueToken,omitempty" protobuf:"bytes,2,opt,name=continueToken"`
156
- // TODO: consider recording the storage version hash when the migration
157
- // is created. It can avoid races.
158
- }
159
-
160
- // The names of the group, the version, and the resource.
161
- type GroupVersionResource struct {
162
- // The name of the group.
163
- Group string ` json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
164
- // The name of the version.
165
- Version string ` json:"version,omitempty" protobuf:"bytes,2,opt,name=version"`
166
- // The name of the resource.
167
- Resource string ` json:"resource,omitempty" protobuf:"bytes,3,opt,name=resource"`
168
- }
169
-
170
- type MigrationConditionType string
171
-
172
- const (
173
- // Indicates that the migration is running.
174
- MigrationRunning MigrationConditionType = " Running"
175
- // Indicates that the migration has completed successfully.
176
- MigrationSucceeded MigrationConditionType = " Succeeded"
177
- // Indicates that the migration has failed.
178
- MigrationFailed MigrationConditionType = " Failed"
179
- )
180
-
181
- // Describes the state of a migration at a certain point.
182
- type MigrationCondition struct {
183
- // Type of the condition.
184
- Type MigrationConditionType ` json:"type" protobuf:"bytes,1,opt,name=type,casttype=MigrationConditionType"`
185
- // Status of the condition, one of True, False, Unknown.
186
- Status corev1.ConditionStatus ` json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
187
- // The last time this condition was updated.
188
- // +optional
189
- LastUpdateTime metav1.Time ` json:"lastUpdateTime,omitempty" protobuf:"bytes,3,opt,name=lastUpdateTime"`
190
- // The reason for the condition's last transition.
191
- // +optional
192
- Reason string ` json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
193
- // A human readable message indicating details about the transition.
194
- // +optional
195
- Message string ` json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
196
- }
197
-
198
- // Status of the storage version migration.
199
- type StorageVersionMigrationStatus struct {
200
- // The latest available observations of the migration's current state.
201
- // +patchMergeKey=type
202
- // +patchStrategy=merge
203
- // +listType=map
204
- // +listMapKey=type
205
- // +optional
206
- Conditions []MigrationCondition ` json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
207
- // ResourceVersion to compare with the GC cache for performing the migration.
208
- // This is the current resource version of given group, version and resource when
209
- // kube-controller-manager first observes this StorageVersionMigration resource.
210
- ResourceVersion string ` json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"`
211
- // LastMigratedResourceNameHash is use to pick up migration from where it left off in case of failure.
212
- LastMigratedResourceNameHash string ` json:"lastMigratedResourceNameHash,omitempty" protobuf:"bytes,3,opt,name=lastMigratedResourceNameHash"`
213
- }
214
-
215
- // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
216
- // +k8s:prerelease-lifecycle-gen:introduced=1.30
217
-
218
- // StorageVersionMigrationList is a collection of storage version migrations.
219
- type StorageVersionMigrationList struct {
220
- metav1.TypeMeta ` json:",inline"`
221
-
222
- // Standard list metadata
223
- // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
224
- // +optional
225
- metav1.ListMeta ` json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
226
- // Items is the list of StorageVersionMigration
227
- // +patchMergeKey=type
228
- // +patchStrategy=merge
229
- // +listType=map
230
- // +listMapKey=type
231
- Items []StorageVersionMigration ` json:"items" listType:"map" listMapKey:"type" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=items"`
232
- }
233
- ```
234
-
235
- - APIs in-tree will be _converted to ` built-in types` _ from CRD .
124
+ The following API of the ` storageversionmigrations.migration.k8s.io ` API group is
125
+ based on the [ original out-of-tree API types] ( https://github.com/kubernetes-sigs/kube-storage-version-migrator/blob/60dee538334c2366994c2323c0db5db8ab4d2838/pkg/apis/migration/v1alpha1/types.go ) .
126
+
127
+ ``` go
128
+ // StorageVersionMigration represents a migration of stored data to the latest
129
+ // storage version.
130
+ type StorageVersionMigration struct {
131
+ metav1.TypeMeta ` json:",inline"`
132
+ // Standard object metadata.
133
+ // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
134
+ // +optional
135
+ metav1.ObjectMeta ` json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
136
+ // Specification of the migration.
137
+ // +optional
138
+ Spec StorageVersionMigrationSpec ` json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
139
+ // Status of the migration.
140
+ // +optional
141
+ Status StorageVersionMigrationStatus ` json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
142
+ }
143
+
144
+ // Spec of the storage version migration.
145
+ type StorageVersionMigrationSpec struct {
146
+ // The resource that is being migrated. The migrator sends requests to
147
+ // the endpoint serving the resource.
148
+ // Immutable.
149
+ Resource GroupVersionResource ` json:"resource" protobuf:"bytes,1,opt,name=resource"`
150
+ // The token used in the list options to get the next chunk of objects
151
+ // to migrate. When the .status.conditions indicates the migration is
152
+ // "Running", users can use this token to check the progress of the
153
+ // migration.
154
+ // +optional
155
+ ContinueToken string ` json:"continueToken,omitempty" protobuf:"bytes,2,opt,name=continueToken"`
156
+ // TODO: consider recording the storage version hash when the migration
157
+ // is created. It can avoid races.
158
+ }
159
+
160
+ // The names of the group, the version, and the resource.
161
+ type GroupVersionResource struct {
162
+ // The name of the group.
163
+ Group string ` json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
164
+ // The name of the version.
165
+ Version string ` json:"version,omitempty" protobuf:"bytes,2,opt,name=version"`
166
+ // The name of the resource.
167
+ Resource string ` json:"resource,omitempty" protobuf:"bytes,3,opt,name=resource"`
168
+ }
169
+
170
+ type MigrationConditionType string
171
+
172
+ const (
173
+ // Indicates that the migration is running.
174
+ MigrationRunning MigrationConditionType = " Running"
175
+ // Indicates that the migration has completed successfully.
176
+ MigrationSucceeded MigrationConditionType = " Succeeded"
177
+ // Indicates that the migration has failed.
178
+ MigrationFailed MigrationConditionType = " Failed"
179
+ )
180
+
181
+ // Describes the state of a migration at a certain point.
182
+ type MigrationCondition struct {
183
+ // Type of the condition.
184
+ Type MigrationConditionType ` json:"type" protobuf:"bytes,1,opt,name=type,casttype=MigrationConditionType"`
185
+ // Status of the condition, one of True, False, Unknown.
186
+ Status corev1.ConditionStatus ` json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
187
+ // The last time this condition was updated.
188
+ // +optional
189
+ LastUpdateTime metav1.Time ` json:"lastUpdateTime,omitempty" protobuf:"bytes,3,opt,name=lastUpdateTime"`
190
+ // The reason for the condition's last transition.
191
+ // +optional
192
+ Reason string ` json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
193
+ // A human readable message indicating details about the transition.
194
+ // +optional
195
+ Message string ` json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
196
+ }
197
+
198
+ // Status of the storage version migration.
199
+ type StorageVersionMigrationStatus struct {
200
+ // The latest available observations of the migration's current state.
201
+ // +patchMergeKey=type
202
+ // +patchStrategy=merge
203
+ // +listType=map
204
+ // +listMapKey=type
205
+ // +optional
206
+ Conditions []MigrationCondition ` json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
207
+ // ResourceVersion to compare with the GC cache for performing the migration.
208
+ // This is the current resource version of given group, version and resource when
209
+ // kube-controller-manager first observes this StorageVersionMigration resource.
210
+ ResourceVersion string ` json:"resourceVersion,omitempty" protobuf:"bytes,2,opt,name=resourceVersion"`
211
+ // LastMigratedResourceNameHash is use to pick up migration from where it left off in case of failure.
212
+ LastMigratedResourceNameHash string ` json:"lastMigratedResourceNameHash,omitempty" protobuf:"bytes,3,opt,name=lastMigratedResourceNameHash"`
213
+ }
214
+
215
+ // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
216
+ // +k8s:prerelease-lifecycle-gen:introduced=1.30
217
+
218
+ // StorageVersionMigrationList is a collection of storage version migrations.
219
+ type StorageVersionMigrationList struct {
220
+ metav1.TypeMeta ` json:",inline"`
221
+
222
+ // Standard list metadata
223
+ // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
224
+ // +optional
225
+ metav1.ListMeta ` json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
226
+ // Items is the list of StorageVersionMigration
227
+ // +patchMergeKey=type
228
+ // +patchStrategy=merge
229
+ // +listType=map
230
+ // +listMapKey=type
231
+ Items []StorageVersionMigration ` json:"items" listType:"map" listMapKey:"type" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=items"`
232
+ }
233
+ ```
236
234
237
235
#### Changes while we move above APIs in-tree:
238
236
To avoid any conflicts with the Storage Version Migrators running out of tree, we will change the _ ` group ` _ from ` migration.k8s.io ` to ` storagemigration.k8s.io ` .
0 commit comments