func unloadBackingServiceInstanceLabel(client osclient.Interface, application *api.Application, labelSelector labels.Selector) error { resourceList, _ := client.BackingServiceInstances(application.Namespace).List(kapi.ListOptions{LabelSelector: labelSelector, FieldSelector: fields.Everything()}) errs := []error{} for _, resource := range resourceList.Items { if !hasItem(application.Spec.Items, api.Item{Kind: "BackingServiceInstance", Name: resource.Name}) { delete(resource.Labels, fmt.Sprintf("%s.application.%s", application.Namespace, application.Name)) if _, err := client.BackingServiceInstances(application.Namespace).Update(&resource); err != nil { errs = append(errs, err) } } } return nil }