Move the CRDs to MetalLB, step 2#1245
Conversation
bd9404a to
7a9360b
Compare
|
|
||
| // AddressPoolStatus defines the observed state of AddressPool. | ||
| type AddressPoolStatus struct { | ||
| // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
There was a problem hiding this comment.
It's generated by controller-gen, and it was the same in the operator.
|
|
||
| // BGPAdvertisementStatus defines the observed state of BGPAdvertisement. | ||
| type BGPAdvertisementStatus struct { | ||
| // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
There was a problem hiding this comment.
It's generated by controller-gen, and it was the same in the operator.
| } | ||
|
|
||
| // BFDProfileStatus defines the observed state of BFDProfile. | ||
| type BFDProfileStatus struct { |
There was a problem hiding this comment.
missing TODO comment?
There was a problem hiding this comment.
It's generated by controller-gen, and it was the same in the operator.
| flag.StringVar(&framework.TestContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, skeleton (the fallback if not set), etc.)") | ||
| framework.TestContext.KubeConfig = os.Getenv(clientcmd.RecommendedConfigPathEnvVar) | ||
| framework.RegisterClusterFlags(flag.CommandLine) | ||
| //flag.StringVar(&framework.TestContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, skeleton (the fallback if not set), etc.)") |
There was a problem hiding this comment.
it's not needed any more as we are not importing the crds from the operator anymore, need to delete it.
7a9360b to
c35f4b2
Compare
| DetectMultiplier *uint32 `json:"detectMultiplier,omitempty"` | ||
| // +kubebuilder:validation:Maximum:=60000 | ||
| // +kubebuilder:validation:Minimum:=10 | ||
| EchoInterval *uint32 `json:"echoInterval,omitempty"` |
There was a problem hiding this comment.
What about echoTransmitInterval? I see it in the design proposal
There was a problem hiding this comment.
That was because the proposal was written when we were aiming at frr 8. Frr 7.5 only has echo interval.
That was the same in the operator, and in the configmap.
| } | ||
| ad.Communities[v] = true | ||
| } | ||
| func validateBGPAddPerPool(adv *BGPAdvertisement, pool *Pool) error { |
There was a problem hiding this comment.
validateBGPAddPerPool -> validateBGPAdvPerPool
573f797 to
4b363fc
Compare
| case BGP: | ||
| ads, err := bgpAdvertisementsFromLegacyCR(p.Spec.BGPAdvertisements, cidrsPerAddresses, bgpCommunities) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("parsing BGP communities: %s", err) |
There was a problem hiding this comment.
The err msg here is misleading. bgpAdvertisementsFromLegacyCR func parsing not just communities.
| pool := c1.config.Pools[poolFor(c1.config.Pools, []net.IP{lbIP})] | ||
| response1 := c1.protocols[pool.Protocol].ShouldAnnounce(l, "test1", []net.IP{lbIP}, svc, test.eps[lbIP_s]) | ||
| response2 := c2.protocols[pool.Protocol].ShouldAnnounce(l, "test1", []net.IP{lbIP}, svc, test.eps[lbIP_s]) | ||
| // pool := c1.config.Pools[poolFor(c1.config.Pools, []net.IP{lbIP})] |
There was a problem hiding this comment.
should this commented line be removed?
| @@ -198,11 +200,12 @@ type controllerConfig struct { | |||
|
|
|||
| // For testing only, and will be removed in a future release. | |||
There was a problem hiding this comment.
i know it's unrelated to this PR, but do you know something about this comment from 4 years ago? the issue was closed.
91ce27b to
501e21a
Compare
6907124 to
c6a6704
Compare
| t.Fatal("two handlers, ip is not announced in bgp") | ||
| } | ||
| if !c.announced[config.Layer2]["testsvc"] { | ||
| t.Fatal("two handlers, ip is not announced in bgp") |
| t.Fatal("one handler, ip is not announced in bgp") | ||
| } | ||
| if c.announced[config.Layer2]["testsvc"] { | ||
| t.Fatal("one handler, ip is not announced in bgp") |
There was a problem hiding this comment.
nit: ip is announced in l2
| t.Fatal("no handlers, l2 handler was called") | ||
| } | ||
| if bgpMockHandler.setBalancerCalled { | ||
| t.Fatal("no handlers, bgp handler was not called") |
| if l2MockHandler.setBalancerCalled { | ||
| t.Fatal("no handlers, l2 handler was called") | ||
| } |
There was a problem hiding this comment.
it is a duplication of lines 144-146
| t.Fatal("no handlers, l2 handler was called") | ||
| } | ||
| if !bgpMockHandler.deleteBalancerCalled { | ||
| t.Fatal("no handlers, l2 delete handler was not called") |
There was a problem hiding this comment.
nit: bgp delete handler was not called
| t.Fatal("no handlers, ip is announced in bgp") | ||
| } | ||
| if c.announced[config.Layer2]["testsvc"] { | ||
| t.Fatal("no handlers, ip is announced in bgp") |
This is the evolution of the CRDs defined in the operator, separating the IP allocation function handled by the address pool, the connection with bgp peers handled by the BGPPeer CRD, and the intent to advertise a prefix over L2 or BGP (or both) via the L2Advertisement and BGPAdvertisement CRDs. Instead of having a different addersspool version, we create a new CRD (IPPool) which will live together with the old address pool. This is required because it's not possible to have converting webhook from one CRD (addresspool) to two (addresspool, new version + BGP Advertisement or L2 advertisement). Also, it's not possible to have two different versions of the same CR stored in etcd. For this reason, it's safer to have a new CR and make metallb work with the old one. BGPPeer is then moved to v1beta2, because there it's possible to translate the node selector, and we'll add new fields in a compatible manner. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
With the separation of the addresspool from the protocol and the introduction of l2 and bgp advertisement, we change the internal structure so that the pool also contains the reference to its advertisements. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
AddressPool is the legacy CRD, and we need to handle it together with IPPools. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
In order to understand if an address (or a prefix) must be advertised, we now need to look at the list of advertisements the pool comes with. Also, now it's possible to have multiple protocols for the same addresspool, so the speaker internal structure changes to accomodate this. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
We change the tests to reflect the new structure, and the config updater to write directly the CRs instead of jumping in the intermediate configuration. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
Cleaning up go.mod and go.sum after dependency changes. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
Aligning the manifests to reflect the changes in the api. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
Aligning the helm charts to reflect the changes in the api. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
We want to ensure that IPPool and AddressPools work together in order to offer compatibility to existing users. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
The configmap name is not needed anymore as there is no configmap, so removing the environment variable. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
The first parameter is of the wrong type, setting it to string. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
We removed the defaulting when parsing the config, so we want to ensure that the default value is being set on the cr. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
|
LGTM |
Now that the integration code is a bit more complex, because it needs to take into account multiple protocols, we add a test that validates it. Signed-off-by: Federico Paolinelli <fpaoline@redhat.com>
c6a6704 to
ea828a8
Compare
@fedepaol Thanks, at least it's good to know it will be possible in the future :) |
This is based on #1237 , and is the second part related to what's being proposed in #942
Here we move from the version of CRDs shipped with the operator to the final design.
We still lack a CRD for the communities and a label selector for selecting the addresspool from the L2 and the BGPAdvertisements, which are gonna be added as a next step.
Also, the e2e tests are updated to reflect this new structure.