open-consul/envoyextensions/extensioncommon/envoy_extender.go
hc-github-team-consul-core f6c31df709
Backport of [NET-4703] Prevent partial application of Envoy extensions into release/1.16.x (#18332)
backport of commit a920c7195b4ea298bf32b2d535a7eed60e6e0050

Co-authored-by: Michael Zalimeni <michael.zalimeni@hashicorp.com>
2023-07-31 19:37:54 +00:00

29 lines
1.1 KiB
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package extensioncommon
import (
"github.com/hashicorp/consul/envoyextensions/xdscommon"
)
// EnvoyExtender is the interface that all Envoy extensions must implement in order
// to be dynamically executed during runtime.
type EnvoyExtender interface {
// CanApply checks whether the extension configured for this extender is eligible
// for application based on the specified RuntimeConfig.
CanApply(*RuntimeConfig) bool
// Validate ensures the data in config can successfuly be used
// to apply the specified Envoy extension.
Validate(*RuntimeConfig) error
// Extend updates indexed xDS structures to include patches for
// built-in extensions. It is responsible for applying extensions to
// the the appropriate xDS resources. If any portion of this function fails,
// it will attempt continue and return an error. The caller can then determine
// if it is better to use a partially applied extension or error out.
Extend(*xdscommon.IndexedResources, *RuntimeConfig) (*xdscommon.IndexedResources, error)
}