// AddLibraryNamespace explicitly appends the `library` namespace used for
// official images.
512221
func (u *DockerRegistryURL) AddLibraryNamespace() {
	// If the image name does not contain '/', it is intended to be an official
	// image; so we add the `library` namespace to the URL.
	if !strings.Contains(u.ImageName, "/") {
		u.ImageName = fmt.Sprintf("library/%s", u.ImageName)
	}
}
756793
func LoadNamespaces(ctx context.Context, qs graph.QuadStore, dest *voc.Namespaces) error {
	return global.LoadNamespaces(ctx, qs, dest)
}
580377
func (s *DescribeUserInput) SetNamespace(v string) *DescribeUserInput {
	s.Namespace = &v
	return s
}
626286
func ImageNamespace(conf *yaml.Config, namespace string) error {
	for _, image := range conf.Pipeline {
		if strings.Contains(image.Image, "/") {
			continue
		}
		if !isPlugin(image) {
			continue
		}
		image.Image = filepath.Join(namespace, image.Image)
	}
	return nil
}
851188
func (mc *metricCatalog) Add(m *metricType) {
	mc.mutex.Lock()
	defer mc.mutex.Unlock()

	key := m.Namespace().String()

	// adding key as a cataloged keys (mc.keys)
	mc.keys = appendIfMissing(mc.keys, key)
	mc.tree.Add(m)
}
517110
func (s *ValidationMessage) SetNamespace(v string) *ValidationMessage {
	s.Namespace = &v
	return s
}
836327
func (s *ListGroupsInput) SetNamespace(v string) *ListGroupsInput {
	s.Namespace = &v
	return s
}
117203
func (s *ScalingInstruction) SetServiceNamespace(v string) *ScalingInstruction {
	s.ServiceNamespace = &v
	return s
}
890730
func (s *PresenceService) UpsertNamespace(n services.Namespace) error {
	if err := n.CheckAndSetDefaults(); err != nil {
		return trace.Wrap(err)
	}
	value, err := services.MarshalNamespace(n)
	if err != nil {
		return trace.Wrap(err)
	}
	item := backend.Item{
		Key:     backend.Key(namespacesPrefix, n.Metadata.Name, paramsPrefix),
		Value:   value,
		Expires: n.Metadata.Expiry(),
		ID:      n.Metadata.ID,
	}

	_, err = s.Put(context.TODO(), item)
	if err != nil {
		return trace.Wrap(err)
	}
	return nil
}
1240398
func (this *NamespaceBasedEnricher) addNamespaceInfo(metricSet *core.MetricSet) {
	metricSetType, found := metricSet.Labels[core.LabelMetricSetType.Key]
	if !found {
		return
	}
	if metricSetType != core.MetricSetTypePodContainer &&
		metricSetType != core.MetricSetTypePod &&
		metricSetType != core.MetricSetTypeNamespace {
		return
	}

	namespaceName, found := metricSet.Labels[core.LabelNamespaceName.Key]
	if !found {
		return
	}

	nsObj, exists, err := this.store.GetByKey(namespaceName)
	if exists && err == nil {
		namespace, ok := nsObj.(*kube_api.Namespace)
		if ok {
			metricSet.Labels[core.LabelPodNamespaceUID.Key] = string(namespace.UID)
		} else {
			glog.Errorf("Wrong namespace store content")
		}
	} else if err != nil {
		glog.Warningf("Failed to get namespace %s: %v", namespaceName, err)
	} else if !exists {
		glog.Warningf("Namespace doesn't exist: %s", namespaceName)
	}
}
157274
func (config *DeferredLoadingClientConfig) Namespace() (string, bool, error) {
	mergedKubeConfig, err := config.createClientConfig()
	if err != nil {
		return "", false, err
	}

	ns, overridden, err := mergedKubeConfig.Namespace()
	// if we get an error and it is not empty config, or if the merged config defined an explicit namespace, or
	// if in-cluster config is not possible, return immediately
	if (err != nil && !IsEmptyConfig(err)) || overridden || !config.icc.Possible() {
		// return on any error except empty config
		return ns, overridden, err
	}

	if len(ns) > 0 {
		// if we got a non-default namespace from the kubeconfig, use it
		if ns != "default" {
			return ns, false, nil
		}

		// if we got a default namespace, determine whether it was explicit or implicit
		if raw, err := mergedKubeConfig.RawConfig(); err == nil {
			// determine the current context
			currentContext := raw.CurrentContext
			if config.overrides != nil && len(config.overrides.CurrentContext) > 0 {
				currentContext = config.overrides.CurrentContext
			}
			if context := raw.Contexts[currentContext]; context != nil && len(context.Namespace) > 0 {
				return ns, false, nil
			}
		}
	}

	klog.V(4).Infof("Using in-cluster namespace")

	// allow the namespace from the service account token directory to be used.
	return config.icc.Namespace()
}
89664
func NamespaceFromEnv(ctx context.Context) context.Context {
	namespace := os.Getenv(NamespaceEnvVar)
	if namespace == "" {
		namespace = Default
	}
	return WithNamespace(ctx, namespace)
}
839786
func (s *ListPoliciesGrantingServiceAccessEntry) SetServiceNamespace(v string) *ListPoliciesGrantingServiceAccessEntry {
	s.ServiceNamespace = &v
	return s
}
97555
func (s *ScalingActivity) SetServiceNamespace(v string) *ScalingActivity {
	s.ServiceNamespace = &v
	return s
}
128031
func (s *DeregisterScalableTargetInput) SetServiceNamespace(v string) *DeregisterScalableTargetInput {
	s.ServiceNamespace = &v
	return s
}
1094590
func (s *PutMetricAlarmInput) SetNamespace(v string) *PutMetricAlarmInput {
	s.Namespace = &v
	return s
}
542813
func (s *DescribeGroupInput) SetNamespace(v string) *DescribeGroupInput {
	s.Namespace = &v
	return s
}