ValidateLabelSelector (labels/validation.go)

cilium · pkg/labels/validation.go · go · Apache-2.0
infra

Validates Kubernetes label selectors and keys for Cilium compatibility.

// Source: https://github.com/cilium/cilium | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium

// Copyright 2015 The Kubernetes Authors.
// Adapted From: https://github.com/kubernetes/apimachinery/tree/master/pkg/apis/meta/v1/validation

package labels

import (
	"regexp"
	"strings"

	"k8s.io/apimachinery/pkg/api/validate/content"
	"k8s.io/apimachinery/pkg/util/validation"
	"k8s.io/apimachinery/pkg/util/validation/field"

	k8sconsts "github.com/cilium/cilium/pkg/k8s/apis/cilium.io"
	slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1"
)

const (
	labelSourceREGroup     string = "[A-Za-z0-9]+"
	labe

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key