Skip to content

Commit

Permalink
Pass replicas from RestoreSession to Function (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
Md. Emruz Hossain authored and tamalsaha committed Jul 29, 2019
1 parent ae5eabd commit 8df5be9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions apis/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
TargetMountPath = "TARGET_MOUNT_PATH"
TargetDirectories = "TARGET_DIRECTORIES"
TargetAppVersion = "TARGET_APP_VERSION"
TargetAppReplicas = "TARGET_APP_REPLICAS"

RestoreDirectories = "RESTORE_DIRECTORIES"
RestoreSnapshots = "RESTORE_SNAPSHOTS"
Expand Down
7 changes: 7 additions & 0 deletions pkg/controller/inputs.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func (c *StashController) inputsForRestoreSession(restoreSession api.RestoreSess
// always enable cache if nothing specified
inputs[apis.EnableCache] = strconv.FormatBool(!restoreSession.Spec.TempDir.DisableCaching)

// pass replicas field to function. if not set pass default 1.
replicas := int32(1)
if restoreSession.Spec.Target != nil && restoreSession.Spec.Target.Replicas != nil {
replicas = *restoreSession.Spec.Target.Replicas
}
inputs[apis.TargetAppReplicas] = string(replicas)

// add PushgatewayURL as input
metricInputs := c.inputForMetrics()
inputs = core_util.UpsertMap(inputs, metricInputs)
Expand Down

0 comments on commit 8df5be9

Please sign in to comment.