// IsKubernetesContainer checks if the container is in K8s.
488756
func isKubernetesContainer(labels map[string]string) bool {

	if _, ok := labels[constants.K8sPodNamespace]; ok {
		return true
	}
	return false
}
261166
func (daemon *Daemon) checkContainer(container *container.Container, conditions ...func(*container.Container) error) error {
	for _, condition := range conditions {
		if err := condition(container); err != nil {
			return err
		}
	}
	return nil
}
1355149
func (m *KopsModelContext) KubernetesVersion() semver.Version {
	// TODO: Remove copy-pasting c.f. https://github.com/kubernetes/kops/blob/master/pkg/model/components/context.go#L32

	kubernetesVersion := m.Cluster.Spec.KubernetesVersion

	if kubernetesVersion == "" {
		glog.Fatalf("KubernetesVersion is required")
	}

	sv, err := util.ParseKubernetesVersion(kubernetesVersion)
	if err != nil {
		glog.Fatalf("unable to determine kubernetes version from %q", kubernetesVersion)
	}

	return *sv
}
501845
func IsKubeletLabel(key string) bool {
	if kubeletLabels.Has(key) {
		return true
	}

	namespace := getLabelNamespace(key)
	for allowedNamespace := range kubeletLabelNamespaces {
		if namespace == allowedNamespace || strings.HasSuffix(namespace, "."+allowedNamespace) {
			return true
		}
	}

	return false
}
1101443
func (p *Pod) FindContainerByName(containerName string) *Container {
	for _, c := range p.Containers {
		if c.Name == containerName {
			return c
		}
	}
	return nil
}
997388
func (c *cluster) isCoordinator() bool {
	c.mu.RLock()
	defer c.mu.RUnlock()
	return c.unprotectedIsCoordinator()
}
1069354
func (m *Machine) SupportedContainers() ([]instance.ContainerType, bool) {
	return m.doc.SupportedContainers, m.doc.SupportedContainersKnown
}
29294
func Convert_v1_Container_To_core_Container(in *v1.Container, out *core.Container, s conversion.Scope) error {
	return autoConvert_v1_Container_To_core_Container(in, out, s)
}
714059
func SetKubernetesVersion(cfg *kubeadmapiv1beta2.ClusterConfiguration) {

	if cfg.KubernetesVersion != kubeadmapiv1beta2.DefaultKubernetesVersion && cfg.KubernetesVersion != "" {
		return
	}
	cfg.KubernetesVersion = version.Get().String()
}
1333833
func (k *kubernetesClient) ValidateStorageClass(config map[string]interface{}) error {
	cfg, err := newStorageConfig(config)
	if err != nil {
		return errors.Trace(err)
	}
	sc, err := k.getStorageClass(cfg.storageClass)
	if err != nil {
		return errors.NewNotValid(err, fmt.Sprintf("storage class %q", cfg.storageClass))
	}
	if cfg.storageProvisioner == "" {
		return nil
	}
	if sc.Provisioner != cfg.storageProvisioner {
		return errors.NewNotValid(
			nil,
			fmt.Sprintf("storage class %q has provisoner %q, not %q", cfg.storageClass, sc.Provisioner, cfg.storageProvisioner))
	}
	return nil
}
674633
func (k *Key) Container() *Key {
	if len(k.pairs) == 2 {
		return nil
	}
	cont, err := k.set.Key(k.pairs[:len(k.pairs)-2]...)
	if err != nil {
		panic(err) // 'k' has been validated, all its components are thus also valid
	}
	return cont
}
1340576
func createK8sFHRContainers(values map[string]interface{}) []apiv1.Container {
	var containers []apiv1.Container
	_ = kresource.FindFluxHelmReleaseContainers(values, func(name string, image image.Ref, _ kresource.ImageSetter) error {
		containers = append(containers, apiv1.Container{
			Name:  name,
			Image: image.String(),
		})
		return nil
	})
	return containers
}
247614
func (m *kubeGenericRuntimeManager) getKubeletContainers(allContainers bool) ([]*runtimeapi.Container, error) {
	filter := &runtimeapi.ContainerFilter{}
	if !allContainers {
		filter.State = &runtimeapi.ContainerStateValue{
			State: runtimeapi.ContainerState_CONTAINER_RUNNING,
		}
	}

	containers, err := m.runtimeService.ListContainers(filter)
	if err != nil {
		klog.Errorf("getKubeletContainers failed: %v", err)
		return nil, err
	}

	return containers, nil
}
1003101
func (ks *KeyStore) IsIn(user string, putative string) bool {
	mac := hmac.New(sha256.New, ks.systemKey)
	mac.Write([]byte(putative))
	computedMAC := mac.Sum(nil)

	val, ok := ks.cache.Get(user)
	if !ok {
		return false
	}

	expectedMAC := val.([]byte)

	return hmac.Equal(expectedMAC, computedMAC)
}
994727
func toKubeContainerState(state runtimeapi.ContainerState) kubecontainer.ContainerState {
	switch state {
	case runtimeapi.ContainerState_CONTAINER_CREATED:
		return kubecontainer.ContainerStateCreated
	case runtimeapi.ContainerState_CONTAINER_RUNNING:
		return kubecontainer.ContainerStateRunning
	case runtimeapi.ContainerState_CONTAINER_EXITED:
		return kubecontainer.ContainerStateExited
	case runtimeapi.ContainerState_CONTAINER_UNKNOWN:
		return kubecontainer.ContainerStateUnknown
	}

	return kubecontainer.ContainerStateUnknown
}
1153193
func (k DNSKEY) isKSK() bool {
	return k.K.Flags&(1<<8) == (1<<8) && k.K.Flags&1 == 1
}
244735
func Convert_v1alpha2_ExecContainerAction_To_kops_ExecContainerAction(in *ExecContainerAction, out *kops.ExecContainerAction, s conversion.Scope) error {
	return autoConvert_v1alpha2_ExecContainerAction_To_kops_ExecContainerAction(in, out, s)
}