Skip to content

Enhance service deregistration logic for agentless mode #311

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

srahul3
Copy link
Contributor

@srahul3 srahul3 commented May 9, 2025

This pull request introduces changes to the agent.go file to handle service deregistration logic for agentless nodes and adds a new utility method for write options in Consul API interactions. Below is a summary of the most important changes:

Enhancements to service deregistration:

  • Updated the Run method in func (a *Agent) Run() error to include a conditional block for agentless nodes. If the agent is in agentless mode, it now constructs a CatalogDeregistration object and attempts to deregister the service using the Consul Catalog API. A warning is logged if the deregistration fails.

Utility method addition:

  • Added a new method, func (a *Agent) ConsulWriteOption() *api.WriteOptions, to generate WriteOptions for Consul API calls. This method dynamically sets the partition information if available, improving consistency in API interactions.

@srahul3 srahul3 requested a review from a team as a code owner May 9, 2025 07:16
@srahul3 srahul3 merged commit 3a7fdca into main May 9, 2025
53 checks passed
@srahul3 srahul3 deleted the srahul3/fix_agentless_deregistration branch May 9, 2025 07:28
magec pushed a commit to magec/consul-esm that referenced this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants