Skip to content

Commit

Permalink
fix(recurring-job): missing name in spec
Browse files Browse the repository at this point in the history
longhorn/longhorn-6534

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and derekbit committed Jan 22, 2025
1 parent b73c24c commit ca32967
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions webhook/resources/recurringjob/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func (r *recurringJobMutator) Create(request *admission.Request, newObj runtime.
if name != recurringjob.Name {
patchOps = append(patchOps, fmt.Sprintf(`{"op": "replace", "path": "/metadata/name", "value": "%s"}`, name))
}
if recurringjob.Spec.Name == "" {
patchOps = append(patchOps, fmt.Sprintf(`{"op": "replace", "path": "/spec/name", "value": "%s"}`, recurringjob.Name))
}
if recurringjob.Spec.Groups == nil {
patchOps = append(patchOps, `{"op": "replace", "path": "/spec/groups", "value": []}`)
}
Expand Down

0 comments on commit ca32967

Please sign in to comment.