Capture os signals to gracefully shutdown fission components (#2261)
- Currently, fission components don't handle shutdown signals. So we don't get any to do the required cleanup before the fission process exits. Adding signal capture process with cancelling context so that all dependent processes stop working when the process gets term signal. - Set log level to error in otel shutdown function Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
@@ -17,13 +17,12 @@ limitations under the License.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/docopt/docopt-go"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/fission/fission/pkg/info"
|
||||
"github.com/fission/fission/pkg/utils/loggerfactory"
|
||||
"github.com/fission/fission/pkg/utils/signals"
|
||||
)
|
||||
|
||||
func getStringArgWithDefault(arg interface{}, defaultValue string) string {
|
||||
@@ -59,7 +58,7 @@ Options:
|
||||
zap.Error(err))
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := signals.SetupSignalHandlerWithContext(logger)
|
||||
crd := crdBackedClient.GetFunctionCRD(ctx)
|
||||
if crd == nil {
|
||||
logger.Info("nothing to do since CRDs are not present on the cluster")
|
||||
|
||||
Reference in New Issue
Block a user