Merge pull request #98138 from lala123912/log_format_admission
staging/src/k8s.io/apiserver/pkg/admission: migrate to structured logs
This commit is contained in:
		| @@ -140,7 +140,7 @@ func (l *Lifecycle) Admit(ctx context.Context, a admission.Attributes, o admissi | ||||
| 			exists = true | ||||
| 		} | ||||
| 		if exists { | ||||
| 			klog.V(4).Infof("found %s in cache after waiting", a.GetNamespace()) | ||||
| 			klog.V(4).InfoS("Namespace existed in cache after waiting", "namespace", klog.KRef("", a.GetNamespace())) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| @@ -161,7 +161,8 @@ func (l *Lifecycle) Admit(ctx context.Context, a admission.Attributes, o admissi | ||||
| 		case err != nil: | ||||
| 			return errors.NewInternalError(err) | ||||
| 		} | ||||
| 		klog.V(4).Infof("found %s via storage lookup", a.GetNamespace()) | ||||
|  | ||||
| 		klog.V(4).InfoS("Found namespace via storage lookup", "namespace", klog.KRef("", a.GetNamespace())) | ||||
| 	} | ||||
|  | ||||
| 	// ensure that we're not trying to create objects in terminating namespaces | ||||
|   | ||||
| @@ -377,7 +377,7 @@ func getMatchedLimitedScopes(evaluator quota.Evaluator, inputObject runtime.Obje | ||||
| 	for _, limitedResource := range limitedResources { | ||||
| 		matched, err := evaluator.MatchingScopes(inputObject, limitedResource.MatchScopes) | ||||
| 		if err != nil { | ||||
| 			klog.Errorf("Error while matching limited Scopes: %v", err) | ||||
| 			klog.ErrorS(err, "Error while matching limited Scopes") | ||||
| 			return []corev1.ScopedResourceSelectorRequirement{}, err | ||||
| 		} | ||||
| 		for _, scope := range matched { | ||||
| @@ -449,6 +449,8 @@ func CheckRequest(quotas []corev1.ResourceQuota, a admission.Attributes, evaluat | ||||
| 		match, err := evaluator.Matches(&resourceQuota, inputObject) | ||||
| 		if err != nil { | ||||
| 			klog.Errorf("Error occurred while matching resource quota, %v, against input object. Err: %v", resourceQuota, err) | ||||
| 			klog.ErrorS(err, "Error occurred while matching resource quota against input object", | ||||
| 				"resourceQuota", resourceQuota) | ||||
| 			return quotas, err | ||||
| 		} | ||||
| 		if !match { | ||||
|   | ||||
| @@ -36,7 +36,7 @@ func matchObject(obj runtime.Object, selector labels.Selector) bool { | ||||
| 	} | ||||
| 	accessor, err := meta.Accessor(obj) | ||||
| 	if err != nil { | ||||
| 		klog.V(5).Infof("cannot access metadata of %v: %v", obj, err) | ||||
| 		klog.V(5).InfoS("Accessing metadata failed", "object", obj, "err", err) | ||||
| 		return false | ||||
| 	} | ||||
| 	return selector.Matches(labels.Set(accessor.GetLabels())) | ||||
|   | ||||
| @@ -81,7 +81,7 @@ func (ps *Plugins) Register(name string, plugin Factory) { | ||||
| 		ps.registry = map[string]Factory{} | ||||
| 	} | ||||
|  | ||||
| 	klog.V(1).Infof("Registered admission plugin %q", name) | ||||
| 	klog.V(1).InfoS("Registered admission plugin", "plugin", name) | ||||
| 	ps.registry[name] = plugin | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot