Package validation has functions for validating the correctness of api objects and explaining what is wrong with them when they aren't valid.
AccumulateUniquePorts runs an extraction function on each Port of each Container, accumulating the results and returning an error if any ports conflict.
ValidateBoundPod tests if required fields on a bound pod are set.
ValidateManifest tests that the specified ContainerManifest has valid data. This includes checking formatting and uniqueness. It also canonicalizes the structure by setting default values and implementing any backwards-compatibility tricks.
ValidatePod tests if required fields in the pod are set.
ValidatePodUpdate tests to see if the update is legal
ValidateReplicationController tests if required fields in the replication controller are set.
func ValidateReplicationControllerState(state *api.ReplicationControllerState) errs.ValidationErrorList
ValidateReplicationControllerState tests if required fields in the replication controller state are set.
ValidateService tests if required fields in the service are set.