Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allows users to propagate resources under the Kubernetes reserved namespace. #3433

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-.*"},
RainbowMango marked this conversation as resolved.
Show resolved Hide resolved
"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.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