Skip to content

Commit

Permalink
ReadOnly type in work
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Qiu <jqiu@redhat.com>
  • Loading branch information
qiujian16 committed May 23, 2024
1 parent 9d94703 commit eed22bb
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,16 @@ spec:
means do not update resource based on current manifest.
ServerSideApply type means to update resource using
server side apply with work-controller as the field
manager. If there is conflict, the related Applied
condition of manifest will be in the status of False
with the reason of ApplyConflict.
manager. ReadOnly type means the agent will only check
the existence of the resource based on its metadata.
If there is conflict, the related Applied condition
of manifest will be in the status of False with the
reason of ApplyConflict.
enum:
- Update
- CreateOnly
- ServerSideApply
- ReadOnly
type: string
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,16 @@ spec:
by an update call. CreateOnly type means do not update
resource based on current manifest. ServerSideApply type
means to update resource using server side apply with
work-controller as the field manager. If there is conflict,
the related Applied condition of manifest will be in the
status of False with the reason of ApplyConflict.
work-controller as the field manager. ReadOnly type means
the agent will only check the existence of the resource
based on its metadata. If there is conflict, the related
Applied condition of manifest will be in the status of
False with the reason of ApplyConflict.
enum:
- Update
- CreateOnly
- ServerSideApply
- ReadOnly
type: string
required:
- type
Expand Down
8 changes: 7 additions & 1 deletion work/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ type UpdateStrategy struct {
// Update type means to update resource by an update call.
// CreateOnly type means do not update resource based on current manifest.
// ServerSideApply type means to update resource using server side apply with work-controller as the field manager.
// ReadOnly type means the agent will only check the existence of the resource based on its metadata.
// If there is conflict, the related Applied condition of manifest will be in the status of False with the
// reason of ApplyConflict.
// +kubebuilder:default=Update
// +kubebuilder:validation:Enum=Update;CreateOnly;ServerSideApply
// +kubebuilder:validation:Enum=Update;CreateOnly;ServerSideApply;ReadOnly
// +kubebuilder:validation:Required
// +required
Type UpdateStrategyType `json:"type,omitempty"`
Expand All @@ -189,6 +190,11 @@ const (
// If there is conflict, the related Applied condition of manifest will be in the status of False with the
// reason of ApplyConflict. This type allows another controller on the spoke to control certain field of the resource.
UpdateStrategyTypeServerSideApply UpdateStrategyType = "ServerSideApply"

// UpdateStrategyTypeReadOnly type means only check the existence of the resource based on the resource's metadata.
// If the statusFeedBackRules are set, the feedbackResult will also be returned.
// The resource will not be removed when the type is ReadOnly, and only resource metadata is required.
UpdateStrategyTypeReadOnly UpdateStrategyType = "ReadOnly"
)

type ServerSideApplyConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion work/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,16 @@ spec:
means do not update resource based on current manifest.
ServerSideApply type means to update resource using
server side apply with work-controller as the field
manager. If there is conflict, the related Applied
condition of manifest will be in the status of False
with the reason of ApplyConflict.
manager. ReadOnly type means the agent will only check
the existence of the resource based on its metadata.
If there is conflict, the related Applied condition
of manifest will be in the status of False with the
reason of ApplyConflict.
enum:
- Update
- CreateOnly
- ServerSideApply
- ReadOnly
type: string
required:
- type
Expand Down

0 comments on commit eed22bb

Please sign in to comment.