-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Qiaozp <[email protected]> Signed-off-by: Qiaozp <[email protected]>
- Loading branch information
Showing
5 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...resources/static/vela/charts/vela-core/templates/defwithtemplate/k8s-update-strategy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. | ||
# Definition source cue file: vela-templates/definitions/internal/k8s-update-strategy.cue | ||
apiVersion: core.oam.dev/v1beta1 | ||
kind: TraitDefinition | ||
metadata: | ||
annotations: | ||
definition.oam.dev/alias: "" | ||
definition.oam.dev/description: Set k8s update strategy for Deployment/DaemonSet/StatefulSet | ||
name: k8s-update-strategy | ||
namespace: {{ include "systemDefinitionNamespace" . }} | ||
spec: | ||
appliesToWorkloads: | ||
- deployments.apps | ||
- statefulsets.apps | ||
- daemonsets.apps | ||
conflictsWith: [] | ||
podDisruptive: false | ||
schematic: | ||
cue: | ||
template: | | ||
patch: spec: { | ||
if parameter.targetKind == "Deployment" && parameter.strategy.type != "OnDelete" { | ||
// +patchStrategy=retainKeys | ||
strategy: { | ||
type: parameter.strategy.type | ||
if parameter.strategy.type == "RollingUpdate" { | ||
rollingUpdate: { | ||
maxSurge: parameter.strategy.rollingStrategy.maxSurge | ||
maxUnavailable: parameter.strategy.rollingStrategy.maxUnavailable | ||
} | ||
} | ||
} | ||
} | ||
if parameter.targetKind == "StatefulSet" && parameter.strategy.type != "Recreate" { | ||
// +patchStrategy=retainKeys | ||
updateStrategy: { | ||
type: parameter.strategy.type | ||
if parameter.strategy.type == "RollingUpdate" { | ||
rollingUpdate: partition: parameter.strategy.rollingStrategy.partition | ||
} | ||
} | ||
} | ||
if parameter.targetKind == "DaemonSet" && parameter.strategy.type != "Recreate" { | ||
// +patchStrategy=retainKeys | ||
updateStrategy: { | ||
type: parameter.strategy.type | ||
if parameter.strategy.type == "RollingUpdate" { | ||
rollingUpdate: { | ||
maxSurge: parameter.strategy.rollingStrategy.maxSurge | ||
maxUnavailable: parameter.strategy.rollingStrategy.maxUnavailable | ||
} | ||
} | ||
} | ||
} | ||
} | ||
parameter: { | ||
// +usage=Specify the apiVersion of target | ||
targetAPIVersion: *"apps/v1" | string | ||
// +usage=Specify the kind of target | ||
targetKind: *"Deployment" | "StatefulSet" | "DaemonSet" | ||
// +usage=Specify the strategy of update | ||
strategy: { | ||
// +usage=Specify the strategy type | ||
type: *"RollingUpdate" | "Recreate" | "OnDelete" | ||
// +usage=Specify the parameters of rollong update strategy | ||
rollingStrategy?: { | ||
maxSurge: *"25%" | string | ||
maxUnavailable: *"25%" | string | ||
partition: *0 | int | ||
} | ||
} | ||
} | ||
workloadRefPath: "" | ||
|