istio

package
v0.2.0-dev.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 38 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FilterMetadataServiceName = "cluster_metadata.filter_metadata.istio.services.0.name"
	FilterMetadataServiceHost = "cluster_metadata.filter_metadata.istio.services.0.host"
)

Variables

View Source
var (
	IstioCAConfigGetterRemote = func(e *environment.IstioEnvironment) (istio_ca.IstioCAClientConfig, error) {
		return istio_ca.GetIstioCAClientConfig(e.ClusterID, e.IstioRevision)
	}
	IstioCAConfigGetterLocal = func(e *environment.IstioEnvironment) (istio_ca.IstioCAClientConfig, error) {
		return istio_ca.GetIstioCAClientConfigFromLocal(e.ClusterID, e.IstioCAAddress)
	}
	IstioCAConfigGetterHeimdall = func(ctx context.Context, heimdallURL, authorizationToken string, version string) IstioCAConfigGetterFunc {
		return func(e *environment.IstioEnvironment) (istio_ca.IstioCAClientConfig, error) {
			c, err := istio_ca.GetIstioCAClientConfigFromHeimdall(ctx, heimdallURL, authorizationToken, version)
			if err != nil {
				return istio_ca.IstioCAClientConfig{}, err
			}

			e.Override(c.Environment)

			e.ClusterID = c.CAClientConfig.ClusterID
			e.IstioRevision = c.CAClientConfig.Revision
			e.IstioCAAddress = c.CAClientConfig.CAEndpointSAN
			e.IstioVersion = c.Environment.IstioVersion

			return c.CAClientConfig, nil
		}
	}
	IstioCAConfigGetterAuto = func(e *environment.IstioEnvironment) (istio_ca.IstioCAClientConfig, error) {
		if heimdallURL := os.Getenv("HEIMDALL_URL"); heimdallURL != "" {
			c := IstioCAConfigGetterHeimdall(context.Background(), heimdallURL, os.Getenv("HEIMDALL_AUTH_TOKEN"), os.Getenv("NASP_APP_VERSION"))

			return c(e)
		}

		fe := func(filename string) bool {
			info, err := os.Stat(filename)
			if os.IsNotExist(err) {
				return false
			}
			return !info.IsDir()
		}

		if fe(istio_ca.K8sSATrustworthyJWTFileName) {
			return IstioCAConfigGetterLocal(e)
		}

		return IstioCAConfigGetterRemote(e)
	}
)
View Source
var DefaultIstioIntegrationHandlerConfig = IstioIntegrationHandlerConfig{
	Enabled:        true,
	MetricsPath:    "/stats/prometheus",
	MetricsAddress: ":16090",
	UseTLS:         true,

	IstioCAConfigGetter: IstioCAConfigGetterAuto,
}

Functions

func NewIstioHTTPHandlerMiddleware

func NewIstioHTTPHandlerMiddleware() pwhttp.HandleMiddleware

func NewIstioHTTPRequestTransport

func NewIstioHTTPRequestTransport(transport http.RoundTripper, caClient ca.Client, discoveryClient discovery.DiscoveryClient, logger logr.Logger, tracer *zipkin.Tracer) http.RoundTripper

Types

type IstioIntegrationHandler

type IstioIntegrationHandler interface {
	Run(context.Context) error
	GetGRPCDialOptions() ([]grpc.DialOption, error)
	ListenAndServe(ctx context.Context, listenAddress string, handler http.Handler) error
	GetHTTPTransport(transport http.RoundTripper) (http.RoundTripper, error)
	GetTCPListener(l net.Listener) (net.Listener, error)
	GetTCPDialer() (itcp.Dialer, error)
	GetDiscoveryClient() discovery.DiscoveryClient
}

func NewIstioIntegrationHandler

func NewIstioIntegrationHandler(config *IstioIntegrationHandlerConfig, logger logr.Logger) (IstioIntegrationHandler, error)

type IstioIntegrationHandlerConfig

type IstioIntegrationHandlerConfig struct {
	Enabled             bool
	MetricsPath         string
	MetricsAddress      string
	PushgatewayConfig   *PushgatewayConfig
	UseTLS              bool
	ServerFilters       []api.WasmPluginConfig
	ClientFilters       []api.WasmPluginConfig
	IstioCAConfigGetter IstioCAConfigGetterFunc
	DefaultWASMRuntime  string
}

func (*IstioIntegrationHandlerConfig) SetDefaults

func (c *IstioIntegrationHandlerConfig) SetDefaults()

type PushgatewayConfig

type PushgatewayConfig struct {
	Address           string
	PushInterval      time.Duration
	UseUniqueIDLabel  bool
	UniqueIDLabelName string
}

func (*PushgatewayConfig) SetDefaults

func (c *PushgatewayConfig) SetDefaults()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL