From 6057589ad75d0ece55fd0c033d40cc86c95c0495 Mon Sep 17 00:00:00 2001 From: theonefx Date: Wed, 19 Apr 2023 09:33:34 +0800 Subject: [PATCH] bugfix Signed-off-by: theonefx --- pkg/webhook/yurtappset/v1alpha1/validate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/webhook/yurtappset/v1alpha1/validate.go b/pkg/webhook/yurtappset/v1alpha1/validate.go index fd5ea59937e..00e336eebe2 100644 --- a/pkg/webhook/yurtappset/v1alpha1/validate.go +++ b/pkg/webhook/yurtappset/v1alpha1/validate.go @@ -53,7 +53,6 @@ func validateYurtAppSetSpec(c client.Client, spec *unitv1alpha1.YurtAppSetSpec, } } - klog.Infof("sel:%v, label: %v\n", spec.Selector, spec.WorkloadTemplate.DeploymentTemplate.Labels) klog.Infof("templatePath:%s", fldPath.Child("workloadTemplate").String()) selector, err := metav1.LabelSelectorAsSelector(spec.Selector) @@ -209,9 +208,10 @@ func validatePoolTemplate(template *unitv1alpha1.WorkloadTemplate, spec *unitv1a klog.Infoln("call webhook validatePoolTemplate") if template.DeploymentTemplate != nil { + klog.Infof("sel:%v, label: %v\n", spec.Selector, spec.WorkloadTemplate.DeploymentTemplate.Labels) + labels := labels.Set(template.DeploymentTemplate.Labels) if !selector.Matches(labels) { - klog.Errorf("labels: %v, selector: %v", labels, selector) allErrs = append(allErrs, field.Invalid(fldPath.Child("deploymentTemplate", "metadata", "labels"), template.DeploymentTemplate.Labels, "`selector` does not match template `labels`"))