fix: resolve finalize is not working in some cases
This commit is contained in:
parent
346f69100c
commit
b33dc0ba1d
@ -4,6 +4,7 @@ import (
|
|||||||
"flink-kube-operator/internal/crd/v1alpha1"
|
"flink-kube-operator/internal/crd/v1alpha1"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/reactivex/rxgo/v2"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/client-go/dynamic"
|
"k8s.io/client-go/dynamic"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
@ -48,11 +49,13 @@ func New() *Crd {
|
|||||||
runtimeClient: runtimeClient,
|
runtimeClient: runtimeClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watch for FlinkJob creation
|
jobEventCh := make(chan rxgo.Item)
|
||||||
jobEventObservable := crd.watchFlinkJobs()
|
|
||||||
|
|
||||||
// add finalizer to new resources
|
// add finalizer to new resources
|
||||||
go crd.manageFinalizer(jobEventObservable)
|
go crd.manageFinalizer(rxgo.FromChannel(jobEventCh))
|
||||||
|
|
||||||
|
// Watch for FlinkJob creation
|
||||||
|
crd.watchFlinkJobs(jobEventCh)
|
||||||
|
|
||||||
return &crd
|
return &crd
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,9 +15,7 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/watch"
|
"k8s.io/apimachinery/pkg/watch"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (crd Crd) watchFlinkJobs() rxgo.Observable {
|
func (crd Crd) watchFlinkJobs(ch chan rxgo.Item) rxgo.Observable {
|
||||||
|
|
||||||
ch := make(chan rxgo.Item)
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
pkg.Logger.Debug("[crd] starting watch")
|
pkg.Logger.Debug("[crd] starting watch")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user