Skip to content

Commit bda2bdc

Browse files
authored
ReadOnly type in work (#332)
Signed-off-by: Jian Qiu <[email protected]>
1 parent cf2d921 commit bda2bdc

5 files changed

+23
-8
lines changed

addon/v1alpha1/0000_03_addon.open-cluster-management.io_addontemplates.crd.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,14 @@ spec:
271271
server side apply with work-controller as the field
272272
manager. If there is conflict, the related Applied
273273
condition of manifest will be in the status of False
274-
with the reason of ApplyConflict.
274+
with the reason of ApplyConflict. ReadOnly type means
275+
the agent will only check the existence of the resource
276+
based on its metadata.
275277
enum:
276278
- Update
277279
- CreateOnly
278280
- ServerSideApply
281+
- ReadOnly
279282
type: string
280283
required:
281284
- type

work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,14 @@ spec:
253253
means to update resource using server side apply with
254254
work-controller as the field manager. If there is conflict,
255255
the related Applied condition of manifest will be in the
256-
status of False with the reason of ApplyConflict.
256+
status of False with the reason of ApplyConflict. ReadOnly
257+
type means the agent will only check the existence of
258+
the resource based on its metadata.
257259
enum:
258260
- Update
259261
- CreateOnly
260262
- ServerSideApply
263+
- ReadOnly
261264
type: string
262265
required:
263266
- type

work/v1/types.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ type UpdateStrategy struct {
162162
// ServerSideApply type means to update resource using server side apply with work-controller as the field manager.
163163
// If there is conflict, the related Applied condition of manifest will be in the status of False with the
164164
// reason of ApplyConflict.
165+
// ReadOnly type means the agent will only check the existence of the resource based on its metadata.
165166
// +kubebuilder:default=Update
166-
// +kubebuilder:validation:Enum=Update;CreateOnly;ServerSideApply
167+
// +kubebuilder:validation:Enum=Update;CreateOnly;ServerSideApply;ReadOnly
167168
// +kubebuilder:validation:Required
168169
// +required
169170
Type UpdateStrategyType `json:"type,omitempty"`
@@ -177,18 +178,23 @@ type UpdateStrategy struct {
177178
type UpdateStrategyType string
178179

179180
const (
180-
// Update type means to update resource by an update call.
181+
// UpdateStrategyTypeUpdate means to update resource by an update call.
181182
UpdateStrategyTypeUpdate UpdateStrategyType = "Update"
182183

183-
// CreateOnly type means do not update resource based on current manifest. This should be used only when
184+
// UpdateStrategyTypeCreateOnly means do not update resource based on current manifest. This should be used only when
184185
// ServerSideApply type is not support on the spoke, and the user on hub would like some other controller
185186
// on the spoke to own the control of the resource.
186187
UpdateStrategyTypeCreateOnly UpdateStrategyType = "CreateOnly"
187188

188-
// ServerSideApply type means to update resource using server side apply with work-controller as the field manager.
189+
// UpdateStrategyTypeServerSideApply means to update resource using server side apply with work-controller as the field manager.
189190
// If there is conflict, the related Applied condition of manifest will be in the status of False with the
190191
// reason of ApplyConflict. This type allows another controller on the spoke to control certain field of the resource.
191192
UpdateStrategyTypeServerSideApply UpdateStrategyType = "ServerSideApply"
193+
194+
// UpdateStrategyTypeReadOnly type means only check the existence of the resource based on the resource's metadata.
195+
// If the statusFeedBackRules are set, the feedbackResult will also be returned.
196+
// The resource will not be removed when the type is ReadOnly, and only resource metadata is required.
197+
UpdateStrategyTypeReadOnly UpdateStrategyType = "ReadOnly"
192198
)
193199

194200
type ServerSideApplyConfig struct {

work/v1/zz_generated.swagger_doc_generated.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

work/v1alpha1/0000_00_work.open-cluster-management.io_manifestworkreplicasets.crd.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,14 @@ spec:
284284
server side apply with work-controller as the field
285285
manager. If there is conflict, the related Applied
286286
condition of manifest will be in the status of False
287-
with the reason of ApplyConflict.
287+
with the reason of ApplyConflict. ReadOnly type means
288+
the agent will only check the existence of the resource
289+
based on its metadata.
288290
enum:
289291
- Update
290292
- CreateOnly
291293
- ServerSideApply
294+
- ReadOnly
292295
type: string
293296
required:
294297
- type

0 commit comments

Comments
 (0)