feet: add finalizer

This commit is contained in:
2025-01-11 00:25:57 +03:30
parent 14aba80181
commit ef7b16af68
10 changed files with 101 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ import (
"context"
"flink-kube-operator/internal/crd"
"flink-kube-operator/internal/crd/v1alpha1"
"flink-kube-operator/internal/manager"
"flink-kube-operator/internal/managed_job"
"k8s.io/apimachinery/pkg/types"
)
@@ -39,7 +39,7 @@ type StopJobResp struct {
}
func StopJob(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
mgr := manager.GetManager()
mgr := managed_job.GetManager()
job := mgr.GetJob(types.UID(req.JobUId))
err := job.Stop()
if err != nil {
@@ -51,7 +51,7 @@ func StopJob(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
}
func StartJob(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
mgr := manager.GetManager()
mgr := managed_job.GetManager()
job := mgr.GetJob(types.UID(req.JobUId))
err := job.Run(true)
if err != nil {
@@ -63,7 +63,7 @@ func StartJob(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
}
func RemoveJobJar(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
mgr := manager.GetManager()
mgr := managed_job.GetManager()
job := mgr.GetJob(types.UID(req.JobUId))
job.RemoveJar()
return &StopJobResp{Body: StopJobRespBody{
@@ -72,7 +72,7 @@ func RemoveJobJar(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
}
func PauseJob(ctx context.Context, req *StopJobReq) (*StopJobResp, error) {
mgr := manager.GetManager()
mgr := managed_job.GetManager()
job := mgr.GetJob(types.UID(req.JobUId))
job.Pause()
return &StopJobResp{Body: StopJobRespBody{