Merge pull request #3433 from chaunceyjiang/prefix-namespace
feat: allows users to propagate resources under the Kubernetes reserved namespace.
This commit is contained in:
commit
b118a73ba1
|
@ -185,8 +185,9 @@ func (o *Options) AddFlags(flags *pflag.FlagSet, allControllers, disabledByDefau
|
||||||
"<group> for skip resources with a specific API group(e.g. networking.k8s.io),\n"+
|
"<group> for skip resources with a specific API group(e.g. networking.k8s.io),\n"+
|
||||||
"<group>/<version> for skip resources with a specific API version(e.g. networking.k8s.io/v1beta1),\n"+
|
"<group>/<version> for skip resources with a specific API version(e.g. networking.k8s.io/v1beta1),\n"+
|
||||||
"<group>/<version>/<kind>,<kind> for skip one or more specific resource(e.g. networking.k8s.io/v1beta1/Ingress,IngressClass) where the kinds are case-insensitive.")
|
"<group>/<version>/<kind>,<kind> for skip one or more specific resource(e.g. networking.k8s.io/v1beta1/Ingress,IngressClass) where the kinds are case-insensitive.")
|
||||||
flags.StringSliceVar(&o.SkippedPropagatingNamespaces, "skipped-propagating-namespaces", []string{},
|
flags.StringSliceVar(&o.SkippedPropagatingNamespaces, "skipped-propagating-namespaces", []string{"kube-.*"},
|
||||||
"Comma-separated namespaces that should be skipped from propagating in addition to the default skipped namespaces(karmada-system, karmada-cluster, namespaces prefixed by kube- and karmada-es-).")
|
"Comma-separated namespaces that should be skipped from propagating.\n"+
|
||||||
|
"Note: 'karmada-system', 'karmada-cluster' and 'karmada-es-.*' are Karmada reserved namespaces that will always be skipped.")
|
||||||
flags.StringVar(&o.ClusterAPIContext, "cluster-api-context", "", "Name of the cluster context in cluster-api management cluster kubeconfig file.")
|
flags.StringVar(&o.ClusterAPIContext, "cluster-api-context", "", "Name of the cluster context in cluster-api management cluster kubeconfig file.")
|
||||||
flags.StringVar(&o.ClusterAPIKubeconfig, "cluster-api-kubeconfig", "", "Path to the cluster-api management cluster kubeconfig file.")
|
flags.StringVar(&o.ClusterAPIKubeconfig, "cluster-api-kubeconfig", "", "Path to the cluster-api management cluster kubeconfig file.")
|
||||||
flags.Float32Var(&o.ClusterAPIQPS, "cluster-api-qps", 40.0, "QPS to use while talking with cluster kube-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags.")
|
flags.Float32Var(&o.ClusterAPIQPS, "cluster-api-qps", 40.0, "QPS to use while talking with cluster kube-apiserver. Doesn't cover events and node heartbeat apis which rate limiting is controlled by a different set of flags.")
|
||||||
|
|
|
@ -11,11 +11,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// KubernetesReservedNSPrefix is the prefix of namespace which reserved by Kubernetes system, such as:
|
|
||||||
// - kube-system
|
|
||||||
// - kube-public
|
|
||||||
// - kube-node-lease
|
|
||||||
KubernetesReservedNSPrefix = "kube-"
|
|
||||||
// NamespaceKarmadaSystem is reserved namespace
|
// NamespaceKarmadaSystem is reserved namespace
|
||||||
NamespaceKarmadaSystem = "karmada-system"
|
NamespaceKarmadaSystem = "karmada-system"
|
||||||
// NamespaceKarmadaCluster is reserved namespace
|
// NamespaceKarmadaCluster is reserved namespace
|
||||||
|
@ -137,8 +132,7 @@ func GenerateEstimatorDeploymentName(clusterName string) string {
|
||||||
func IsReservedNamespace(namespace string) bool {
|
func IsReservedNamespace(namespace string) bool {
|
||||||
return namespace == NamespaceKarmadaSystem ||
|
return namespace == NamespaceKarmadaSystem ||
|
||||||
namespace == NamespaceKarmadaCluster ||
|
namespace == NamespaceKarmadaCluster ||
|
||||||
strings.HasPrefix(namespace, ExecutionSpacePrefix) ||
|
strings.HasPrefix(namespace, ExecutionSpacePrefix)
|
||||||
strings.HasPrefix(namespace, KubernetesReservedNSPrefix)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GenerateImpersonationSecretName generates the secret name of impersonation secret.
|
// GenerateImpersonationSecretName generates the secret name of impersonation secret.
|
||||||
|
|
|
@ -353,11 +353,6 @@ func TestIsReservedNamespace(t *testing.T) {
|
||||||
namespace: NamespaceKarmadaCluster,
|
namespace: NamespaceKarmadaCluster,
|
||||||
expected: true,
|
expected: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "kube-",
|
|
||||||
namespace: KubernetesReservedNSPrefix,
|
|
||||||
expected: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "karmada-es-",
|
name: "karmada-es-",
|
||||||
namespace: ExecutionSpacePrefix,
|
namespace: ExecutionSpacePrefix,
|
||||||
|
|
Loading…
Reference in New Issue