Skip to content

Commit

Permalink
Add simulator namespace to the simulated cluster labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Oct 1, 2020
1 parent e325a6c commit f9a4175
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/agent/pkg/simulator/simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func setupNamespace(ctx context.Context, kubeConfig, namespace, simNamespace str
}

if conf != nil {
conf, err := injectConfig(conf)
conf, err := injectConfig(conf, simNamespace)
if err != nil {
return "", err
}
Expand All @@ -139,7 +139,7 @@ func setupNamespace(ctx context.Context, kubeConfig, namespace, simNamespace str
return clusterID, agent.Register(ctx, kubeConfig, simNamespace, clusterID)
}

func injectConfig(cm *corev1.ConfigMap) (*corev1.ConfigMap, error) {
func injectConfig(cm *corev1.ConfigMap, simNamespace string) (*corev1.ConfigMap, error) {
cfg, err := config.ReadConfig(cm)
if err != nil {
return nil, err
Expand All @@ -149,5 +149,6 @@ func injectConfig(cm *corev1.ConfigMap) (*corev1.ConfigMap, error) {
cfg.Labels = map[string]string{}
}
cfg.Labels["fleet.cattle.io/non-managed-agent"] = "true"
cfg.Labels["simulator-namespace"] = simNamespace
return config.ToConfigMap(cm.Namespace, cm.Name, cfg)
}

0 comments on commit f9a4175

Please sign in to comment.