func CompareInstances()

in pkg/cloud_provider/lustre/lustre.go [341:364]


func CompareInstances(a, b *ServiceInstance) error {
	mismatches := []string{}
	if a.Name != b.Name {
		mismatches = append(mismatches, "instance name")
	}
	if a.Project != b.Project {
		mismatches = append(mismatches, "instance project")
	}
	if a.Location != b.Location {
		mismatches = append(mismatches, "instance location")
	}
	if a.CapacityGib != b.CapacityGib {
		mismatches = append(mismatches, "instance size")
	}
	if a.Network != b.Network {
		mismatches = append(mismatches, "network name")
	}

	if len(mismatches) > 0 {
		return fmt.Errorf("instance %s already exists but doesn't match expected: %+v", a.Name, mismatches)
	}

	return nil
}