-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set original replica count as op artifact for
ScaleWorkload
fun (#2533
) * Set original replica count as op artifact for `ScaleWorkload` fun * Address small review comments 1. Remove extra new line 2. Change STS -> StatefulSet * Update example for scaleworkload * Add test and update the scaleworkload tasks README
- Loading branch information
1 parent
0caa0df
commit c4ccb53
Showing
6 changed files
with
135 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ Tasks | |
tasks/argo.rst | ||
tasks/logs_level.rst | ||
tasks/logs.rst | ||
tasks/scaleworkload.rst |
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,46 @@ | ||
.. _scaleworkloadexample: | ||
|
||
Using ScaleWorkload function with output artifact | ||
------------------------------------------------- | ||
|
||
``ScaleWorkload`` function can be used to scale a workload to specified | ||
replicas. It automatically sets the original replica count of the workload | ||
as output artifact, which makes using ``ScaleWorkload`` function in blueprints | ||
a lot easier. | ||
|
||
Below is an example of how this function can be used | ||
|
||
|
||
.. code-block:: yaml | ||
apiVersion: cr.kanister.io/v1alpha1 | ||
kind: Blueprint | ||
metadata: | ||
name: my-blueprint | ||
actions: | ||
backup: | ||
outputArtifacts: | ||
backupOutput: | ||
keyValue: | ||
origReplicas: "{{ .Phases.shutdownPod.Output.originalReplicaCount }}" | ||
phases: | ||
# before scaling replicas 0, ScaleWorkload will get the original replica count | ||
# to set that as output artifact (originalReplicaCount) | ||
- func: ScaleWorkload | ||
name: shutdownPod | ||
args: | ||
namespace: "{{ .StatefulSet.Namespace }}" | ||
name: "{{ .StatefulSet.Name }}" | ||
kind: StatefulSet | ||
replicas: 0 # this is the replica count, the STS will scaled to | ||
restore: | ||
inputArtifactNames: | ||
- backupOutput | ||
phases: | ||
- func: ScaleWorkload | ||
name: bringUpPod | ||
args: | ||
namespace: "{{ .StatefulSet.Namespace }}" | ||
name: "{{ .StatefulSet.Name }}" | ||
kind: StatefulSet | ||
replicas: "{{ .ArtifactsIn.backupOutput.KeyValue.origReplicas }}" |
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