Documentation
¶
Overview ¶
Package varnish encapsulates interaction with Varnish instances to transform desired states from Ingress and VarnishConfig configs to the actual state of the cluster. Only this package imports varnishapi/pkg/admin to interact with the CLI of each Varnish instance.
Package varnish instance handler abstraction ¶
Package varnish encapsulates interaction with Varnish instances to transform desired states from Ingress and VarnishConfig configs to the actual state of the cluster. Only this package imports varnishapi/pkg/admin to interact with the CLI of each Varnish instance.
Index ¶
- type AdmError
- type AdmErrors
- type Controller
- func (vc *Controller) AddOrUpdateVarnishSvc(key string, addrs []vcl.Address, secrName string, loadVCL bool) update.Status
- func (vc *Controller) DeleteAdmSecret(name string)
- func (vc *Controller) DeleteVarnishSvc(key string) update.Status
- func (vc *Controller) EvtGenerator(svcEvt interfaces.SvcEventGenerator)
- func (vc *Controller) HasConfig(svcName string, addrs []vcl.Address, nextSpec *vcl.SealedSpec) bool
- func (vc *Controller) HasVarnishSvc(svcName string) bool
- func (vc *Controller) Quit()
- func (vc *Controller) SetAdmSecret(key string, secret []byte)
- func (vc *Controller) SetNotReady(svcName string) error
- func (vc *Controller) Start()
- func (vc *Controller) Update(svcName string, sealed *vcl.SealedSpec, addrs []vcl.Address, secrName string) update.Status
- func (vc *Controller) UpdateSvcForSecret(svcName, secretName string) update.Status
- type Handler
- type HandlerFactory
- type Meta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdmError ¶
type AdmError struct {
// contains filtered or unexported fields
}
AdmError encapsulates an error encountered for an individual Varnish instance, and satisfies the Error interface.
type AdmErrors ¶
type AdmErrors []AdmError
AdmErrors is a collection of errors encountered at Varnish instances. Most attempts to sync the state of Varnish instances do not break off at the first error; the attempt is repeated for each instance in a cluster, collecting error information along the way. This object contains error information for each instance in a cluster that failed to sync. The type satisifies the Error interface.
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller encapsulates information about each Varnish cluster deployed as Ingress implementations in the cluster, and their current states.
func NewController ¶
func NewController( log *logrus.Logger, monIntvl time.Duration, newVarnishInst HandlerFactory, ) *Controller
NewController returns an instance of Controller.
log: logger object initialized at startup
func (*Controller) AddOrUpdateVarnishSvc ¶
func (vc *Controller) AddOrUpdateVarnishSvc( key string, addrs []vcl.Address, secrName string, loadVCL bool, ) update.Status
AddOrUpdateVarnishSvc causes a sync for the Varnish Service identified by namespace/name key.
addrs: list of admin addresses for instances in the Service
(internal IPs and admin ports)
secrName: namespace/name of the admin secret to use for the
Service
loadVCL: true if the VCL config for the Service should be
reloaded
func (*Controller) DeleteAdmSecret ¶
func (vc *Controller) DeleteAdmSecret(name string)
DeleteAdmSecret removes the secret identified by the namespace/name key.
func (*Controller) DeleteVarnishSvc ¶
func (vc *Controller) DeleteVarnishSvc(key string) update.Status
DeleteVarnishSvc is called on the Delete event for the Varnish Service identified by the namespace/name key. The Varnish instance is set to the unready state, and no further action is taken (other resources in the cluster may shut down the Varnish instances).
func (*Controller) EvtGenerator ¶
func (vc *Controller) EvtGenerator(svcEvt interfaces.SvcEventGenerator)
EvtGenerator sets the object that implements interface SvcEventGenerator, and will be used by the monitor goroutine to generate Events for Varnish Services.
func (*Controller) HasConfig ¶
func (vc *Controller) HasConfig(svcName string, addrs []vcl.Address, nextSpec *vcl.SealedSpec, ) bool
HasConfig returns true iff a configuration is already loaded for a Varnish Service (so a new sync attempt is not necessary).
svcName: namespace/name key for the Varnish Service spec: VCL specification derived from the configuration
func (*Controller) HasVarnishSvc ¶
func (vc *Controller) HasVarnishSvc(svcName string) bool
HasVarnishSvc returns true iff the configuration of the service identified by svcName has been specified for the Varnish controller.
func (*Controller) SetAdmSecret ¶
func (vc *Controller) SetAdmSecret(key string, secret []byte)
SetAdmSecret stores the Secret data identified by the namespace/name key.
func (*Controller) SetNotReady ¶
func (vc *Controller) SetNotReady(svcName string) error
SetNotReady may be called on the Delete event on an Ingress, if no Ingresses remain that are to be implemented by a Varnish Service. The Service is set to the not configured state, by relabelling VCL so that the "configured" endpoint is not answered with status 200. Also set the "regular" label to the "not available" config.
func (*Controller) Start ¶
func (vc *Controller) Start()
Start initiates the Varnish controller and starts the monitor goroutines.
func (*Controller) Update ¶
func (vc *Controller) Update( svcName string, sealed *vcl.SealedSpec, addrs []vcl.Address, secrName string, ) update.Status
Update a Varnish Service to implement an configuration.
svcName: namespace/name key for the Service spec: VCL spec corresponding to the configuration addrs: addresses of the Varnish service instances
func (*Controller) UpdateSvcForSecret ¶
func (vc *Controller) UpdateSvcForSecret( svcName, secretName string, ) update.Status
UpdateSvcForSecret associates the Secret identified by the namespace/name secretKey with the Varnish Service identified by the namespace/name svcName.
type Handler ¶
type Handler interface {
String() string
Addr() string
SetCfgLabel(vc *Controller, cfg, lbl string, mayClose bool) error
CheckInst(vc *Controller, svcName string) bool
UpdateVarnishInstance(vc *Controller, cfgName string, vclSrc string, metrics *varnishmetrics.InstanceMetrics) error
}
Handler Interface to enable mocking
type HandlerFactory ¶
HandlerFactory also to be implemented by Mocker
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mockvarnish is a generated GoMock package.
|
Package mockvarnish is a generated GoMock package. |
|
Package vcl encapsulates representations of a VCL configuration derived from Ingress and VarnishConfig specifications, and checking the representations for equivalence (to check if new syncs are necessary).
|
Package vcl encapsulates representations of a VCL configuration derived from Ingress and VarnishConfig specifications, and checking the representations for equivalence (to check if new syncs are necessary). |