Skip to content

Commit 6ea10d4

Browse files
authored
Merge pull request noobaa#1773 from liranmauda/liran-backport-into-5.16
[Backport into 5.16] Backport into 5.16
2 parents 21c104c + eda8232 commit 6ea10d4

9 files changed

Lines changed: 47 additions & 12 deletions

File tree

.github/workflows/run_hac_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: HAC on KIND cluster Test
2-
on: [push, pull_request, workflow_dispatch]
2+
on: [workflow_dispatch]
33

44
jobs:
55
run-hac-test:

deploy/internal/statefulset-postgres-db.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ spec:
7979
app: noobaa
8080
spec:
8181
accessModes:
82-
- ReadWriteOnce
82+
- ReadWriteOncePod
8383
resources:
8484
requests:
8585
storage: 50Gi

deploy/olm/noobaa-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ metadata:
1717
spec:
1818
displayName: NooBaa Operator
1919
version: "999.999.999-placeholder"
20-
minKubeVersion: 1.16.0
20+
minKubeVersion: 1.22.0
2121
maturity: alpha
2222
provider:
2323
name: NooBaa

deploy/role_core.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ rules:
4545
- securitycontextconstraints
4646
verbs:
4747
- use
48+
- apiGroups:
49+
- route.openshift.io
50+
resources:
51+
- routes
52+
verbs:
53+
- get
54+
- create
55+
- update
56+
- list
57+
- watch

pkg/bundle/deploy.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5053,7 +5053,7 @@ spec:
50535053
resource: limits.memory
50545054
`
50555055

5056-
const Sha256_deploy_internal_statefulset_postgres_db_yaml = "d0242805c8719ef45290746b42706fb69805cfd40be6258986454d256112fa7c"
5056+
const Sha256_deploy_internal_statefulset_postgres_db_yaml = "75dbbabf763a3a186955e50c5cd7cb5647f91fde8ff67c6f2f1ce760a5cc68e7"
50575057

50585058
const File_deploy_internal_statefulset_postgres_db_yaml = `apiVersion: apps/v1
50595059
kind: StatefulSet
@@ -5136,7 +5136,7 @@ spec:
51365136
app: noobaa
51375137
spec:
51385138
accessModes:
5139-
- ReadWriteOnce
5139+
- ReadWriteOncePod
51405140
resources:
51415141
requests:
51425142
storage: 50Gi
@@ -5826,7 +5826,7 @@ s3 ls s3://first.bucket
58265826
` + "`" + `` + "`" + `` + "`" + `
58275827
`
58285828

5829-
const Sha256_deploy_olm_noobaa_operator_clusterserviceversion_yaml = "900ed615837a7f63510de5bff4bd8ffdcc02bea8cec0cf231d21e32812f78ed7"
5829+
const Sha256_deploy_olm_noobaa_operator_clusterserviceversion_yaml = "2f7f9cc33520110f72cbe7f9ae3e07404ec9189129a16c9102883d7d13818ecd"
58305830

58315831
const File_deploy_olm_noobaa_operator_clusterserviceversion_yaml = `apiVersion: operators.coreos.com/v1alpha1
58325832
kind: ClusterServiceVersion
@@ -5847,7 +5847,7 @@ metadata:
58475847
spec:
58485848
displayName: NooBaa Operator
58495849
version: "999.999.999-placeholder"
5850-
minKubeVersion: 1.16.0
5850+
minKubeVersion: 1.22.0
58515851
maturity: alpha
58525852
provider:
58535853
name: NooBaa
@@ -6308,7 +6308,7 @@ subjects:
63086308
name: custom-metrics-prometheus-adapter
63096309
`
63106310

6311-
const Sha256_deploy_role_core_yaml = "c3cfb5b87298224fd6e4e4bff32d3948ad168a0110b8569118a260739ef5d5e7"
6311+
const Sha256_deploy_role_core_yaml = "1ec420603dcec64b247852d106535a85a1a866129f78f790c2e5c9285f029ae7"
63126312

63136313
const File_deploy_role_core_yaml = `apiVersion: rbac.authorization.k8s.io/v1
63146314
kind: Role
@@ -6357,6 +6357,16 @@ rules:
63576357
- securitycontextconstraints
63586358
verbs:
63596359
- use
6360+
- apiGroups:
6361+
- route.openshift.io
6362+
resources:
6363+
- routes
6364+
verbs:
6365+
- get
6366+
- create
6367+
- update
6368+
- list
6369+
- watch
63606370
`
63616371

63626372
const Sha256_deploy_role_db_yaml = "bc7eeca1125dfcdb491ab8eb69e3dcbce9f004a467b88489f85678b3c6872cce"

pkg/controller/add_hac.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package controller
22

33
import (
4+
"os"
5+
46
hac "github.com/noobaa/noobaa-operator/v5/pkg/controller/ha"
57
)
68

79
func init() {
8-
// AddToManagerFuncs is a list of functions to create controllers and add them to a manager.
9-
AddToManagerFuncs = append(AddToManagerFuncs, hac.Add)
10+
hacEnabled := os.Getenv("HAC_ENABLED")
11+
if hacEnabled == "true" {
12+
// AddToManagerFuncs is a list of functions to create controllers and add them to a manager.
13+
AddToManagerFuncs = append(AddToManagerFuncs, hac.Add)
14+
}
1015
}

pkg/controller/ha/ha_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ func nodeNotReadyPredicate() predicate.Predicate {
7171

7272
// Add creates a nodewatcher Controller and adds it to the Manager.
7373
func Add(mgr manager.Manager) error {
74+
util.Logger().Info("Adding high availability controller (HAC)")
7475

7576
opts := controller.Options{
7677
MaxConcurrentReconciles: 1,

pkg/hac/hac.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package hac
55

66
import (
77
"context"
8+
"os"
89

910
"github.com/pkg/errors"
1011
"github.com/sirupsen/logrus"
@@ -43,8 +44,12 @@ func (pd *PodDeleter) DeletePodsOnNode() error {
4344
return errors.Errorf("failed to list noobaa pods on the node %v in namespace %v", pd.NodeName, options.Namespace)
4445
}
4546

46-
// delete the found pods
47-
var gracePeriod int64 = 0
47+
// delete the found pods. by default using a 1 second grace period.
48+
var gracePeriod int64 = 1
49+
if os.Getenv("HAC_FORCE_DELETE") == "true" {
50+
// if HAC_FORCE_DELETE is set to true, use a 0 second grace period.
51+
gracePeriod = 0
52+
}
4853
deleteOpts := client.DeleteOptions{GracePeriodSeconds: &gracePeriod}
4954
for _, pod := range podList.Items {
5055
if err := pd.Client.Delete(context.Background(), &pod, &deleteOpts); err != nil {

pkg/system/phase2_creating.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@ func (r *Reconciler) SetDesiredCoreApp() error {
445445
r.CoreApp.Spec.ServiceName = r.ServiceMgmt.Name
446446

447447
podSpec := &r.CoreApp.Spec.Template.Spec
448+
// set the termination grace period for noobaa-core pod.
449+
// For now we set it to 1 second. A better approach should be to implement a graceful shutdown for the noobaa-core pod when SIGTERM is received.
450+
terminationGracePeriodSeconds := int64(1)
451+
podSpec.TerminationGracePeriodSeconds = &terminationGracePeriodSeconds
448452
podSpec.ServiceAccountName = "noobaa-core"
449453
coreImageChanged := false
450454

0 commit comments

Comments
 (0)