Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: disable envoy admin by default, expose stats via envoy route (#…
- Loading branch information
1 parent
78d7a97
commit daed2d2
Showing
11 changed files
with
198 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package envoyconfig | ||
|
||
import ( | ||
"context" | ||
|
||
envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" | ||
envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" | ||
envoy_config_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" | ||
|
||
"github.com/pomerium/pomerium/config" | ||
) | ||
|
||
func (b *Builder) buildEnvoyAdminCluster(ctx context.Context, cfg *config.Config) (*envoy_config_cluster_v3.Cluster, error) { | ||
return &envoy_config_cluster_v3.Cluster{ | ||
Name: envoyAdminClusterName, | ||
ConnectTimeout: defaultConnectionTimeout, | ||
LoadAssignment: &envoy_config_endpoint_v3.ClusterLoadAssignment{ | ||
ClusterName: envoyAdminClusterName, | ||
Endpoints: []*envoy_config_endpoint_v3.LocalityLbEndpoints{{ | ||
LbEndpoints: []*envoy_config_endpoint_v3.LbEndpoint{{ | ||
HostIdentifier: &envoy_config_endpoint_v3.LbEndpoint_Endpoint{ | ||
Endpoint: &envoy_config_endpoint_v3.Endpoint{ | ||
Address: &envoy_config_core_v3.Address{ | ||
Address: &envoy_config_core_v3.Address_Pipe{ | ||
Pipe: &envoy_config_core_v3.Pipe{ | ||
Path: envoyAdminAddressPath, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}}, | ||
}}, | ||
}, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package envoyconfig | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
envoy_config_listener_v3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3" | ||
envoy_config_route_v3 "github.com/envoyproxy/go-control-plane/envoy/config/route/v3" | ||
envoy_http_connection_manager "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" | ||
|
||
"github.com/pomerium/pomerium/config" | ||
) | ||
|
||
func (b *Builder) buildEnvoyAdminListener(ctx context.Context, cfg *config.Config) (*envoy_config_listener_v3.Listener, error) { | ||
filter, err := b.buildEnvoyAdminHTTPConnectionManagerFilter() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
filterChain := &envoy_config_listener_v3.FilterChain{ | ||
Filters: []*envoy_config_listener_v3.Filter{ | ||
filter, | ||
}, | ||
} | ||
|
||
addr, err := parseAddress(cfg.Options.EnvoyAdminAddress) | ||
if err != nil { | ||
return nil, fmt.Errorf("envoy_admin_addr %s: %w", cfg.Options.EnvoyAdminAddress, err) | ||
} | ||
|
||
li := newEnvoyListener("envoy-admin") | ||
li.Address = addr | ||
li.FilterChains = []*envoy_config_listener_v3.FilterChain{filterChain} | ||
return li, nil | ||
} | ||
|
||
func (b *Builder) buildEnvoyAdminHTTPConnectionManagerFilter() (*envoy_config_listener_v3.Filter, error) { | ||
rc, err := b.buildRouteConfiguration("envoy-admin", []*envoy_config_route_v3.VirtualHost{{ | ||
Name: "envoy-admin", | ||
Domains: []string{"*"}, | ||
Routes: []*envoy_config_route_v3.Route{ | ||
{ | ||
Name: "envoy-admin", | ||
Match: &envoy_config_route_v3.RouteMatch{ | ||
PathSpecifier: &envoy_config_route_v3.RouteMatch_Prefix{Prefix: "/"}, | ||
}, | ||
Action: &envoy_config_route_v3.Route_Route{ | ||
Route: &envoy_config_route_v3.RouteAction{ | ||
ClusterSpecifier: &envoy_config_route_v3.RouteAction_Cluster{ | ||
Cluster: envoyAdminClusterName, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return HTTPConnectionManagerFilter(&envoy_http_connection_manager.HttpConnectionManager{ | ||
CodecType: envoy_http_connection_manager.HttpConnectionManager_AUTO, | ||
StatPrefix: "envoy-admin", | ||
RouteSpecifier: &envoy_http_connection_manager.HttpConnectionManager_RouteConfig{ | ||
RouteConfig: rc, | ||
}, | ||
HttpFilters: []*envoy_http_connection_manager.HttpFilter{ | ||
HTTPRouterFilter(), | ||
}, | ||
}), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.