Skip to content

Commit

Permalink
bugfix (#1391)
Browse files Browse the repository at this point in the history
Signed-off-by: theonefx <[email protected]>
  • Loading branch information
theonefx authored Apr 20, 2023
1 parent 260a5b3 commit cb29dc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/webhook/yurtappset/v1alpha1/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`"))
Expand Down

0 comments on commit cb29dc3

Please sign in to comment.