fix: Fix read termination timeout for all namespaces mode. (#1235)
* fix: Fix read termination timeout for all namespaces mode. Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>pull/1242/head
parent
942960f99c
commit
ec8e825ecb
|
|
@ -178,7 +178,7 @@ func backupDatabases(bctx *BackupContext, destDir string) (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
// Get and seve all dumps from the Postgres container
|
||||
// Get and save all dumps from the Postgres container
|
||||
for _, dbName := range databasesToBackup {
|
||||
execReason := fmt.Sprintf("getting database %s dump", dbName)
|
||||
dbDump, err := k8sClient.DoExecIntoPod(bctx.namespace, postgresPodName, getMoveDatabaseDumpScript(dbName), execReason)
|
||||
|
|
|
|||
2
main.go
2
main.go
|
|
@ -275,7 +275,7 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
period := signal.GetTerminationGracePeriodSeconds(mgr.GetAPIReader(), watchNamespace)
|
||||
period := signal.GetTerminationGracePeriodSeconds(mgr.GetAPIReader(), util.GetCheOperatorNamespace())
|
||||
sigHandler := signal.SetupSignalHandler(period)
|
||||
|
||||
// we install the devworkspace CheCluster reconciler even if dw is not supported so that it
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
// This program and the accompanying materials are made
|
||||
// available under the terms of the Eclipse Public License 2.0
|
||||
// which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0
|
||||
//
|
||||
// Contributors:
|
||||
// Red Hat, Inc. - initial API and implementation
|
||||
//
|
||||
package util
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
namespaceFile = "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
|
||||
)
|
||||
|
||||
var operator_namespace string
|
||||
|
||||
func readNamespace() string {
|
||||
nsBytes, err := ioutil.ReadFile(namespaceFile)
|
||||
if err != nil {
|
||||
logrus.Fatal("Failed to get operator namespace", err)
|
||||
}
|
||||
return string(nsBytes)
|
||||
}
|
||||
|
||||
// GetCheOperatorNamespace returns namespace for current Eclipse Che operator.
|
||||
func GetCheOperatorNamespace() string {
|
||||
if operator_namespace == "" && !IsTestMode() {
|
||||
operator_namespace = readNamespace()
|
||||
}
|
||||
return operator_namespace
|
||||
}
|
||||
Loading…
Reference in New Issue