Skip to content

Commit

Permalink
Merge pull request #1200 from flavio-fernandes/release-4.8
Browse files Browse the repository at this point in the history
Bug 2008589: [4.8z] Slow OVN Recovery on SNO
  • Loading branch information
openshift-merge-robot committed Oct 1, 2021
2 parents d952c5b + 5da4a2f commit 17becc4
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 3 deletions.
16 changes: 15 additions & 1 deletion bindata/network/ovn-kubernetes/004-config.yaml
Expand Up @@ -28,7 +28,8 @@ data:
[gateway]
mode=local
nodeport=true
{{ if .OVNHybridOverlayEnable }}
{{- if .OVNHybridOverlayEnable }}

[hybridoverlay]
enabled=true
{{- if .OVNHybridOverlayNetCIDR }}
Expand All @@ -38,3 +39,16 @@ data:
hybrid-overlay-vxlan-port="{{.OVNHybridOverlayVXLANPort}}"
{{- end }}
{{- end }}
{{- if .IsSNO }}

[masterha]
{{- /*
Even in case of SNO there will be only one ovn-master, we set dedicated values for leader election
durations in SNO, as disabling it can cause issues on scaling out SNO again.
The whole discussion can be found at https://coreos.slack.com/archives/CDCP2LA9L/p1627402405090600.
Recommended values at https://github.com/openshift/enhancements/blame/84e894ead7b188a1013556e0ba6973b8463995f1/CONVENTIONS.md#L183
*/}}
election-lease-duration=137
election-renew-deadline=107
election-retry-period=26
{{- end }}
4 changes: 4 additions & 0 deletions bindata/network/ovn-kubernetes/ovnkube-master.yaml
Expand Up @@ -383,7 +383,9 @@ spec:
- /var/run/ovn/ovnnb_db.ctl
- exit
readinessProbe:
{{ if not .IsSNO }}
initialDelaySeconds: 90
{{ end }}
timeoutSeconds: 5
exec:
command:
Expand Down Expand Up @@ -729,7 +731,9 @@ spec:
- /var/run/ovn/ovnsb_db.ctl
- exit
readinessProbe:
{{ if not .IsSNO }}
initialDelaySeconds: 90
{{ end }}
timeoutSeconds: 5
exec:
command:
Expand Down
6 changes: 6 additions & 0 deletions pkg/network/ovn_kubernetes.go
Expand Up @@ -150,6 +150,12 @@ func renderOVNKubernetes(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.Bo
}
}

if len(bootstrapResult.OVN.MasterIPs) == 1 {
data.Data["IsSNO"] = true
} else {
data.Data["IsSNO"] = false
}

manifests, err := render.RenderDir(filepath.Join(manifestDir, "network/ovn-kubernetes"), &data)
if err != nil {
return nil, errors.Wrap(err, "failed to render manifests")
Expand Down
37 changes: 35 additions & 2 deletions pkg/network/ovn_kubernetes_test.go
Expand Up @@ -153,6 +153,7 @@ func TestRenderedOVNKubernetesConfig(t *testing.T) {
desc string
expected string
hybridOverlayConfig *operv1.HybridOverlayConfig
masterIPs []string
}
testcases := []testcase{
{
Expand All @@ -176,8 +177,8 @@ enable-egress-firewall=true
[gateway]
mode=local
nodeport=true`,
masterIPs: []string{"1.2.3.4", "2.3.4.5"},
},

{
desc: "HybridOverlay",
expected: `
Expand Down Expand Up @@ -209,6 +210,7 @@ cluster-subnets="10.132.0.0/14"`,
{CIDR: "10.132.0.0/14", HostPrefix: 23},
},
},
masterIPs: []string{"1.2.3.4", "2.3.4.5"},
},
{
desc: "HybridOverlay with custom VXLAN port",
Expand Down Expand Up @@ -244,6 +246,7 @@ hybrid-overlay-vxlan-port="9000"`,
},
HybridOverlayVXLANPort: ptrToUint32(9000),
},
masterIPs: []string{"1.2.3.4", "2.3.4.5"},
},
{
desc: "HybridOverlay enabled with no ClusterNetworkEntry",
Expand Down Expand Up @@ -272,6 +275,35 @@ nodeport=true
enabled=true`,

hybridOverlayConfig: &operv1.HybridOverlayConfig{},
masterIPs: []string{"1.2.3.4", "2.3.4.5"},
},
{
desc: "Single Node OpenShift should contain SNO specific leader election settings",
expected: `
[default]
mtu="1500"
cluster-subnets="10.128.0.0/15/23,10.0.0.0/14/24"
encap-port="8061"
[kubernetes]
service-cidrs="172.30.0.0/16"
ovn-config-namespace="openshift-ovn-kubernetes"
apiserver="https://1.1.1.1:1111"
host-network-namespace="openshift-host-network"
[ovnkubernetesfeature]
enable-egress-ip=true
enable-egress-firewall=true
[gateway]
mode=local
nodeport=true
[masterha]
election-lease-duration=137
election-renew-deadline=107
election-retry-period=26`,
masterIPs: []string{"1.2.3.4"},
},
}
g := NewGomegaWithT(t)
Expand All @@ -285,6 +317,7 @@ enabled=true`,
if tc.hybridOverlayConfig != nil {
OVNKubeConfig.Spec.DefaultNetwork.OVNKubernetesConfig.HybridOverlayConfig = tc.hybridOverlayConfig
}

//set a few inputs so that the tests are not machine dependant
OVNKubeConfig.Spec.DefaultNetwork.OVNKubernetesConfig.MTU = ptrToUint32(1500)

Expand All @@ -297,7 +330,7 @@ enabled=true`,

bootstrapResult := &bootstrap.BootstrapResult{
OVN: bootstrap.OVNBootstrapResult{
MasterIPs: []string{"1.2.3.4", "5.6.7.8", "9.10.11.12"},
MasterIPs: tc.masterIPs,
},
}
objs, err := renderOVNKubernetes(config, bootstrapResult, manifestDirOvn)
Expand Down

0 comments on commit 17becc4

Please sign in to comment.