mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
Assumes `envoy:smi` as the mesh provider name as I've successfully tested the progressive delivery for Envoy + Crossover with it. This enhances Flagger to translate it to the metrics provider name of `envoy` for deployment targets, or `envoy:service` for service targets. The `envoy` metrics provider is equivalent to `appmesh`, as both relies on the same set of standard metrics exposed by Envoy itself. The `envoy:service` is almost the same as the `envoy` provider, but removing the condition on pod name, as we only need to filter on the backing service name = envoy_cluster_name. We don't consider other Envoy xDS implementations that uses anything that is different to original servicen ames as `envoy_cluster_name`, for now. Ref #385
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package metrics
|
|
|
|
import (
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
type Factory struct {
|
|
Client *PrometheusClient
|
|
}
|
|
|
|
func NewFactory(metricsServer string, timeout time.Duration) (*Factory, error) {
|
|
client, err := NewPrometheusClient(metricsServer, timeout)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &Factory{
|
|
Client: client,
|
|
}, nil
|
|
}
|
|
|
|
func (factory Factory) Observer(provider string) Interface {
|
|
switch {
|
|
case provider == "none":
|
|
return &HttpObserver{
|
|
client: factory.Client,
|
|
}
|
|
case provider == "kubernetes":
|
|
return &HttpObserver{
|
|
client: factory.Client,
|
|
}
|
|
case provider == "appmesh", provider == "envoy":
|
|
return &EnvoyObserver{
|
|
client: factory.Client,
|
|
}
|
|
case provider == "nginx":
|
|
return &NginxObserver{
|
|
client: factory.Client,
|
|
}
|
|
case strings.HasPrefix(provider, "gloo"):
|
|
return &GlooObserver{
|
|
client: factory.Client,
|
|
}
|
|
case provider == "appmesh:service", provider == "envoy:service":
|
|
return &EnvoyServiceObserver{
|
|
client: factory.Client,
|
|
}
|
|
case provider == "linkerd":
|
|
return &LinkerdObserver{
|
|
client: factory.Client,
|
|
}
|
|
default:
|
|
return &IstioObserver{
|
|
client: factory.Client,
|
|
}
|
|
}
|
|
}
|