Skip to content

Conversation

hypnoce
Copy link
Contributor

@hypnoce hypnoce commented Mar 16, 2025

Commit Message: [#38557] golang: add callback method for http plugin config destruction

Additional Description:

This enables fine grained control over the lifecycle of golang filter config in sync with C++.
Some use cases store states and resources in the config object that needs to be cleaned when config is deleted or renewed.
The current design breaks the config parser API by introducing a Destroy function in StreamFilterConfigParser. A PassThroughStreamFilterConfigParser is available to help code adaptation.
Given an existing parser

import "github.com/envoyproxy/envoy/contrib/golang/common/go/api"

type parser struct {
}

func (p *parser) Parse(any *anypb.Any, callbacks api.ConfigCallbackHandler) (interface{}, error) {
	...
}

func (p *parser) Merge(parent interface{}, child interface{}) interface{} {
	...
}

The new one just needs to compose with the passthrough

type parser struct {
	api.PassThroughStreamFilterConfigParser
}

Risk Level: Low

Testing: A test in config_test.cc was added to ensure Destroy function is being called on the config instance.

Docs Changes: none

Release Notes:

added http golang filter config destroy callback. When a config gets deleted from envoy, the go plugin calls the
Destroy function on the config parser instance. This introduces a breaking change in the golang parser interface.

Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

hypnoce added 11 commits March 16, 2025 14:48
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Signed-off-by: Francois JACQUES <fjacques@murex.com>
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #38767 was opened by hypnoce.

see: more, trace.

Signed-off-by: Francois JACQUES <fjacques@murex.com>
@hypnoce hypnoce force-pushed the go_destroy_config_2 branch from 5d55180 to f506ea3 Compare March 16, 2025 15:52
@hypnoce hypnoce changed the title Go destroy config golang: add callback method for http plugin config destruction (fixes #38557) Mar 16, 2025
@hypnoce hypnoce closed this Mar 21, 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.

1 participant