support update strategy in manifestwork (#139)

* Add ssa strategy

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Add test cases

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Resolve comments

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Use default manager in api repo

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Refatcor deleteOption

patch ownerref separately for deleteOption

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Do not reconcile when ssa conflict

Signed-off-by: Jian Qiu <jqiu@redhat.com>
This commit is contained in:
Jian Qiu
2022-07-07 10:09:42 +08:00
committed by GitHub
parent 718605172f
commit 1a7686ee47
14 changed files with 1363 additions and 187 deletions

View File

@@ -68,6 +68,40 @@ spec:
resource:
description: Resource is the resource name of the Kubernetes resource.
type: string
executor:
description: Executor is the configuration that makes the work agent to perform some pre-request processing/checking. e.g. the executor identity tells the work agent to check the executor has sufficient permission to write the workloads to the local managed cluster. Note that nil executor is still supported for backward-compatibility which indicates that the work agent will not perform any additional actions before applying resources.
type: object
properties:
subject:
description: Subject is the subject identity which the work agent uses to talk to the local cluster when applying the resources.
type: object
required:
- type
properties:
serviceAccount:
description: ServiceAccount is for identifying which service account to use by the work agent. Only required if the type is "ServiceAccount".
type: object
required:
- name
- namespace
properties:
name:
description: Name is the name of the service account.
type: string
maxLength: 253
minLength: 1
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)$
namespace:
description: Namespace is the namespace of the service account.
type: string
maxLength: 253
minLength: 1
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)$
type:
description: 'Type is the type of the subject identity. Supported types are: "ServiceAccount".'
type: string
enum:
- ServiceAccount
manifestConfigs:
description: ManifestConfigs represents the configurations of manifests defined in workload field.
type: array
@@ -75,11 +109,10 @@ spec:
description: ManifestConfigOption represents the configurations of a manifest defined in workload field.
type: object
required:
- feedbackRules
- resourceIdentifier
properties:
feedbackRules:
description: FeedbackRules defines what resource status field should be returned.
description: FeedbackRules defines what resource status field should be returned. If it is not set or empty, no feedback rules will be honored.
type: array
items:
type: object
@@ -129,6 +162,32 @@ spec:
resource:
description: Resource is the resource name of the Kubernetes resource.
type: string
updateStrategy:
description: UpdateStrategy defines the strategy to update this manifest. UpdateStrategy is Update if it is not set, optional
type: object
required:
- type
properties:
serverSideApply:
description: serverSideApply defines the configuration for server side apply. It is honored only when type of updateStrategy is ServerSideApply
type: object
properties:
fieldManager:
description: FieldManager is the manager to apply the resource. It is work-agent by default, but can be other name with work-agent as the prefix.
type: string
default: work-agent
pattern: ^work-agent
force:
description: Force represents to force apply the manifest.
type: boolean
type:
description: type defines the strategy to update this manifest, default value is Update. 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. If there is conflict, the related Applied condition of manifest will be in the status of False with the reason of ApplyConflict.
type: string
default: Update
enum:
- Update
- CreateOnly
- ServerSideApply
workload:
description: Workload represents the manifest workload to be deployed on a managed cluster.
type: object