Skip to content

Commit

Permalink
proxy: remove dns proxy port from config
Browse files Browse the repository at this point in the history
Currently, the proxy config contains the unnecessary field `DNSProxyPort`.

DNS Proxy port is allocated and set during DNS boostrap in the agent.

Hence, let's remove the field (that wasn't configurable anyway).

Signed-off-by: Marco Hofstetter <[email protected]>
  • Loading branch information
mhofstetter authored and tklauser committed Mar 22, 2024
1 parent 74b4a37 commit aefd4ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pkg/proxy/cell.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ var Cell = cell.Module(
type ProxyConfig struct {
ProxyPortrangeMin uint16
ProxyPortrangeMax uint16
DNSProxyPort uint16
}

func (r ProxyConfig) Flags(flags *pflag.FlagSet) {
Expand Down Expand Up @@ -62,7 +61,7 @@ func newProxy(params proxyParams) *Proxy {

configureProxyLogger(params.EndpointInfoRegistry, params.MonitorAgent, option.Config.AgentLabels)

return createProxy(params.Config.ProxyPortrangeMin, params.Config.ProxyPortrangeMax, params.Config.DNSProxyPort, params.Datapath, params.EnvoyProxyIntegration, params.DNSProxyIntegration)
return createProxy(params.Config.ProxyPortrangeMin, params.Config.ProxyPortrangeMax, params.Datapath, params.EnvoyProxyIntegration, params.DNSProxyIntegration)
}

type envoyProxyIntegrationParams struct {
Expand Down
6 changes: 2 additions & 4 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ type Proxy struct {
func createProxy(
minPort uint16,
maxPort uint16,
dnsProxyPort uint16,
datapathUpdater DatapathUpdater,
envoyIntegration *envoyProxyIntegration,
dnsIntegration *dnsProxyIntegration,
Expand All @@ -125,13 +124,13 @@ func createProxy(
redirects: make(map[string]*Redirect),
datapathUpdater: datapathUpdater,
allocatedPorts: make(map[uint16]bool),
proxyPorts: defaultProxyPortMap(dnsProxyPort),
proxyPorts: defaultProxyPortMap(),
envoyIntegration: envoyIntegration,
dnsIntegration: dnsIntegration,
}
}

func defaultProxyPortMap(dnsProxyPort uint16) map[string]*ProxyPort {
func defaultProxyPortMap() map[string]*ProxyPort {
return map[string]*ProxyPort{
"cilium-http-egress": {
proxyType: types.ProxyTypeHTTP,
Expand All @@ -147,7 +146,6 @@ func defaultProxyPortMap(dnsProxyPort uint16) map[string]*ProxyPort {
proxyType: types.ProxyTypeDNS,
ingress: false,
localOnly: true,
proxyPort: dnsProxyPort,
},
"cilium-proxylib-egress": {
proxyType: types.ProxyTypeAny,
Expand Down
4 changes: 2 additions & 2 deletions pkg/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (s *ProxySuite) TestPortAllocator(c *C) {
err := os.MkdirAll(socketDir, 0700)
c.Assert(err, IsNil)

p := createProxy(10000, 20000, 0, mockDatapathUpdater, nil, nil)
p := createProxy(10000, 20000, mockDatapathUpdater, nil, nil)

port, err := p.AllocateProxyPort("listener1", false, true)
c.Assert(err, IsNil)
Expand Down Expand Up @@ -209,7 +209,7 @@ func (s *ProxySuite) TestCreateOrUpdateRedirectMissingListener(c *C) {
err := os.MkdirAll(socketDir, 0700)
c.Assert(err, IsNil)

p := createProxy(10000, 20000, 0, mockDatapathUpdater, nil, nil)
p := createProxy(10000, 20000, mockDatapathUpdater, nil, nil)

ep := &endpointtest.ProxyUpdaterMock{
Id: 1000,
Expand Down

0 comments on commit aefd4ea

Please sign in to comment.