Skip to content

Commit

Permalink
feat: allows users to propagate resources under the Kubernetes reserv…
Browse files Browse the repository at this point in the history
…ed namespace.

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
  • Loading branch information
chaunceyjiang committed Apr 19, 2023
1 parent 2be4b33 commit 60d6350
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
5 changes: 3 additions & 2 deletions cmd/controller-manager/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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>/<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.")
flags.StringSliceVar(&o.SkippedPropagatingNamespaces, "skipped-propagating-namespaces", []string{},
"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-).")
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 'kube-.*'.\n"+
"Note: 'karmada-system', 'karmada-cluster', and 'karmada-es-.*' are Karmada reserved namespaces that also skip propagation.")
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.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.")
Expand Down
8 changes: 1 addition & 7 deletions pkg/util/names/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import (
)

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 = "karmada-system"
// NamespaceKarmadaCluster is reserved namespace
Expand Down Expand Up @@ -137,8 +132,7 @@ func GenerateEstimatorDeploymentName(clusterName string) string {
func IsReservedNamespace(namespace string) bool {
return namespace == NamespaceKarmadaSystem ||
namespace == NamespaceKarmadaCluster ||
strings.HasPrefix(namespace, ExecutionSpacePrefix) ||
strings.HasPrefix(namespace, KubernetesReservedNSPrefix)
strings.HasPrefix(namespace, ExecutionSpacePrefix)
}

// GenerateImpersonationSecretName generates the secret name of impersonation secret.
Expand Down
5 changes: 0 additions & 5 deletions pkg/util/names/names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,6 @@ func TestIsReservedNamespace(t *testing.T) {
namespace: NamespaceKarmadaCluster,
expected: true,
},
{
name: "kube-",
namespace: KubernetesReservedNSPrefix,
expected: true,
},
{
name: "karmada-es-",
namespace: ExecutionSpacePrefix,
Expand Down

0 comments on commit 60d6350

Please sign in to comment.