extension

package
v2.6.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	URLPrefix                    = "/extensions"
	HeaderArgoCDApplicationName  = "Argocd-Application-Name"
	DefaultConnectionTimeout     = 2 * time.Second
	DefaultKeepAlive             = 15 * time.Second
	DefaultIdleConnectionTimeout = 60 * time.Second
	DefaultMaxIdleConnections    = 30
)

Variables

This section is empty.

Functions

func NewProxy

func NewProxy(targetURL string, config ProxyConfig) (*httputil.ReverseProxy, error)

NewProxy will instantiate a new reverse proxy based on the provided targetURL and config.

Types

type ApplicationGetter

type ApplicationGetter interface {
	Get(ns, name string) (*v1alpha1.Application, error)
}

ApplicationGetter defines the contract to retrieve the application resource.

type BackendConfig

type BackendConfig struct {
	ProxyConfig
	Services []ServiceConfig `json:"services"`
}

BackendConfig defines the backend service configurations that will be used by an specific extension. An extension can have multiple services associated. This is necessary when Argo CD is managing applications in external clusters. In this case, each cluster may have its own backend service.

type DefaultApplicationGetter

type DefaultApplicationGetter struct {
	// contains filtered or unexported fields
}

DefaultApplicationGetter is the real application getter implementation.

func NewDefaultApplicationGetter

func NewDefaultApplicationGetter(appSvc applicationpkg.ApplicationServiceServer) *DefaultApplicationGetter

NewDefaultApplicationGetter returns the default application getter.

func (*DefaultApplicationGetter) Get

Get will retrieve the application resorce for the given namespace and name.

type DefaultSettingsGetter

type DefaultSettingsGetter struct {
	// contains filtered or unexported fields
}

DefaultSettingsGetter is the real settings getter implementation.

func NewDefaultSettingsGetter

func NewDefaultSettingsGetter(mgr *settings.SettingsManager) *DefaultSettingsGetter

NewDefaultSettingsGetter returns a new default settings getter.

func (*DefaultSettingsGetter) Get

Get will retrieve the Argo CD settings.

type ExtensionConfig

type ExtensionConfig struct {
	// Name defines the endpoint that will be used to register
	// the extension route. Mandatory field.
	Name    string        `json:"name"`
	Backend BackendConfig `json:"backend"`
}

ExtensionConfig defines the configuration for one extension.

type ExtensionConfigs

type ExtensionConfigs struct {
	Extensions []ExtensionConfig `json:"extensions"`
}

ExtensionConfigs defines the configurations for all extensions retrieved from Argo CD configmap (argocd-cm).

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is the object that will be responsible for registering and handling proxy extensions.

func NewManager

func NewManager(sg SettingsGetter, ag ApplicationGetter, log *log.Entry) *Manager

NewManager will initialize a new manager.

func (*Manager) CallExtension

func (m *Manager) CallExtension(extName string, proxyByCluster map[string]*httputil.ReverseProxy) func(http.ResponseWriter, *http.Request)

CallExtension returns a handler func responsible for forwarding requests to the extension service. The request will be sanitized by removing sensitive headers.

func (*Manager) RegisterHandlers

func (m *Manager) RegisterHandlers(r *mux.Router) error

RegisterHandlers will retrieve all configured extensions and register the respective http handlers in the given router.

type ProxyConfig

type ProxyConfig struct {
	// ConnectionTimeout is the maximum amount of time a dial to
	// the extension server will wait for a connect to complete.
	// Default: 2 seconds
	ConnectionTimeout time.Duration `json:"connectionTimeout"`

	// KeepAlive specifies the interval between keep-alive probes
	// for an active network connection between the API server and
	// the extension server.
	// Default: 15 seconds
	KeepAlive time.Duration `json:"keepAlive"`

	// IdleConnectionTimeout is the maximum amount of time an idle
	// (keep-alive) connection between the API server and the extension
	// server will remain idle before closing itself.
	// Default: 60 seconds
	IdleConnectionTimeout time.Duration `json:"idleConnectionTimeout"`

	// MaxIdleConnections controls the maximum number of idle (keep-alive)
	// connections between the API server and the extension server.
	// Default: 30
	MaxIdleConnections int `json:"maxIdleConnections"`
}

ProxyConfig allows configuring connection behaviour between Argo CD API Server and the backend service.

type ServiceConfig

type ServiceConfig struct {
	// URL is the address where the extension backend must be available.
	// Mandatory field.
	URL string `json:"url"`

	// Cluster if provided, will have to match the application
	// destination name to have requests properly forwarded to this
	// service URL.
	Cluster string `json:"cluster"`
}

ServiceConfig provides the configuration for a backend service.

type SettingsGetter

type SettingsGetter interface {
	Get() (*settings.ArgoCDSettings, error)
}

SettingsGetter defines the contract to retrieve Argo CD Settings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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