func()

in pkg/bundle/manager.go [47:85]


func (m bundleManager) ProcessBundle(_ context.Context, newBundle *api.PackageBundle) (bool, error) {
	if newBundle.Namespace != api.PackageNamespace {
		if newBundle.Status.State != api.PackageBundleStateIgnored {
			newBundle.Spec.DeepCopyInto(&newBundle.Status.Spec)
			newBundle.Status.State = api.PackageBundleStateIgnored
			m.log.V(6).Info("update", "bundle", newBundle.Name, "state", newBundle.Status.State)
			return true, nil
		}
		return false, nil
	}

	if !m.isCompatibleWith(newBundle) {
		if newBundle.Status.State != api.PackageBundleStateUpgradeRequired {
			newBundle.Spec.DeepCopyInto(&newBundle.Status.Spec)
			newBundle.Status.State = api.PackageBundleStateUpgradeRequired
			m.log.V(6).Info("update", "bundle", newBundle.Name, "state", newBundle.Status.State)
			return true, nil
		}
		return false, nil
	}

	if !newBundle.IsValidVersion() {
		if newBundle.Status.State != api.PackageBundleStateInvalid {
			newBundle.Spec.DeepCopyInto(&newBundle.Status.Spec)
			newBundle.Status.State = api.PackageBundleStateInvalid
			m.log.V(6).Info("update", "bundle", newBundle.Name, "state", newBundle.Status.State)
			return true, nil
		}
		return false, nil
	}

	if newBundle.Status.State != api.PackageBundleStateAvailable {
		newBundle.Spec.DeepCopyInto(&newBundle.Status.Spec)
		newBundle.Status.State = api.PackageBundleStateAvailable
		m.log.V(6).Info("update", "bundle", newBundle.Name, "state", newBundle.Status.State)
		return true, nil
	}
	return false, nil
}