func (spec *AdjustmentSpec) compareResources(other *AdjustmentSpec) bool {
	switch {
	case spec == nil && other == nil:
		return true
	case spec != nil && other == nil:
		return true
	case spec == nil && other != nil:
		return true
	case spec.Resources == nil && other.Resources == nil:
		return true
	case spec.Resources != nil && other.Resources == nil:
		return false
	case spec.Resources == nil && other.Resources != nil:
		return false
	}
	r := *spec.Resources
	o := *other.Resources
	if len(r.Requests) != len(o.Requests) {
		return false
	}
	if len(r.Limits) != len(o.Limits) {
		return false
	}
	for name, qty := range r.Requests {
		oqty, ok := o.Requests[name]
		if !ok || qty.Cmp(oqty) != 0 {
			return false
		}
	}
	for name, qty := range r.Limits {
		oqty, ok := o.Limits[name]
		if !ok || qty.Cmp(oqty) != 0 {
			return false
		}
	}
	return true
}
Check if the resources in this spec are identical to another one.
package v1alpha1
import (
	"fmt"
	"strings"
	resmgr "github.com/intel/cri-resource-manager/pkg/apis/resmgr"
	corev1 "k8s.io/api/core/v1"
)
func (a *Adjustment) HasSameVersion(o *Adjustment) bool {
	if a.ResourceVersion != o.ResourceVersion {
		return false
	}
	if a.Generation != o.Generation {
		return false
	}
	return true
}
func (spec *AdjustmentSpec) NodeScope(node string) []AdjustmentScope {
	filtered := []AdjustmentScope{}
	for _, scope := range spec.Scope {
		if scope.IsNodeInScope(node) {
			filtered = append(filtered, scope)
		}
	}
	return filtered
}
func (spec *AdjustmentSpec) GetResourceRequirements() (corev1.ResourceRequirements, bool) {
	if spec.Resources != nil {
		return *spec.Resources, true
	}
	return corev1.ResourceRequirements{}, false
}
func (spec *AdjustmentSpec) GetRDTClass() (string, bool) {
	if spec.Classes == nil || spec.Classes.RDT == nil {
		return "", false
	}
	return *spec.Classes.RDT, true
}
func (spec *AdjustmentSpec) GetBlockIOClass() (string, bool) {
	if spec.Classes == nil || spec.Classes.BlockIO == nil {
		return "", false
	}
	return *spec.Classes.BlockIO, true
}
func (spec *AdjustmentSpec) IsNodeInScope(node string) bool {
	if len(spec.Scope) == 0 {
		return true
	}
	for _, s := range spec.Scope {
		if s.IsNodeInScope(node) {
			return true
		}
	}
	return false
}
func (spec *AdjustmentSpec) IsContainerInScope(container resmgr.Evaluable) bool {
	if len(spec.Scope) == 0 {
		return true
	}
	for _, s := range spec.Scope {
		if s.IsContainerInScope(container) {
			return true
		}
	}
	return false
}
func (spec *AdjustmentSpec) Compare(other *AdjustmentSpec) bool {
	switch {
	case !CompareScopes(spec.Scope, other.Scope):
		return false
	case !spec.compareResources(other):
		return false
	case !spec.Classes.Compare(other.Classes):
		return false
	case spec.ToptierLimit == nil && other.ToptierLimit != nil:
		return false
	case spec.ToptierLimit != nil && other.ToptierLimit == nil:
		return false
	case spec.ToptierLimit != nil && spec.ToptierLimit.Value() != other.ToptierLimit.Value():
		return false
	}
	return true
}
func (spec *AdjustmentSpec) Verify() error {
	if err := spec.verifyResources(); err != nil {
		return err
	}
	if err := spec.verifyToptierLimit(); err != nil {
		return err
	}
	return nil
}