code: func (kl *Kubelet) getServiceEnvVarMap(ns string, enableServiceLinks bool) (map[string]string, error) {
  	var (
  		serviceMap = make(map[string]*v1.Service)
  		m          = make(map[string]string)
  	)
  
  	// Get all service resources from the master (via a cache),
  	// and populate them into service environment variables.
  	if kl.serviceLister == nil {
  		// Kubelets without masters (e.g. plain GCE ContainerVM) don't set env vars.
  		return m, nil
  	}
  	services, err := kl.serviceLister.List(labels.Everything())
  	if err != nil {
  		return m, fmt.Errorf("failed to list services when setting up env vars")
  	}
  
  	// project the services in namespace ns onto the master services
  	for i := range services {
  		service := services[i]
  		// ignore services where ClusterIP is "None" or empty
  		if !v1helper.IsServiceIPSet(service) {
  			continue
  		}
  		serviceName := service.Name
  
  		// We always want to add environment variabled for master services
  		// from the master service namespace, even if enableServiceLinks is false.
  		// We also add environment variables for other services in the same
  		// namespace, if enableServiceLinks is true.
  		if service.Namespace == kl.masterServiceNamespace && masterServices.Has(serviceName) {
  			if _, exists := serviceMap[serviceName]; !exists {
  				serviceMap[serviceName] = service
  			}
  		} else if service.Namespace == ns && enableServiceLinks {
  			serviceMap[serviceName] = service
  		}
  	}
  
  	mappedServices := []*v1.Service{}
  	for key := range serviceMap {
  		mappedServices = append(mappedServices, serviceMap[key])
  	}
  
  	for _, e := range envvars.FromServices(mappedServices) {
  		m[e.Name] = e.Value
  	}
  	return m, nil
  }
docs: // getServiceEnvVarMap makes a map[string]string of env vars for services a
  // pod in namespace ns should see.