Skip to content

Commit

Permalink
implementation of the DelayActivation strategy for Policy
Browse files Browse the repository at this point in the history
Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
  • Loading branch information
chaosi-zju committed Jan 24, 2024
1 parent f054313 commit 523bdd5
Show file tree
Hide file tree
Showing 13 changed files with 322 additions and 83 deletions.
4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -17148,6 +17148,10 @@
"resourceSelectors"
],
"properties": {
"activationStrategy": {
"description": "ActivationStrategy declares how creation/modification/deletion to the Policy affect the resources it matches.\n\nThe value \"Immediate\" means the matched resource will respond to the creation/modification/deletion immediately.\n\nThe value \"Delay\" means the matched resource will delay to respond to the creation/modification/deletion until the resource itself is modified (In 1:N scenario where one Policy manages many resource templates, changes to a Policy typically affect numerous applications simultaneously. If there are errors in the Policy configuration, it could lead to widespread failures. By using this setting to delay the implementation of changes, the changed Policy can be gradually rolled out through iterative modifications to application configurations).\n\nIf the field is unset, the default strategy is \"Immediate\".",
"type": "string"
},
"association": {
"description": "Association tells if relevant resources should be selected automatically. e.g. a ConfigMap referred by a Deployment. default false. Deprecated: in favor of PropagateDeps.",
"type": "boolean"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ spec:
spec:
description: Spec represents the desired behavior of ClusterPropagationPolicy.
properties:
activationStrategy:
description: "ActivationStrategy declares how creation/modification/deletion
to the Policy affect the resources it matches. \n The value \"Immediate\"
means the matched resource will respond to the creation/modification/deletion
immediately. \n The value \"Delay\" means the matched resource will
delay to respond to the creation/modification/deletion until the
resource itself is modified (In 1:N scenario where one Policy manages
many resource templates, changes to a Policy typically affect numerous
applications simultaneously. If there are errors in the Policy configuration,
it could lead to widespread failures. By using this setting to delay
the implementation of changes, the changed Policy can be gradually
rolled out through iterative modifications to application configurations).
\n If the field is unset, the default strategy is \"Immediate\"."
type: string
association:
description: 'Association tells if relevant resources should be selected
automatically. e.g. a ConfigMap referred by a Deployment. default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ spec:
spec:
description: Spec represents the desired behavior of PropagationPolicy.
properties:
activationStrategy:
description: "ActivationStrategy declares how creation/modification/deletion
to the Policy affect the resources it matches. \n The value \"Immediate\"
means the matched resource will respond to the creation/modification/deletion
immediately. \n The value \"Delay\" means the matched resource will
delay to respond to the creation/modification/deletion until the
resource itself is modified (In 1:N scenario where one Policy manages
many resource templates, changes to a Policy typically affect numerous
applications simultaneously. If there are errors in the Policy configuration,
it could lead to widespread failures. By using this setting to delay
the implementation of changes, the changed Policy can be gradually
rolled out through iterative modifications to application configurations).
\n If the field is unset, the default strategy is \"Immediate\"."
type: string
association:
description: 'Association tells if relevant resources should be selected
automatically. e.g. a ConfigMap referred by a Deployment. default
Expand Down
24 changes: 24 additions & 0 deletions pkg/apis/policy/v1alpha1/propagation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@ type PropagationSpec struct {
// +kubebuilder:validation:Enum=Abort;Overwrite
// +optional
ConflictResolution ConflictResolution `json:"conflictResolution,omitempty"`

// ActivationStrategy declares how creation/modification/deletion to the Policy affect the resources it matches.
//
// The value "Immediate" means the matched resource will respond to the creation/modification/deletion immediately.
//
// The value "Delay" means the matched resource will delay to respond to the creation/modification/deletion until
// the resource itself is modified (In 1:N scenario where one Policy manages many resource templates,
// changes to a Policy typically affect numerous applications simultaneously. If there are errors in the Policy
// configuration, it could lead to widespread failures. By using this setting to delay the implementation of changes,
// the changed Policy can be gradually rolled out through iterative modifications to application configurations).
//
// If the field is unset, the default strategy is "Immediate".
//
// +optional
ActivationStrategy ActivationStrategy `json:"activationStrategy,omitempty"`
}

// ResourceSelector the resources will be selected.
Expand Down Expand Up @@ -518,6 +533,15 @@ const (
ConflictAbort ConflictResolution = "Abort"
)

// ActivationStrategy declares how creation/modification/deletion to the Policy affect the resources it matches.
type ActivationStrategy string

const (
// LazyActivation means the matched resource will delay to respond to the creation/modification/deletion until
// the resource itself is modified
LazyActivation ActivationStrategy = "Lazy"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// PropagationPolicyList contains a list of PropagationPolicy.
Expand Down
Loading

0 comments on commit 523bdd5

Please sign in to comment.