Skip to content

Commit

Permalink
BGP Control Plane v2: Updates CiliumBGPNoeConfigOverride Type
Browse files Browse the repository at this point in the history
Previously, the CiliumBGPNodeConfigOverrideSpec included the `nodeRef`
field for referencing the name of the node for which the BGP configuration
is overridden. This approach introduces the potential for conflicts by
multiple CiliumBGPNodeConfigOverride resources referencing the same
CiliumBGPNodeConfig.

This PR removes the `nodeRef` field and updates the CiliumBGPNodeConfigOverride
spec so users understand that the name of the CiliumBGPNodeConfig and
CiliumBGPNodeConfigOverride must match for the configuration overrides to
be applied.

Signed-off-by: Daneyon Hansen <daneyon.hansen@solo.io>
  • Loading branch information
danehans committed Mar 25, 2024
1 parent a5f2a72 commit a7f4feb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion operator/pkg/bgpv2/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (b *BGPResourceManager) upsertNodeConfig(ctx context.Context, config *v2alp
var overrideInstances []v2alpha1.CiliumBGPNodeConfigInstanceOverride
overrides := b.nodeConfigOverrideStore.List()
for _, override := range overrides {
if override.Spec.NodeRef == nodeName {
if override.Name == nodeName {
overrideInstances = override.Spec.BGPInstances
break
}
Expand Down
3 changes: 1 addition & 2 deletions operator/pkg/bgpv2/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ var (
}

nodeOverride1 = cilium_api_v2alpha1.CiliumBGPNodeConfigOverrideSpec{
NodeRef: "node-1",
BGPInstances: []cilium_api_v2alpha1.CiliumBGPNodeConfigInstanceOverride{
{
Name: "cluster-1-instance-65001",
Expand Down Expand Up @@ -385,7 +384,7 @@ func Test_ClusterConfigSteps(t *testing.T) {
nodeOverrides: []*cilium_api_v2alpha1.CiliumBGPNodeConfigOverride{
{
ObjectMeta: meta_v1.ObjectMeta{
Name: "node-1-override",
Name: "node-1",
},

Spec: nodeOverride1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ spec:
name: v2alpha1
schema:
openAPIV3Schema:
description: CiliumBGPNodeConfigOverride is used to overrides some of the
BGP configurations which are node local. Users can user this resource to
override auto-generated BGP settings for the node.
description: CiliumBGPNodeConfigOverride specifies configuration overrides
for a CiliumBGPNodeConfig. It allows fine-tuning of BGP behavior on a per-node
basis. For the override to be effective, the names in CiliumBGPNodeConfigOverride
and CiliumBGPNodeConfig must match exactly. This matching ensures that specific
node configurations are applied correctly and only where intended.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down Expand Up @@ -105,13 +107,8 @@ spec:
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
nodeRef:
description: NodeRef is the name of the node for which the BGP configuration
is overridden.
type: string
required:
- bgpInstances
- nodeRef
type: object
required:
- metadata
Expand Down
11 changes: 4 additions & 7 deletions pkg/k8s/apis/cilium.io/v2alpha1/bgp_node_override_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import (
// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type=date
// +kubebuilder:storageversion

// CiliumBGPNodeConfigOverride is used to overrides some of the BGP configurations which are node local.
// Users can user this resource to override auto-generated BGP settings for the node.
// CiliumBGPNodeConfigOverride specifies configuration overrides for a CiliumBGPNodeConfig.
// It allows fine-tuning of BGP behavior on a per-node basis. For the override to be effective,
// the names in CiliumBGPNodeConfigOverride and CiliumBGPNodeConfig must match exactly. This
// matching ensures that specific node configurations are applied correctly and only where intended.
type CiliumBGPNodeConfigOverride struct {
// +deepequal-gen=false
metav1.TypeMeta `json:",inline"`
Expand All @@ -40,11 +42,6 @@ type CiliumBGPNodeConfigOverrideList struct {
}

type CiliumBGPNodeConfigOverrideSpec struct {
// NodeRef is the name of the node for which the BGP configuration is overridden.
//
// +kubebuilder:validation:Required
NodeRef string `json:"nodeRef"`

// BGPInstances is a list of BGP instances to override.
//
// +kubebuilder:validation:Required
Expand Down
3 changes: 0 additions & 3 deletions pkg/k8s/apis/cilium.io/v2alpha1/zz_generated.deepequal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a7f4feb

Please sign in to comment.