Skip to content

Commit

Permalink
Add blocking for EnableIngressController in validation
Browse files Browse the repository at this point in the history
We want to block any configurations that enable ingress controllers when using delegated IPAM.
Cilium allocates its own IP address for sending and differentiating ingress traffic, which is
not possible with delegated IPAM. This change will provide a clearer error message for this.

Signed-off-by: Ricky Ho <horicky78@gmail.com>
  • Loading branch information
rickysumho authored and joestringer committed Jul 31, 2023
1 parent a49552e commit fded1ab
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/option/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3785,6 +3785,15 @@ func (c *DaemonConfig) checkIPAMDelegatedPlugin() error {
if c.EnableEndpointHealthChecking {
return fmt.Errorf("--%s must be disabled with --%s=%s", EnableEndpointHealthChecking, IPAM, ipamOption.IPAMDelegatedPlugin)
}
// Ingress controller and envoy config require cilium-agent to create an IP address
// specifically for differentiating ingress and envoy traffic, which is not possible
// with delegated IPAM.
if c.EnableIngressController {
return fmt.Errorf("--%s must be disabled with --%s=%s", EnableIngressController, IPAM, ipamOption.IPAMDelegatedPlugin)
}
if c.EnableEnvoyConfig {
return fmt.Errorf("--%s must be disabled with --%s=%s", EnableEnvoyConfig, IPAM, ipamOption.IPAMDelegatedPlugin)
}
}
return nil
}
Expand Down
16 changes: 16 additions & 0 deletions pkg/option/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,22 @@ func TestCheckIPAMDelegatedPlugin(t *testing.T) {
},
expectErr: fmt.Errorf("--local-router-ipv6 must be provided when IPv6 is enabled with --ipam=delegated-plugin"),
},
{
name: "IPAMDelegatedPlugin with ingress controller enabled",
d: &DaemonConfig{
IPAM: ipamOption.IPAMDelegatedPlugin,
EnableIngressController: true,
},
expectErr: fmt.Errorf("--enable-ingress-controller must be disabled with --ipam=delegated-plugin"),
},
{
name: "IPAMDelegatedPlugin with envoy config enabled",
d: &DaemonConfig{
IPAM: ipamOption.IPAMDelegatedPlugin,
EnableEnvoyConfig: true,
},
expectErr: fmt.Errorf("--enable-envoy-config must be disabled with --ipam=delegated-plugin"),
},
}

for _, tt := range tests {
Expand Down

0 comments on commit fded1ab

Please sign in to comment.