Skip to content

Commit

Permalink
Update webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangpengcheng committed Sep 11, 2023
1 parent 638d8a1 commit e959d3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/webhook/function_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,15 @@ func (webhook *FunctionWebhook) ValidateCreate(ctx context.Context, obj runtime.
allErrs = append(allErrs, field.Invalid(field.NewPath("name"), r.Name, "function name is not provided"))
}

if r.Spec.Runtime.Java == nil && r.Spec.Runtime.Python == nil && r.Spec.Runtime.Golang == nil {
if r.Spec.Runtime.Java == nil && r.Spec.Runtime.Python == nil && r.Spec.Runtime.Golang == nil && r.Spec.GenericRuntime == nil {
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("runtime", "java"), r.Spec.Runtime.Java,
"runtime cannot be empty"))
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("runtime", "python"), r.Spec.Runtime.Python,
"runtime cannot be empty"))
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("runtime", "golang"), r.Spec.Runtime.Golang,
"runtime cannot be empty"))
allErrs = append(allErrs, field.Invalid(field.NewPath("spec").Child("runtime", "genericRuntime"), r.Spec.Runtime.GenericRuntime,
"runtime cannot be empty"))
}

if (r.Spec.Runtime.Java != nil && r.Spec.Runtime.Python != nil) ||
Expand Down

0 comments on commit e959d3c

Please sign in to comment.