Skip to content

fix: translate consul namespace when attempting to deregister service#2343

Closed
nathancoleman wants to merge 6 commits intomainfrom
fix-dereg-namespace
Closed

fix: translate consul namespace when attempting to deregister service#2343
nathancoleman wants to merge 6 commits intomainfrom
fix-dereg-namespace

Conversation

@nathancoleman
Copy link
Copy Markdown
Member

@nathancoleman nathancoleman commented Jun 12, 2023

Changes proposed in this PR:
When deregistering service, we always include the namespace, even if running OSS. This causes the controller to be unable to deregister services when running OSS due to the following error:

error deregistering services	{"gateway": "gateway-conformance-infra/same-namespace-with-http-listener-on-8080", "error": "Unexpected response code: 400 (Invalid query parameter: \"ns\" - Namespaces are a Consul Enterprise feature)"}
github.com/hashicorp/consul-k8s/control-plane/api-gateway/controllers.(*GatewayController).Reconcile
	/home/runner/work/consul-k8s/consul-k8s/control-plane/api-gateway/controllers/gateway_controller.go:216
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:122
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:323
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:274
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/home/runner/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.14.6/pkg/internal/controller/controller.go:235

This was introduced in #2321

How I've tested this PR:

  1. Run consul-k8s using consul OSS instead of enterprise.
  2. Create a Gateway and then delete it.

The above naturally occurs as part of the conformance testing suite defined by kubernetes-sigs/gateway-api.

How I expect reviewers to test this PR:
See above

Checklist:

  • Tests added
  • CHANGELOG entry added

    HashiCorp engineers only, community PRs should not add a changelog entry.
    Entries should use present tense (e.g. Add support for...)

@nathancoleman nathancoleman added theme/api-gateway Related to Consul API Gateway pr/no-changelog PR does not need a corresponding .changelog entry backport/1.2.x This release branch is no longer active. labels Jun 12, 2023
@nathancoleman nathancoleman marked this pull request as ready for review June 12, 2023 19:31
@nathancoleman nathancoleman changed the title fix: only set namespace on service deregistration if namespaces enabled fix: translate consul namespace when attempting to deregister service Jun 12, 2023
@nathancoleman
Copy link
Copy Markdown
Member Author

Closing in favor of #2353

@nathancoleman nathancoleman deleted the fix-dereg-namespace branch June 13, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.2.x This release branch is no longer active. pr/no-changelog PR does not need a corresponding .changelog entry theme/api-gateway Related to Consul API Gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant