code: func FromServices(services []*v1.Service) []v1.EnvVar {
  	var result []v1.EnvVar
  	for i := range services {
  		service := services[i]
  
  		// ignore services where ClusterIP is "None" or empty
  		// the services passed to this method should be pre-filtered
  		// only services that have the cluster IP set should be included here
  		if !v1helper.IsServiceIPSet(service) {
  			continue
  		}
  
  		// Host
  		name := makeEnvVariableName(service.Name) + "_SERVICE_HOST"
  		result = append(result, v1.EnvVar{Name: name, Value: service.Spec.ClusterIP})
  		// First port - give it the backwards-compatible name
  		name = makeEnvVariableName(service.Name) + "_SERVICE_PORT"
  		result = append(result, v1.EnvVar{Name: name, Value: strconv.Itoa(int(service.Spec.Ports[0].Port))})
  		// All named ports (only the first may be unnamed, checked in validation)
  		for i := range service.Spec.Ports {
  			sp := &service.Spec.Ports[i]
  			if sp.Name != "" {
  				pn := name + "_" + makeEnvVariableName(sp.Name)
  				result = append(result, v1.EnvVar{Name: pn, Value: strconv.Itoa(int(sp.Port))})
  			}
  		}
  		// Docker-compatible vars.
  		result = append(result, makeLinkVariables(service)...)
  	}
  	return result
  }
docs: // FromServices builds environment variables that a container is started with,
  // which tell the container where to find the services it may need, which are
  // provided as an argument.