Skip to content

Commit c7c3dd9

Browse files
CNS: Do not start CNM by default (#381)
CNM starts by default when CNS starts. This change prevents CNM from starting by default. -startcnm command line option can be used to start CNM if needed.
1 parent 2c7dc77 commit c7c3dd9

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

cns/service/main.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ var args = acn.ArgumentList{
111111
DefaultValue: "",
112112
},
113113
{
114-
Name: acn.OptStopAzureVnet,
115-
Shorthand: acn.OptStopAzureVnetAlias,
116-
Description: "Stop Azure-CNM if flag is true",
114+
Name: acn.OptStartAzureCNM,
115+
Shorthand: acn.OptStartAzureCNMAlias,
116+
Description: "Start Azure-CNM if flag is set",
117117
Type: "bool",
118118
DefaultValue: false,
119119
},
@@ -162,7 +162,6 @@ func printVersion() {
162162

163163
// Main is the entry point for CNS.
164164
func main() {
165-
var stopcnm = false
166165
// Initialize and parse command line arguments.
167166
acn.ParseArgs(&args, printVersion)
168167

@@ -176,7 +175,7 @@ func main() {
176175
logDirectory := acn.GetArg(acn.OptLogLocation).(string)
177176
ipamQueryUrl, _ := acn.GetArg(acn.OptIpamQueryUrl).(string)
178177
ipamQueryInterval, _ := acn.GetArg(acn.OptIpamQueryInterval).(int)
179-
stopcnm = acn.GetArg(acn.OptStopAzureVnet).(bool)
178+
startCNM := acn.GetArg(acn.OptStartAzureCNM).(bool)
180179
vers := acn.GetArg(acn.OptVersion).(bool)
181180
createDefaultExtNetworkType := acn.GetArg(acn.OptCreateDefaultExtNetworkType).(string)
182181
telemetryEnabled := acn.GetArg(acn.OptTelemetry).(bool)
@@ -271,7 +270,7 @@ func main() {
271270
var netPlugin network.NetPlugin
272271
var ipamPlugin ipam.IpamPlugin
273272

274-
if !stopcnm {
273+
if startCNM {
275274
var pluginConfig acn.PluginConfig
276275
pluginConfig.Version = version
277276

@@ -344,7 +343,7 @@ func main() {
344343

345344
telemetryStopProcessing <- true
346345

347-
if !stopcnm {
346+
if startCNM {
348347
if netPlugin != nil {
349348
netPlugin.Stop()
350349
}

common/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ const (
4444
OptIpamQueryInterval = "ipam-query-interval"
4545
OptIpamQueryIntervalAlias = "i"
4646

47-
// Don't Start CNM
48-
OptStopAzureVnet = "stop-azure-cnm"
49-
OptStopAzureVnetAlias = "stopcnm"
47+
// Start CNM
48+
OptStartAzureCNM = "start-azure-cnm"
49+
OptStartAzureCNMAlias = "startcnm"
5050

5151
// Interval to send reports to host
5252
OptReportToHostInterval = "report-interval"

0 commit comments

Comments
 (0)