prow/cmd/admission/admission.go
func onlyUpdateStatus(req admissionapi.AdmissionRequest) (*admissionapi.AdmissionResponse, error) {
	logger := logrus.WithFields(logrus.Fields{
		"resource":    req.Resource,
		"subresource": req.SubResource,
		"name":        req.Name,
		"namespace":   req.Namespace,
		"operation":   req.Operation,
	})

	// Does this only update status?
	if req.SubResource == "status" {
		logrus.Info("accept status update")
		return &allow, nil
	}

	// Otherwise, do the specs match?
	var new prowjobv1.ProwJob
	if _, _, err := codecs.UniversalDeserializer().Decode(req.Object.Raw, nil, &new); err != nil {
		return nil, fmt.Errorf("decode new: %v", err)
	}
	var old prowjobv1.ProwJob
	if _, _, err := codecs.UniversalDeserializer().Decode(req.OldObject.Raw, nil, &old); err != nil {
		return nil, fmt.Errorf("decode old: %v", err)
	}
	if equality.Semantic.DeepEqual(old.Spec, new.Spec) {
		logrus.Info("accept update with equivalent spec")
		return &allow, nil // yes
	}
	logger.Info("reject") // no
	return &reject, nil
}
func onlyUpdateStatus(req admissionapi.AdmissionRequest) (*admissionapi.AdmissionResponse, error) {
	logger := logrus.WithFields(logrus.Fields{
		"resource":    req.Resource,
		"subresource": req.SubResource,
		"name":        req.Name,
		"namespace":   req.Namespace,
		"operation":   req.Operation,
	})

	// Does this only update status?
	if req.SubResource == "status" {
		logrus.Info("accept status update")
		return &allow, nil
	}

	// Otherwise, do the specs match?
	var new prowjobv1.ProwJob
	if _, _, err := codecs.UniversalDeserializer().Decode(req.Object.Raw, nil, &new); err != nil {
		return nil, fmt.Errorf("decode new: %v", err)
	}
	var old prowjobv1.ProwJob
	if _, _, err := codecs.UniversalDeserializer().Decode(req.OldObject.Raw, nil, &old); err != nil {
		return nil, fmt.Errorf("decode old: %v", err)
	}
	if equality.Semantic.DeepEqual(old.Spec, new.Spec) {
		logrus.Info("accept update with equivalent spec")
		return &allow, nil // yes
	}
	logger.Info("reject") // no
	return &reject, nil
}
func onlyUpdateStatus ( req admissionapi . AdmissionRequest ) ( * admissionapi . AdmissionResponse , error ) { logger := logrus . WithFields ( logrus . Fields { " " : req . Resource , " " : req . SubResource , " " : req . Name , " " : req . Namespace , " " : req . Operation , } ) // Does this only update status? if req . SubResource == " " { logrus . Info ( " " ) return & allow , nil } // Otherwise, do the specs match? var new prowjobv1 . ProwJob if _ , _ , err := codecs . UniversalDeserializer ( ) . Decode ( req . Object . Raw , nil , & new ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } var old prowjobv1 . ProwJob if _ , _ , err := codecs . UniversalDeserializer ( ) . Decode ( req . OldObject . Raw , nil , & old ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } if equality . Semantic . DeepEqual ( old . Spec , new . Spec ) { logrus . Info ( " " ) return & allow , nil // yes } logger . Info ( " " ) // no return & reject , nil }
// onlyUpdateStatus returns the response to the request
onlyUpdateStatus returns the response to the request