Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when creating Knative Service: Admission webhook denied request due to metadata.name change validation #15607

Open
helloxjade opened this issue Nov 8, 2024 · 0 comments
Labels
kind/question Further information is requested

Comments

@helloxjade
Copy link

Description: I encountered an issue when trying to create a new Knative Service. Even though the service is newly created, I receive an error related to the validation of the metadata.name in spec.template. The error suggests that the service is attempting a change without a corresponding name update, which is unexpected for a newly created resource.

Error Message:


Failed to create Knative Service: admission webhook "validation.webhook.serving.knative.dev" denied the request: validation failed: Saw the following changes without a name change (-old +new): spec.template.metadata.name...

Expected Behavior: As this is a new service creation, there should be no conflict or validation errors on metadata.name in spec.template.

Steps to Reproduce:

"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
if _, err := controllerutil.CreateOrUpdate(ctx, ksb.KnativeClient, knservice, ksb.MutateKnServiceFn(knservice, sapp)); err != nil {
// 如果不是资源版本冲突错误,记录事件和日志
if !apierrors.IsConflict(err) {
ksb.EventRecorder.RecordEventf(sapp, corev1.EventTypeWarning, util.EventReasonFailedCreateKsvc, util.FailedCreateKsvcMsg, err.Error())
klog.Errorf("Failed to create or update knservice for app: %s, error: %v", sapp.Name, err)
}
// 返回错误,触发重试机制
return err
}
If applicable, mention whether CreateOrUpdate with mutate functions was used and if the mutation involved changes to metadata.
Environment:

Knative version: v1.11.4
Kubernetes version: Kubernetes v1.25.14
Client tools or libraries:

Any insight into this validation behavior or recommended configurations to avoid this error would be helpful. Thanks!

@helloxjade helloxjade added the kind/question Further information is requested label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant