Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET-10480 - fix setting namespace and partition setting in dns-proxy mode #593

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

jmurret
Copy link
Member

@jmurret jmurret commented Jul 22, 2024

This fixes how namespace and partition get set when in dns-proxy mode. The prior attempt at this moved starting the DNS above starting envoy. What was not clear was that starting envoy set resolvedProxyConfig in state so it was not set when DNS started and dns-proxy always started with the default namespace and partition. In the process, i also got rid of using state to pass parameters and just used the function signature to have the appropriate parameters.

@jmurret jmurret added the pr/no-changelog This PR does not introduce a user-facing change that should be reflected in the changelog label Jul 22, 2024
@@ -27,9 +27,8 @@ const (
)

// bootstrapConfig generates the Envoy bootstrap config in JSON format.
func (cdp *ConsulDataplane) bootstrapConfig(ctx context.Context) (*bootstrap.BootstrapConfig, []byte, error) {
func (cdp *ConsulDataplane) getBootstrapParams(ctx context.Context) (*pbdataplane.GetEnvoyBootstrapParamsResponse, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dns proxy requires bootstrap params to set the namespace and partition.....but it does not require the bootstrap config itself. So we are splitting this into two functions, so that startDNSProxy() can get require bootstrap params in its signature rather than just assuming it is already set on the struct.

pkg/consuldp/bootstrap.go Outdated Show resolved Hide resolved

// bootstrapConfig generates the Envoy bootstrap config in JSON format.
func (cdp *ConsulDataplane) bootstrapConfig(
bootstrapParams *pbdataplane.GetEnvoyBootstrapParamsResponse) (*bootstrap.BootstrapConfig, []byte, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A prior call will already have gotten bootstrap params for this call as well as startDNSProxy()

@jmurret jmurret marked this pull request as ready for review July 24, 2024 22:22
@jmurret jmurret requested a review from a team as a code owner July 24, 2024 22:22
@jmurret jmurret changed the title fix logic of running dns proxy because it relied on some ambient context to be set fix setting namespace and partition setting in dns-proxy mode Jul 24, 2024
@jmurret jmurret changed the title fix setting namespace and partition setting in dns-proxy mode NET-10480 - fix setting namespace and partition setting in dns-proxy mode Jul 24, 2024
Copy link
Member

@zalimeni zalimeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for refactoring this and adding test + log cover 👍🏻

@jmurret jmurret merged commit dadecf5 into main Jul 29, 2024
42 checks passed
@jmurret jmurret deleted the jm/NET-10480 branch July 29, 2024 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/no-changelog This PR does not introduce a user-facing change that should be reflected in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants