Skip to content

Commit

Permalink
Merge pull request #262 from salv-orlando/b3442512
Browse files Browse the repository at this point in the history
Allow NcpReplicas to be set to 0
  • Loading branch information
salv-orlando authored Nov 22, 2024
2 parents 19bd4f2 + 5972fd8 commit b3cb9c0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
description: the replica numbers of nsx-ncp deployment
type: integer
format: int32
minimum: 1
minimum: 0
addNodeTag:
description: 'Tag node logical switch port with node name and cluster when set to true, skip tagging when set to false.
Note that if one node has multiple attached VirtualNetworkInterfaces, this function is not supported and should be set to false.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
description: the replica numbers of nsx-ncp deployment
type: integer
format: int32
minimum: 1
minimum: 0
addNodeTag:
description: 'Tag node logical switch port with node name and cluster when set to true, skip tagging when set to false.
Note that if one node has multiple attached VirtualNetworkInterfaces, this function is not supported and should be set to false.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
description: the replica numbers of nsx-ncp deployment
type: integer
format: int32
minimum: 1
minimum: 0
addNodeTag:
description: 'Tag node logical switch port with node name and cluster when set to true, skip tagging when set to false.
Note that if one node has multiple attached VirtualNetworkInterfaces, this function is not supported and should be set to false.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
description: the replica numbers of nsx-ncp deployment
type: integer
format: int32
minimum: 1
minimum: 0
addNodeTag:
description: 'Tag node logical switch port with node name and cluster when set to true, skip tagging when set to false.
Note that if one node has multiple attached VirtualNetworkInterfaces, this function is not supported and should be set to false.'
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/configmap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (adaptor *ConfigMapOc) FillDefaults(configmap *corev1.ConfigMap, spec *conf
appendErrorIfNotNil(&errs, fillDefault(cfg, "nsx_node_agent", "waiting_before_cni_response", "3", false))
appendErrorIfNotNil(&errs, fillDefault(cfg, "nsx_node_agent", "mtu", strconv.Itoa(operatortypes.DefaultMTU), false))
// For Openshift force enable_ovs_mcast_snooping as False by default for IPI and UPI installation
// keepalived is configured with unicast by default from OC 4.11
// keepalived is configured with unicast by default from OC 4.11
appendErrorIfNotNil(&errs, fillDefault(cfg, "nsx_node_agent", "enable_ovs_mcast_snooping", "false", false))
appendErrorIfNotNil(&errs, fillClusterNetwork(spec, cfg))

Expand Down Expand Up @@ -417,7 +417,7 @@ func Render(configmap *corev1.ConfigMap, ncpReplicas *int32, ncpNodeSelector *ma
}
}

if !haEnabled && *ncpReplicas != 1 {
if !haEnabled && *ncpReplicas > 1 {
log.Info(fmt.Sprintf("Set nsx-ncp deployment replicas to 1 instead of %d as HA is deactivated",
*ncpReplicas))
*ncpReplicas = 1
Expand Down
5 changes: 2 additions & 3 deletions pkg/controller/configmap/configmap_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,8 @@ func (r *ReconcileConfigMap) Reconcile(request reconcile.Request) (reconcile.Res
}
ncpReplicas := ncpInstallCrd.Spec.NcpReplicas
if ncpReplicas == 0 {
log.Info(fmt.Sprintf("Set NcpReplicas to %d as it is not set in ncp-install CRD",
operatortypes.NcpDefaultReplicas))
ncpReplicas = int32(operatortypes.NcpDefaultReplicas)
// still log the event for troubleshooting purposes
log.Info("NcpReplicas was set to 0 and NCP won't be operational!")
}

addNodeTag := ncpInstallCrd.Spec.AddNodeTag
Expand Down

0 comments on commit b3cb9c0

Please sign in to comment.