add RFC952 validation to labels

Add label validation of labels to  pods, services, relicationControllers, and replControllerState

Fixes #1297
I just proposed on #1323 to abandon #1323 and defer making a decision on
how to namespace labels until we have a genuine case of need at hand.

In terms of what format to use: I think labels are going to be at their
most useful when they result in succinct UIs and config files.  So, I don't
object to 952 if that is shorter.

On Mon, Oct 20, 2014 at 6:34 PM, Tim Hockin <notifications@github.com>
wrote:

> In pkg/api/validation/validation.go:
>
> > @@ -339,6 +339,17 @@ func ValidatePod(pod *api.Pod) errs.ErrorList {
> >  		allErrs = append(allErrs, errs.NewFieldInvalid("namespace", pod.Namespace))
> >  	}
> >  	allErrs = append(allErrs, ValidatePodState(&pod.DesiredState).Prefix("desiredState")...)
> > +	for k := range pod.Labels {
> > +		allErrs = append(allErrs, validateLabel(k)...)
> > +	}
> > +	return allErrs
> > +}
> > +
> > +func validateLabel(label string) errs.ErrorList {
> > +	allErrs := errs.ErrorList{}
> > +	if !util.IsDNS952Label(label) {
>
> 952 is the much stricter form of DNS label. Do we need the strict form
> here? And is DNS Label the correct input formatter? And what about
> Annotations (new in v1beta3)?
>
> Where are label/annotation keys to be used? Will they be converted to
> environment variables?
>
> I really do think they need to be namespaceable, and I don't think this
> regex is sufficient. Would there be any harm in this becoming
> [DNS_SUBDOMAIN/]DNS_SUBDOMAIN - the same as resource types after #1323
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/1323> goes
> through The implication of leaving off the first part are different, but I
> can live with that. @erictune <https://github.com/erictune>
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/GoogleCloudPlatform/kubernetes/pull/1830/files#r19125636>
> .
>