Skip to content

Commit

Permalink
Validated ScheduledWorkflow Owner fields
Browse files Browse the repository at this point in the history
Signed-off-by: hbelmiro <[email protected]>
  • Loading branch information
hbelmiro committed Apr 16, 2024
1 parent ad71a6a commit 4bc850e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,16 +1014,20 @@ func (r *ResourceManager) CreateJob(ctx context.Context, job *model.Job) (*model

func (r *ResourceManager) getOwnerReferences() []v1.OwnerReference {
ownerName := common.GetStringConfigWithDefault("OWNER_NAME", "")
ownerAPIVersion := common.GetStringConfigWithDefault("OWNER_API_VERSION", "")
ownerKind := common.GetStringConfigWithDefault("OWNER_KIND", "")
ownerUID := types.UID(common.GetStringConfigWithDefault("OWNER_UID", ""))

if ownerName == "" {
if ownerName == "" || ownerAPIVersion == "" || ownerKind == "" || ownerUID == "" {
glog.Info("Missing ScheduledWorkflow owner fields. Proceeding without OwnerReferences")
return []v1.OwnerReference{}
} else {
return []v1.OwnerReference{
{
APIVersion: common.GetStringConfig("OWNER_API_VERSION"),
Kind: common.GetStringConfig("OWNER_KIND"),
APIVersion: ownerAPIVersion,
Kind: ownerKind,
Name: ownerName,
UID: types.UID(common.GetStringConfig("OWNER_UID")),
UID: ownerUID,
},
}
}
Expand Down

0 comments on commit 4bc850e

Please sign in to comment.