Documentation ¶
Index ¶
- Variables
- func ChangeLogLevel(level logrus.Level)
- func GetProxyPort(name string) (uint16, error)
- type CRDRedirect
- type DatapathUpdater
- type EndpointLookup
- type IPCacheManager
- type Proxy
- func (p *Proxy) AckProxyPort(ctx context.Context, name string) error
- func (p *Proxy) AllocateProxyPort(name string, ingress bool) (uint16, error)
- func (p *Proxy) CreateOrUpdateRedirect(ctx context.Context, l4 policy.ProxyPolicy, id string, ...) (proxyPort uint16, err error, finalizeFunc revert.FinalizeFunc, ...)
- func (p *Proxy) GetStatusModel() *models.ProxyStatus
- func (p *Proxy) ReinstallRules(ctx context.Context) error
- func (p *Proxy) ReleaseProxyPort(name string) error
- func (p *Proxy) RemoveRedirect(id string, wg *completion.WaitGroup) (error, revert.FinalizeFunc, revert.RevertFunc)
- func (p *Proxy) SetProxyPort(name string, proxyType ProxyType, port uint16, ingress bool) error
- func (p *Proxy) UpdateEnvoyResources(ctx context.Context, old, new envoy.Resources, ...) error
- func (p *Proxy) UpdateNetworkPolicy(ep logger.EndpointUpdater, vis *policy.VisibilityPolicy, ...) (error, func() error)
- func (p *Proxy) UpsertEnvoyResources(ctx context.Context, resources envoy.Resources, ...) error
- func (p *Proxy) UseCurrentNetworkPolicy(ep logger.EndpointUpdater, policy *policy.L4Policy, wg *completion.WaitGroup)
- type ProxyPort
- type ProxyType
- type Redirect
- type RedirectImplementation
Constants ¶
This section is empty.
Variables ¶
var ( // Allocator is a package-level variable which is used to lookup security // identities from their numeric representation. // TODO: plumb an allocator in from callers of these functions vs. having // this as a package-level variable. Allocator cache.IdentityAllocator )
var ( // DefaultDNSProxy is the global, shared, DNS Proxy singleton. DefaultDNSProxy proxy.DNSProxier )
Functions ¶
func ChangeLogLevel ¶ added in v1.5.0
ChangeLogLevel changes proxy log level to correspond to the logrus log level 'level'.
func GetProxyPort ¶ added in v1.6.0
GetProxyPort() returns the fixed listen port for a proxy, if any.
Types ¶
type CRDRedirect ¶ added in v1.14.0
type CRDRedirect struct{}
Redirect type for custom Listeners, which are managed externally.
func (*CRDRedirect) Close ¶ added in v1.14.0
func (r *CRDRedirect) Close(wg *completion.WaitGroup) (revert.FinalizeFunc, revert.RevertFunc)
func (*CRDRedirect) UpdateRules ¶ added in v1.14.0
func (r *CRDRedirect) UpdateRules(wg *completion.WaitGroup) (revert.RevertFunc, error)
type DatapathUpdater ¶ added in v1.6.0
type EndpointLookup ¶ added in v1.14.0
EndpointLookup is any type which maps from IP to the endpoint owning that IP.
type IPCacheManager ¶ added in v1.14.0
type Proxy ¶
Proxy maintains state about redirects
func StartProxySupport ¶ added in v1.5.0
func StartProxySupport(minPort uint16, maxPort uint16, stateDir string, accessLogNotifier logger.LogRecordNotifier, accessLogMetadata []string, datapathUpdater DatapathUpdater, mgr EndpointLookup, ipcache IPCacheManager) *Proxy
StartProxySupport starts the servers to support L7 proxies: xDS GRPC server and access log server.
func (*Proxy) AckProxyPort ¶ added in v1.14.0
AckProxyPort() marks the proxy of the given type as successfully created and creates or updates the datapath rules accordingly.
func (*Proxy) AllocateProxyPort ¶ added in v1.14.0
AllocateProxyPort() allocates a new port for listener 'name', or returns the current one if already allocated. Each call has to be paired with AckProxyPort(name) to update the datapath rules accordingly. Each allocated port must be eventually freed with ReleaseProxyPort().
func (*Proxy) CreateOrUpdateRedirect ¶
func (p *Proxy) CreateOrUpdateRedirect(ctx context.Context, l4 policy.ProxyPolicy, id string, localEndpoint logger.EndpointUpdater, wg *completion.WaitGroup) (proxyPort uint16, err error, finalizeFunc revert.FinalizeFunc, revertFunc revert.RevertFunc)
CreateOrUpdateRedirect creates or updates a L4 redirect with corresponding proxy configuration. This will allocate a proxy port as required and launch a proxy instance. If the redirect is already in place, only the rules will be updated. The proxy listening port is returned, but proxy configuration on that port may still be ongoing asynchronously. Caller should wait for successful completion on 'wg' before assuming the returned proxy port is listening. Caller must call exactly one of the returned functions: - finalizeFunc to make the changes stick, or - revertFunc to cancel the changes. Called with 'localEndpoint' locked!
func (*Proxy) GetStatusModel ¶ added in v1.5.0
func (p *Proxy) GetStatusModel() *models.ProxyStatus
GetStatusModel returns the proxy status as API model
func (*Proxy) ReinstallRules ¶ added in v1.6.0
ReinstallRules is called by daemon reconfiguration to re-install proxy ports rules that were removed during the removal of all Cilium rules.
func (*Proxy) ReleaseProxyPort ¶ added in v1.14.0
func (*Proxy) RemoveRedirect ¶
func (p *Proxy) RemoveRedirect(id string, wg *completion.WaitGroup) (error, revert.FinalizeFunc, revert.RevertFunc)
RemoveRedirect removes an existing redirect that has been successfully created earlier.
func (*Proxy) SetProxyPort ¶ added in v1.6.0
SetProxyPort() marks the proxy 'name' as successfully created with proxy port 'port'. Another call to AckProxyPort(name) is needed to update the datapath rules accordingly. This should only be called for proxies that have a static listener that is already listening on 'port'. May only be called once per proxy.
func (*Proxy) UpdateEnvoyResources ¶ added in v1.14.0
func (p *Proxy) UpdateEnvoyResources(ctx context.Context, old, new envoy.Resources, portAllocator envoy.PortAllocator) error
Overload XDSServer.UpdateEnvoyResources to start Envoy on demand
func (*Proxy) UpdateNetworkPolicy ¶ added in v1.6.4
func (p *Proxy) UpdateNetworkPolicy(ep logger.EndpointUpdater, vis *policy.VisibilityPolicy, policy *policy.L4Policy, ingressPolicyEnforced, egressPolicyEnforced bool, wg *completion.WaitGroup) (error, func() error)
UpdateNetworkPolicy must update the redirect configuration of an endpoint in the proxy
func (*Proxy) UpsertEnvoyResources ¶ added in v1.14.0
func (p *Proxy) UpsertEnvoyResources(ctx context.Context, resources envoy.Resources, portAllocator envoy.PortAllocator) error
Overload XDSServer.UpsertEnvoyResources to start Envoy on demand
func (*Proxy) UseCurrentNetworkPolicy ¶ added in v1.6.4
func (p *Proxy) UseCurrentNetworkPolicy(ep logger.EndpointUpdater, policy *policy.L4Policy, wg *completion.WaitGroup)
UseCurrentNetworkPolicy inserts a Completion to the WaitGroup if the current network policy has not yet been acked
type ProxyPort ¶ added in v1.6.0
type ProxyPort struct {
// contains filtered or unexported fields
}
type ProxyType ¶ added in v1.14.0
type ProxyType string
const ( // ProxyTypeAny represents the case where no proxy type is provided. ProxyTypeAny ProxyType = "" // ProxyTypeHTTP specifies the Envoy HTTP proxy type ProxyTypeHTTP ProxyType = "http" // ProxyTypeDNS specifies the staticly configured DNS proxy type ProxyTypeDNS ProxyType = "dns" // ProxyTypeCRD specifies a proxy configured via CiliumEnvoyConfig CRD ProxyTypeCRD ProxyType = "crd" DNSProxyName = "cilium-dns-egress" )
type RedirectImplementation ¶ added in v1.5.0
type RedirectImplementation interface { // UpdateRules updates the rules for the given proxy redirect. // The implementation should .Add to the WaitGroup if the update is // asynchronous and the update should not return until it is complete. // The returned RevertFunc must be non-nil. // Note: UpdateRules is not called when a redirect is created. UpdateRules(wg *completion.WaitGroup) (revert.RevertFunc, error) // Close closes and cleans up resources associated with the redirect // implementation. The implementation should .Add to the WaitGroup if the // update is asynchronous and the update should not return until it is // complete. Close(wg *completion.WaitGroup) (revert.FinalizeFunc, revert.RevertFunc) }
RedirectImplementation is the generic proxy redirect interface that each proxy redirect type must implement