From e05661918c0e07f8f5a0aa895c3b342ec6b2e96b Mon Sep 17 00:00:00 2001 From: zouyingjie Date: Mon, 10 Jan 2022 16:08:54 +0800 Subject: [PATCH] Add EASEMESH_TAGS env for agent --- add-ons/shadow/pkg/handler/clone_handler.go | 1 + add-ons/shadow/pkg/handler/deployment_cloner.go | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/add-ons/shadow/pkg/handler/clone_handler.go b/add-ons/shadow/pkg/handler/clone_handler.go index cb0d68f6..17f605df 100644 --- a/add-ons/shadow/pkg/handler/clone_handler.go +++ b/add-ons/shadow/pkg/handler/clone_handler.go @@ -52,6 +52,7 @@ const ( shadowDeploymentNameSuffix = "-shadow" + easemeshTagsConfigEnv = "EASEMESH_TAGS" databaseShadowConfigEnv = "EASE_RESOURCE_DATABASE" kafkaShadowConfigEnv = "EASE_RESOURCE_KAFKA" rabbitmqShadowConfigEnv = "EASE_RESOURCE_RABBITMQ" diff --git a/add-ons/shadow/pkg/handler/deployment_cloner.go b/add-ons/shadow/pkg/handler/deployment_cloner.go index f8859ef5..e115629a 100644 --- a/add-ons/shadow/pkg/handler/deployment_cloner.go +++ b/add-ons/shadow/pkg/handler/deployment_cloner.go @@ -207,15 +207,29 @@ func shadowConfigurationMap(shadowService *object.ShadowService) map[string]inte shadowConfigs[redisShadowConfigEnv] = shadowService.Redis shadowConfigs[kafkaShadowConfigEnv] = shadowService.Kafka shadowConfigs[rabbitmqShadowConfigEnv] = shadowService.RabbitMQ + shadowConfigs[easemeshTagsConfigEnv] = defaultEaseMeshTags() return shadowConfigs } func shadowConfigurationKeys() []string { - configKeys := []string{databaseShadowConfigEnv, elasticsearchShadowConfigEnv, redisShadowConfigEnv, kafkaShadowConfigEnv, rabbitmqShadowConfigEnv} + configKeys := []string{ + databaseShadowConfigEnv, + elasticsearchShadowConfigEnv, + redisShadowConfigEnv, + kafkaShadowConfigEnv, + rabbitmqShadowConfigEnv, + easemeshTagsConfigEnv, + } sort.Strings(configKeys) return configKeys } +func defaultEaseMeshTags() map[string]string { + m := map[string]string{ + "label.local": "shadow", + } + return m +} func sourceName(name string) string { return strings.TrimSuffix(name, shadowDeploymentNameSuffix) }