Skip to content

Commit

Permalink
alter operator to operation
Browse files Browse the repository at this point in the history
  • Loading branch information
vie-serendipity committed Aug 17, 2023
1 parent dc82625 commit ab508f9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/proposals/20230706-yurtappoverrider.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ type Item struct {
Replicas *int32 `json:"replicas,omitempty"`
}

type Operator string
type Operation string

const (
ADD Operator = "add" // json patch
REMOVE Operator = "remove" // json patch
REPLACE Operator = "replace" // json patch
ADD Operation = "add" // json patch
REMOVE Operation = "remove" // json patch
REPLACE Operation = "replace" // json patch
)

type Patch struct {
// Path represents the path in the json patch
Path string `json:"path"`
// type represents the operation
// +kubebuilder:validation:Enum=add;remove;replace
Operator Operator `json:"operator"`
Operation Operation `json:"operation"`
// Indicates the patch for the template
// +optional
Value apiextensionsv1.JSON `json:"value,omitempty"`
Expand Down Expand Up @@ -168,7 +168,7 @@ Attention Points:
2. The latter configuration always relpace the former. So the last configuration will really work
#### YurtAppOverrider Validating Webhook
1. Verify that only one YurtAppOverrider can be bound to YurtAppSet/YurtAppDaemon
2. Verify that value is empty when operator is REMOVE
2. Verify that value is empty when operation is REMOVE
#### YurtAppOverrider Controller
##### Task 1
1. Get update events by watching the YurtAppOverrider resource
Expand All @@ -178,7 +178,7 @@ Attention Points:
2. Render the configuration according to the YurtAppSet workload template and the watching YurtAppOverrider
### User Stories
#### Story 1 (General)
Use YurtAppSet with YurtAppOverrider for customized configuration of each region. Create YurtAppOverrider first and then create YurtAppSet. If update is needed, modify Yu resource directly. For YurtAppDaemon, the usage is similar. Users only need to do some configurations in YurtAppOverrider and our rendering engine will inject all configurations into target workloads.
Use YurtAppSet with YurtAppOverrider for customized configuration of each region. Create YurtAppOverrider first and then create YurtAppSet. If update is needed, modify YurtAppSet resource directly. For YurtAppDaemon, the usage is similar. Users only need to do some configurations in YurtAppOverrider and our rendering engine will inject all configurations into target workloads.
#### Story 2 (Specific)
For example, if there are three locations, Beijing and Hangzhou have the similar configuration, and Shanghai is not the same. They have different image version, replicas. We can configure it as follows:
```yaml
Expand Down Expand Up @@ -274,29 +274,29 @@ entries:
- pools:
hangzhou
patches:
- operator: add
- operation: add
path: /spec/template/spec/volumes/-
value:
name: test-volume
hostPath:
path: /var/lib/docker
type: Directory
- operator: replace
- operation: replace
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: shared-dir
mountPath: /var/lib/docker
- pools:
beijing
patches:
- operator: add
- operation: add
path: /spec/template/spec/volumes/-
value:
name: test-volume
hostPath:
path: /data/logs
type: Directory
- operator: replace
- operation: replace
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: shared-dir
Expand Down

0 comments on commit ab508f9

Please sign in to comment.