Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/controller/installation/core_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,10 @@ func setClusterRoutingOnFelixConfiguration(
fc *v3.FelixConfiguration,
reqLogger logr.Logger,
) (bool, error) {
if install.Spec.CalicoNetwork == nil || install.Spec.CalicoNetwork.ClusterRoutingMode == nil {
return false, nil
}

updated := false
desiredValue := "Disabled"
if felixProgramsClusterRoutes(install) {
Expand All @@ -2090,9 +2094,12 @@ func setClusterRoutingOnBGPConfiguration(
bgpConfig *v3.BGPConfiguration,
reqLogger logr.Logger,
) (bool, error) {
if install.Spec.CalicoNetwork == nil || install.Spec.CalicoNetwork.ClusterRoutingMode == nil {
return false, nil
}

updated := false
desiredValue := "Enabled"

if felixProgramsClusterRoutes(install) {
desiredValue = "Disabled"
}
Expand Down
9 changes: 3 additions & 6 deletions pkg/controller/installation/core_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ var _ = Describe("Testing core-controller installation", func() {
Expect(pullSecret.Kind).To(Equal("Installation"))
})

It("should correctly patch FelixConfig and BGPConfig with ClusterRouteMode not set", func() {
It("should not patch FelixConfig and BGPConfig when ClusterRouteMode not set", func() {
cr.Spec.CalicoNetwork = &operator.CalicoNetworkSpec{}
Expect(c.Create(ctx, cr)).NotTo(HaveOccurred())
_, err := r.Reconcile(ctx, reconcile.Request{})
Expand All @@ -1439,14 +1439,11 @@ var _ = Describe("Testing core-controller installation", func() {
fc := &v3.FelixConfiguration{}
err = c.Get(ctx, types.NamespacedName{Name: "default"}, fc)
Expect(err).ShouldNot(HaveOccurred())
Expect(fc.Spec.ProgramClusterRoutes).NotTo(BeNil())
Expect(*fc.Spec.ProgramClusterRoutes).To(Equal("Disabled"))
Expect(fc.Spec.ProgramClusterRoutes).To(BeNil())

bgpConfig := &v3.BGPConfiguration{}
err = c.Get(ctx, types.NamespacedName{Name: "default"}, bgpConfig)
Expect(err).ShouldNot(HaveOccurred())
Expect(bgpConfig.Spec.ProgramClusterRoutes).NotTo(BeNil())
Expect(*bgpConfig.Spec.ProgramClusterRoutes).To(Equal("Enabled"))
Expect(err).Should(HaveOccurred())
})

It("should correctly patch FelixConfig and BGPConfig with ClusterRouteMode set to BIRD", func() {
Expand Down
Loading