add karmada.io/system label to created execution namespaces

Signed-off-by: Michael Grosser <michael@grosser.it>
This commit is contained in:
Michael Grosser 2024-07-23 14:54:38 -07:00
parent 721495dcf2
commit 13f0f6e6d8
No known key found for this signature in database
GPG Key ID: B19DB1587D698ED7
2 changed files with 8 additions and 0 deletions

View File

@ -423,6 +423,9 @@ func (c *Controller) createExecutionSpace(cluster *clusterv1alpha1.Cluster) erro
executionSpace := &corev1.Namespace{ executionSpace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: executionSpaceName, Name: executionSpaceName,
Labels: map[string]string{
util.KarmadaSystemLabel: util.KarmadaSystemLabelValue,
},
}, },
} }
err = c.Client.Create(context.TODO(), executionSpace) err = c.Client.Create(context.TODO(), executionSpace)

View File

@ -29,6 +29,8 @@ import (
"k8s.io/klog/v2" "k8s.io/klog/v2"
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
aggregator "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset" aggregator "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset"
"github.com/karmada-io/karmada/pkg/util"
) )
// CreateService creates a Service if the target resource doesn't exist. // CreateService creates a Service if the target resource doesn't exist.
@ -241,6 +243,9 @@ func NewNamespace(name string) *corev1.Namespace {
return &corev1.Namespace{ return &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Labels: map[string]string{
util.KarmadaSystemLabel: util.KarmadaSystemLabelValue,
},
}, },
} }
} }