Ability to retain specialised pods for poolmanager functions (#2830)
- added retainPods flag to take in the number of specialized pods to retain - add retainPods in both the create function and update function command - modify crd keys to be typed instead of string - keep track of function generation in case of update function operation - add delete handler function to make sure specialized pods are deleted in case function is deleted --------- Signed-off-by: Sanket Sudake <sanketsudake@gmail.com> Signed-off-by: Pranoy Kundu <pranoy1998k@gmail.com> Co-authored-by: Pranoy Kundu <pranoy1998k@gmail.com>
This commit is contained in:
co-authored by
Pranoy Kundu
parent
657aee7cc2
commit
56b49dcee8
@@ -36,7 +36,7 @@ func Commands() *cobra.Command {
|
||||
flag.FnExecutorType, flag.FnCfgMap, flag.FnSecret,
|
||||
flag.FnSpecializationTimeout, flag.FnExecutionTimeout,
|
||||
flag.FnIdleTimeout, flag.FnConcurrency, flag.FnRequestsPerPod,
|
||||
flag.FnOnceOnly, flag.Labels, flag.Annotation,
|
||||
flag.FnOnceOnly, flag.Labels, flag.Annotation, flag.FnRetainPods,
|
||||
|
||||
// TODO retired pkg & trigger related flags from function cmd
|
||||
flag.PkgCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
|
||||
@@ -87,7 +87,7 @@ func Commands() *cobra.Command {
|
||||
flag.FnExecutorType, flag.FnSecret, flag.FnCfgMap,
|
||||
flag.FnSpecializationTimeout, flag.FnExecutionTimeout,
|
||||
flag.FnIdleTimeout, flag.FnConcurrency, flag.FnRequestsPerPod,
|
||||
flag.FnOnceOnly, flag.Labels, flag.Annotation,
|
||||
flag.FnOnceOnly, flag.Labels, flag.Annotation, flag.FnRetainPods,
|
||||
|
||||
flag.PkgCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
|
||||
flag.PkgSrcChecksum, flag.PkgDeployChecksum, flag.PkgInsecure,
|
||||
|
||||
@@ -104,6 +104,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
}
|
||||
|
||||
requestsPerPod := input.Int(flagkey.FnRequestsPerPod)
|
||||
retainPods := input.Int(flagkey.FnRetainPods)
|
||||
|
||||
fnOnceOnly := input.Bool(flagkey.FnOnceOnly)
|
||||
|
||||
@@ -306,6 +307,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
IdleTimeout: &fnIdleTimeout,
|
||||
Concurrency: fnConcurrency,
|
||||
RequestsPerPod: requestsPerPod,
|
||||
RetainPods: retainPods,
|
||||
OnceOnly: fnOnceOnly,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -162,6 +162,10 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
|
||||
function.Spec.RequestsPerPod = input.Int(flagkey.FnRequestsPerPod)
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.FnRetainPods) {
|
||||
function.Spec.RetainPods = input.Int(flagkey.FnRetainPods)
|
||||
}
|
||||
|
||||
if input.IsSet(flagkey.FnOnceOnly) {
|
||||
function.Spec.OnceOnly = input.Bool(flagkey.FnOnceOnly)
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ var (
|
||||
FnOnceOnly = Flag{Type: Bool, Name: flagkey.FnOnceOnly, Aliases: []string{"yolo"}, Usage: "Specifies if specialized pod will serve exactly one request in its lifetime"}
|
||||
FnSubPath = Flag{Type: String, Name: flagkey.FnSubPath, Usage: "Sub Path to check if function internally supports routing"}
|
||||
FnLogAllPods = Flag{Type: Bool, Name: flagkey.FnLogAllPods, Usage: "Get all pod's logs in the function."}
|
||||
FnRetainPods = Flag{Type: Int, Name: flagkey.FnRetainPods, Usage: "Number of pods to retain after pods specialization.", DefaultValue: 0}
|
||||
// Termination Grace Period configurable at function creation/update only for container functions
|
||||
FnTerminationGracePeriod = Flag{Type: Int64, Name: flagkey.FnGracePeriod, Usage: "Grace time (in seconds) for pod to perform connection draining before termination (only non-negative values considered)", DefaultValue: 360}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ const (
|
||||
FnSubPath = "subpath"
|
||||
FnGracePeriod = "graceperiod"
|
||||
FnLogAllPods = "all-pods"
|
||||
FnRetainPods = "retainpods"
|
||||
|
||||
HtName = resourceName
|
||||
HtMethod = "method"
|
||||
|
||||
Reference in New Issue
Block a user