From 4275d727a1a190604c592f95b60dedbf508dfb90 Mon Sep 17 00:00:00 2001 From: "sbolosan@axway.com" Date: Tue, 23 Mar 2021 17:07:36 -0700 Subject: [PATCH 1/6] APIGOV-18136 - set config team name --- pkg/agent/agent.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 593959ca7..05cb1e7e8 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -35,6 +35,10 @@ const ( edgeDataplaneType = "Edge" ) +const ( + defaultTeam = "Default Team" +) + // AgentResourceType - Holds the type for agent resource in Central var AgentResourceType string @@ -557,5 +561,14 @@ func applyResConfigToCentralConfig(cfg *config.CentralConfiguration, resCfgAddit log.GlobalLoggerConfig.Level(logLevel).Apply() } - cfg.TeamName = resCfgTeamName + // If config team is not blank, use cfg.TeamName + // If config team is blank, check resource team name. If resource team name is not blank, use resource team name + // If config team is blank and resource team name is blank, set to "Default Team" + if cfg.TeamName == "" { + if resCfgTeamName != "" { + cfg.TeamName = resCfgTeamName + } else { + cfg.TeamName = defaultTeam + } + } } From 86f6e239b2c56e88ff386687692c42f628888246 Mon Sep 17 00:00:00 2001 From: "sbolosan@axway.com" Date: Tue, 23 Mar 2021 19:20:22 -0700 Subject: [PATCH 2/6] APIGOV-18136 - remove Default Team --- pkg/agent/agent.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 05cb1e7e8..5fe4b7752 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -35,10 +35,6 @@ const ( edgeDataplaneType = "Edge" ) -const ( - defaultTeam = "Default Team" -) - // AgentResourceType - Holds the type for agent resource in Central var AgentResourceType string @@ -563,12 +559,12 @@ func applyResConfigToCentralConfig(cfg *config.CentralConfiguration, resCfgAddit // If config team is not blank, use cfg.TeamName // If config team is blank, check resource team name. If resource team name is not blank, use resource team name - // If config team is blank and resource team name is blank, set to "Default Team" + // If config team is blank and resource team name is blank, set to "" and let central handle setting team based on organization if cfg.TeamName == "" { if resCfgTeamName != "" { cfg.TeamName = resCfgTeamName } else { - cfg.TeamName = defaultTeam + cfg.TeamName = "" } } } From cba6d474ed5d510de2f15d59a87c730c1e28c0d9 Mon Sep 17 00:00:00 2001 From: "sbolosan@axway.com" Date: Wed, 24 Mar 2021 07:07:31 -0700 Subject: [PATCH 3/6] APIGOV-18136 - remove local config team name check --- pkg/agent/agent.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 5fe4b7752..64674bad9 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -557,14 +557,9 @@ func applyResConfigToCentralConfig(cfg *config.CentralConfiguration, resCfgAddit log.GlobalLoggerConfig.Level(logLevel).Apply() } - // If config team is not blank, use cfg.TeamName - // If config team is blank, check resource team name. If resource team name is not blank, use resource team name - // If config team is blank and resource team name is blank, set to "" and let central handle setting team based on organization - if cfg.TeamName == "" { - if resCfgTeamName != "" { - cfg.TeamName = resCfgTeamName - } else { - cfg.TeamName = "" - } + // If resource team name is not blank, apply it + if resCfgTeamName != "" { + cfg.TeamName = resCfgTeamName } + } From c3950e5271d8edc2c6c2c4e208b08fc08b01d0e5 Mon Sep 17 00:00:00 2001 From: "sbolosan@axway.com" Date: Wed, 24 Mar 2021 07:16:46 -0700 Subject: [PATCH 4/6] APIGOV-18136 - still check if config team name is blank --- pkg/agent/agent.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 64674bad9..99c11c35c 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -557,9 +557,11 @@ func applyResConfigToCentralConfig(cfg *config.CentralConfiguration, resCfgAddit log.GlobalLoggerConfig.Level(logLevel).Apply() } - // If resource team name is not blank, apply it - if resCfgTeamName != "" { - cfg.TeamName = resCfgTeamName + // If config team is blank, check resource team name. If resource team name is not blank, use resource team name + // If config team is blank and resource team name is blank, return and let central handle setting team based on organization + if cfg.TeamName == "" { + if resCfgTeamName != "" { + cfg.TeamName = resCfgTeamName + } } - } From b4efca2d3fee4960beb43d087f5cb2c158fc367d Mon Sep 17 00:00:00 2001 From: "sbolosan@axway.com" Date: Wed, 24 Mar 2021 07:24:36 -0700 Subject: [PATCH 5/6] APIGOV-18136 - sorry, it is early --- pkg/agent/agent.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 99c11c35c..aab145c98 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -559,9 +559,8 @@ func applyResConfigToCentralConfig(cfg *config.CentralConfiguration, resCfgAddit // If config team is blank, check resource team name. If resource team name is not blank, use resource team name // If config team is blank and resource team name is blank, return and let central handle setting team based on organization - if cfg.TeamName == "" { - if resCfgTeamName != "" { - cfg.TeamName = resCfgTeamName - } + if cfg.TeamName == "" && resCfgTeamName != "" { + cfg.TeamName = resCfgTeamName } + } From e41149f9225e30063e5647a7a915d60c134efa0a Mon Sep 17 00:00:00 2001 From: "sbolosan@axway.com" Date: Wed, 24 Mar 2021 07:25:52 -0700 Subject: [PATCH 6/6] APIGOV-18136 - uncle --- pkg/agent/agent.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index aab145c98..ee3d4c8be 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -558,7 +558,6 @@ func applyResConfigToCentralConfig(cfg *config.CentralConfiguration, resCfgAddit } // If config team is blank, check resource team name. If resource team name is not blank, use resource team name - // If config team is blank and resource team name is blank, return and let central handle setting team based on organization if cfg.TeamName == "" && resCfgTeamName != "" { cfg.TeamName = resCfgTeamName }