vcl

package
v0.0.0-...-a08b10d Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: BSD-2-Clause Imports: 18 Imported by: 0

README

GoDoc

Documentation

Overview

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). It drives the templating that generates VCL source code.

Index

Constants

View Source
const (
	// RecvHash to invoke cache lookup.
	RecvHash RecvReturn = "hash"
	// RecvPass to bypass cache lookup.
	RecvPass = "pass"
	// RecvPipe for pipe mode -- Varnish passes data between
	// client and backend with no further intervention.
	RecvPipe = "pipe"
	// RecvPurge to purge a cache object.
	// See: https://varnish-cache.org/docs/6.3/users-guide/purging.html?highlight=purge#http-purging
	RecvPurge = "purge"
	// RecvSynth to generate a synthetic response with a given
	// HTTP response status.
	RecvSynth = "synth"
	// RecvFail to invoke VCL failure.
	RecvFail = "fail"
	// RecvRestart to invoke request restart.
	RecvRestart = "restart"
)
View Source
const IngressPrefix = "vk8s_ing_"

IngressPrefix is the prefix of VCLs loaded

View Source
const NoMaskBits uint8 = 255

NoMaskBits is a sentinel value for ACLAddress.MaskBits indicating that a CIDR range is not to be used.

Variables

This section is empty.

Functions

func ResetACLTmpl

func ResetACLTmpl()

ResetACLTmpl sets the VCL template for the VarnishConfig acl feature to its current "official" value. Invoked on TemplateConfig deletion, only needed when devmode is activated for the controller.

func ResetAuthTmpl

func ResetAuthTmpl()

ResetAuthTmpl sets the VCL template for the VarnishConfig auth feature to its current "official" value. Invoked on TemplateConfig deletion, only needed when devmode is activated for the controller.

func ResetIngressTmpl

func ResetIngressTmpl()

ResetIngressTmpl sets the VCL template for Ingress implementation (routing rules and bakend configuration) to its current "official" value. Invoked on TemplateConfig deletion, only needed when devmode is activated for the controller.

func ResetReqDispTmpl

func ResetReqDispTmpl()

ResetReqDispTmpl sets the VCL template for the VarnishConfig reqDisp feature to its current "official" value. Invoked on TemplateConfig deletion, only needed when devmode is activated for the controller.

func ResetRewriteTmpl

func ResetRewriteTmpl()

ResetRewriteTmpl sets the VCL template for the VarnishConfig rewrite feature to its current "official" value. Invoked on TemplateConfig deletion, only needed when devmode is activated for the controller.

func ResetShardTmpl

func ResetShardTmpl()

ResetShardTmpl sets the VCL template for the VarnishConfig shard feature to its current "official" value. Invoked on TemplateConfig deletion, only needed when devmode is activated for the controller.

func SetACLTmpl

func SetACLTmpl(src string) error

SetACLTmpl parses src as a text/template, using the FuncMap defined for the ACL template, which is used to generate VCL for the VarnishConfig acl feature. On success, the ACL template is replaced. If the parse fails, then the error is returned and the ACL template is unchanged.

Only used when devmode is activated for the controller.

func SetAuthTmpl

func SetAuthTmpl(src string) error

SetAuthTmpl parses src as a text/template, using the FuncMap defined for the auth template, which is used to generate VCL for the VarnishConfig auth feature. On success, the auth template is replaced. If the parse fails, then the error is returned and the auth template is unchanged.

Only used when devmode is activated for the controller.

func SetIngressTmpl

func SetIngressTmpl(src string) error

SetIngressTmpl parses src as a text/template, using the FuncMap defined for the ingress template, which is used to generate VCL for Ingress implementaion -- routing rules and backend configuration, including configuration set for the BackendConfig custom resource. On success, the ingress template is replaced. If the parse fails, then the error is returned and the shard template is unchanged.

Only used when devmode is activated for the controller.

func SetReqDispTmpl

func SetReqDispTmpl(src string) error

SetReqDispTmpl parses src as a text/template, using the FuncMap defined for the reqDisp template, which is used to generate VCL for the VarnishConfig reqDisp feature. On success, the reqDisp template is replaced. If the parse fails, then the error is returned and the reqDisp template is unchanged.

Only used when devmode is activated for the controller.

func SetRewriteTmpl

func SetRewriteTmpl(src string) error

SetRewriteTmpl parses src as a text/template, using the FuncMap defined for the rewrite template, which is used to generate VCL for the VarnishConfig rewrite feature. On success, the rewrite template is replaced. If the parse fails, then the error is returned and the rewrite template is unchanged.

Only used when devmode is activated for the controller.

func SetShardTmpl

func SetShardTmpl(src string) error

SetShardTmpl parses src as a text/template, using the FuncMap defined for the shard template, which is used to generate VCL for the VarnishConfig shard feature. On success, the shard template is replaced. If the parse fails, then the error is returned and the shard template is unchanged.

Only used when devmode is activated for the controller.

Types

type ACL

type ACL struct {
	Name       string
	Comparand  string
	FailStatus uint16
	Whitelist  bool
	Addresses  ACLAddresses
	Conditions []MatchTerm
	ResultHdr  ResultHdrType
}

ACL represents an Access Control List, derived from a VarnishConfig. +k8s:deepcopy-gen=true

func (*ACL) DeepCopy

func (in *ACL) DeepCopy() *ACL

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACL.

func (*ACL) DeepCopyInto

func (in *ACL) DeepCopyInto(out *ACL)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ACLAddress

type ACLAddress struct {
	Addr     string
	MaskBits uint8
	Negate   bool
}

ACLAddress represents an element in an ACL -- a host name to be resolved at VCL load, an IP address, or address range in CIDR notation. Use the '!' for negation when Negate is true. +k8s:deepcopy-gen=true

func (*ACLAddress) DeepCopy

func (in *ACLAddress) DeepCopy() *ACLAddress

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ACLAddress.

func (*ACLAddress) DeepCopyInto

func (in *ACLAddress) DeepCopyInto(out *ACLAddress)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ACLAddresses

type ACLAddresses []ACLAddress

ACLAddresses are partially unordered (while Negate is unchanged) this is not a complete normalization, see (+fold) in VCL

type ACLs

type ACLs []ACL

ACLs are unordered, because they are referenced by name

type Address

type Address struct {
	PodNamespace string
	PodName      string
	IP           string
	Port         int32
}

Address represents an endpoint for either a backend instance (Endpoint of a Service to which requests are routed) or a Varnish instance (where the port is the admin port). +k8s:deepcopy-gen=true

func (Address) Address

func (addr Address) Address() string

Address returns the network address represented by addr as "<IP>:<Port>"

func (*Address) DeepCopy

func (in *Address) DeepCopy() *Address

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Address.

func (*Address) DeepCopyInto

func (in *Address) DeepCopyInto(out *Address)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Address) String

func (addr Address) String() string

type Addresses

type Addresses []Address

Addresses are unordered == sortable

type AnchorType

type AnchorType uint8

AnchorType classifies start-of-string and/or end-of-string anchoring for a regex match.

const (
	// None indicates no anchoring.
	None AnchorType = iota
	// Start indicates anchoring at start-of-string.
	Start
	// Both indicates anchoring at start- and end-of-string.
	Both
)

type Auth

type Auth struct {
	Conditions  []MatchTerm
	Credentials []string
	Realm       string
	Status      AuthStatus
	UTF8        bool
}

Auth specifies Basic or Proxy Authentication, derived from an AuthSpec in a VarnishConfig resource. +k8s:deepcopy-gen=true

func (*Auth) DeepCopy

func (in *Auth) DeepCopy() *Auth

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Auth.

func (*Auth) DeepCopyInto

func (in *Auth) DeepCopyInto(out *Auth)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AuthStatus

type AuthStatus uint16

AuthStatus is the response code to be sent for authentication failures, and serves to distinguish the protocols.

const (
	// Basic Authentication
	Basic AuthStatus = 401
	// Proxy Authentication
	Proxy = 407
)

type Auths

type Auths []Auth

Auths are references by real, so unordered == sortable

type CompareType

type CompareType uint8

CompareType classifies comparison operations performed for conditional configurations. The comparison may be negated if the boolean Negate field is true.

const (
	// Equal specifies equality -- string equality, numeric
	// equality, or membership in a set of fixed strings.
	Equal CompareType = iota
	// Match specifies a regular expression match.
	Match
	// Prefix specifies that a string has a prefix in a set of
	// fixed strings.
	Prefix
	// Exists specifies that a request header exists.
	Exists
	// Greater specifies the > relation between a VCL variable
	// with a numeric value and a constant.
	Greater
	// GreaterEqual specifies the >= relation for a numeric VCL
	// variable and a constant.
	GreaterEqual
	// Less specifies the < relation for a numeric VCL variable
	// and a constant.
	Less
	// LessEqual specifies the <= relation for a numeric VCL
	// variable and a constant.
	LessEqual
)

type Condition

type Condition struct {
	Values     []string
	MatchFlags MatchFlagsType
	Count      *uint
	Comparand  string
	Compare    CompareType
	Negate     bool
}

Condition specifies (one of) the conditions that must be true if a client request disposition is to be executed. +k8s:deepcopy-gen=true

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Director

type Director struct {
	Rampup     string
	Warmup     float64
	Type       DirectorType
	ShardParam string
}

Director is derived from spec.director in a BackendConfig, and allows for some choice of the director, and sets some parameters. +k8s:deepcopy-gen=true

func (*Director) DeepCopy

func (in *Director) DeepCopy() *Director

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Director.

func (*Director) DeepCopyInto

func (in *Director) DeepCopyInto(out *Director)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DirectorType

type DirectorType uint8

DirectorType corresponds to a class of director, see: https://varnish-cache.org/docs/6.3/reference/vmod_directors.generated.html

const (
	// RoundRobin director
	RoundRobin DirectorType = iota
	// Random director
	Random
	// Shard director
	Shard
)

func GetDirectorType

func GetDirectorType(dirStr string) DirectorType

GetDirectorType returns a DirectorType constant for the string (enum value) used in YAML.

func (DirectorType) String

func (dirType DirectorType) String() string

type DispositionSpec

type DispositionSpec struct {
	Conditions  []Condition
	Disposition DispositionType
}

DispositionSpec specifies the disposition of a client request when all of the Conditions are met. +k8s:deepcopy-gen=true

func (*DispositionSpec) DeepCopy

func (in *DispositionSpec) DeepCopy() *DispositionSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DispositionSpec.

func (*DispositionSpec) DeepCopyInto

func (in *DispositionSpec) DeepCopyInto(out *DispositionSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DispositionType

type DispositionType struct {
	Action RecvReturn
	Status uint16
	Reason string
}

DispositionType specifies the disposition of a client request when associated Conditions are met.

Status is the HTTP response status to set when Action is RecvSynth; ignored for other values of Action. +k8s:deepcopy-gen=true

func (*DispositionType) DeepCopy

func (in *DispositionType) DeepCopy() *DispositionType

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DispositionType.

func (*DispositionType) DeepCopyInto

func (in *DispositionType) DeepCopyInto(out *DispositionType)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HashAlgo

type HashAlgo uint8

HashAlgo identifies digest algorithms.

const (
	// Crc32 checksum
	Crc32 HashAlgo = iota
	// ICrc32 CRC32 with inverted initialization and result
	ICrc32
	// MD5 message digest
	MD5
	// RS Sedgewick's hash
	RS
	// Sha1 secure hash
	Sha1
	// Sha224 secure hash
	Sha224
	// Sha384 secure hash
	Sha384
	// Sha512 secure hash
	Sha512
	// Sha3_224 secure hash
	Sha3_224
	// Sha3_256 secure hash
	Sha3_256
	// Sha3_512 secure hash
	Sha3_512
)

func (HashAlgo) String

func (algo HashAlgo) String() string

type KeyBy

type KeyBy uint8

KeyBy classifies the shard key method

const (
	// ByHash is the default (shard director by=HASH)
	ByHash KeyBy = iota
	// URL by=URL
	URL
	// Key by=KEY
	Key
	// Blob by=BLOB
	Blob
	// Cookie by=KEY with a cookie value
	Cookie
)

type MatchFlagsType

type MatchFlagsType struct {
	MaxMem        uint64
	Anchor        AnchorType
	UTF8          bool
	PosixSyntax   bool
	LongestMatch  bool
	Literal       bool
	NeverCapture  bool
	CaseSensitive bool
	PerlClasses   bool
	WordBoundary  bool
}

MatchFlagsType is a collection of options that modify matching operations. CaseSensitive can be applied to both fixed string matches and regex matches; the remainder are for regex matches only. These correspond to flags for RE2 matching, and are used by the RE2 VMOD.

See: https://code.uplex.de/uplex-varnish/libvmod-re2 +k8s:deepcopy-gen=true

func (*MatchFlagsType) DeepCopy

func (in *MatchFlagsType) DeepCopy() *MatchFlagsType

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchFlagsType.

func (*MatchFlagsType) DeepCopyInto

func (in *MatchFlagsType) DeepCopyInto(out *MatchFlagsType)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MatchTerm

type MatchTerm struct {
	Comparand string
	Value     string
	Compare   CompareType
	Negate    bool
}

MatchTerm is a term describing the comparison of a VCL object with a pattern. +k8s:deepcopy-gen=true

func (*MatchTerm) DeepCopy

func (in *MatchTerm) DeepCopy() *MatchTerm

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchTerm.

func (*MatchTerm) DeepCopyInto

func (in *MatchTerm) DeepCopyInto(out *MatchTerm)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MethodType

type MethodType uint8

MethodType classifies the process by which a rewrite modifies the Target object.

const (
	// Replace means that the target is overwritten with a new
	// value.
	Replace MethodType = iota
	// Sub means that the first matching substring of the target
	// after a regex match is substituted with the new value.
	Sub
	// Suball means that each non-overlapping matching substring
	// of the target is substituted.
	Suball
	// RewriteMethod means that the target is rewritten with the
	// rule in the Rewrite field, possibly with backreferences.
	RewriteMethod
	// Append means that a string is concatenated after the source
	// string, with the result written to the target.
	Append
	// Prepend means that a string is concatenated after the
	// source string.
	Prepend
	// Delete means that the target object is deleted.
	Delete
)

type NameTTLFrom

type NameTTLFrom uint8

NameTTLFrom is a enumeration of the ways that the name TTL that was specified in the BackendConfig can be evaluated with respect to DNS TTL. This value is mapped directly to the ttl_from parameter for VMOD dynamic.

const (
	// FromCfg corresponds to the enum value cfg in VMOD dynamic.
	FromCfg NameTTLFrom = iota
	// FromDNS corresponds to enum dns in VMOD dynamic
	FromDNS
	// FromMin corresponds to enum min in VMOD dynamic.
	FromMin
	// FromMax corresponds to enum max in VMOD dynamic.
	FromMax
)

func (NameTTLFrom) String

func (from NameTTLFrom) String() string

type NameTTLSpec

type NameTTLSpec struct {
	TTL  string
	From NameTTLFrom
}

NameTTLSpec encapsulates the TTL configuration used for VMOD dynamic. Its fields are mapped directly to the ttl and ttl_from paramater of the VMOD. +k8s:deepcopy-gen=true

func (*NameTTLSpec) DeepCopy

func (in *NameTTLSpec) DeepCopy() *NameTTLSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NameTTLSpec.

func (*NameTTLSpec) DeepCopyInto

func (in *NameTTLSpec) DeepCopyInto(out *NameTTLSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PathKey

type PathKey struct {
	Path string
	Type PathType
}

PathKey is a two-dimensional map key to map from paths and types to Services, derived from the paths field of an Ingress rule.

This is because it is possible in principle to have the same path with more than one pathType in an Ingress rule. +k8s:deepcopy-gen=true

func (*PathKey) DeepCopy

func (in *PathKey) DeepCopy() *PathKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PathKey.

func (*PathKey) DeepCopyInto

func (in *PathKey) DeepCopyInto(out *PathKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PathType

type PathType uint8

PathType is the classifier corresponding to the Ingress pathType field.

const (
	// PathExact corresponds to Ingress pathType: Exact
	PathExact PathType = iota
	// PathPrefix corresponds to Ingress pathType: Prefix
	PathPrefix
	// PathImplSpecific corresponds to Ingress
	// pathType: ImplementationSpecfic
	PathImplSpecific
)

type Probe

type Probe struct {
	URL         string
	Request     []string
	ExpResponse uint16
	Timeout     string
	Interval    string
	Initial     string
	Window      string
	Threshold   string
}

Probe represents the configuration of health probes derived from a VarnishConfig or BackendConfig Custom Resource. +k8s:deepcopy-gen=true

func (*Probe) DeepCopy

func (in *Probe) DeepCopy() *Probe

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Probe.

func (*Probe) DeepCopyInto

func (in *Probe) DeepCopyInto(out *Probe)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RecvReturn

type RecvReturn string

RecvReturn is a name for the disposition of a client request. See: https://varnish-cache.org/docs/6.3/reference/states.html

type ResultHdrType

type ResultHdrType struct {
	Header  string
	Success string
	Failure string
}

ResultHdrType describes the configuration for writing a header as the result of an ACL comparison. Header is the header to write in VCL notation. Failure is the value to write on the fail condition, Success the value to write otherwise. +k8s:deepcopy-gen=true

func (*ResultHdrType) DeepCopy

func (in *ResultHdrType) DeepCopy() *ResultHdrType

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResultHdrType.

func (*ResultHdrType) DeepCopyInto

func (in *ResultHdrType) DeepCopyInto(out *ResultHdrType)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Rewrite

type Rewrite struct {
	Rules      []RewriteRule
	MatchFlags MatchFlagsType
	Target     string
	Source     string
	Method     MethodType
	Compare    CompareType
	Negate     bool
	VCLSub     SubType
	Select     SelectType
}

Rewrite is the specification for a set of rewrite rules; elements of the Rewrites array of a VCL Spec have this type.

Target is the object to be rewritten, in VCL notation. It can be the client or backend URL path, or a client or backend request or response header.

Source is the object against which comparisons are applied, and from which substrings may be extracted. It may have the same values as Target. +k8s:deepcopy-gen=true

func (*Rewrite) DeepCopy

func (in *Rewrite) DeepCopy() *Rewrite

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rewrite.

func (*Rewrite) DeepCopyInto

func (in *Rewrite) DeepCopyInto(out *Rewrite)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RewriteRule

type RewriteRule struct {
	Value   string
	Rewrite string
}

RewriteRule describes conditions under which a rewrite is executed, and strings to be used for the rewrite. Elements of the Rules array for a Rewrite have this type.

Value is a string or pattern against which the Source object is compared. If Values is a regular expression, it has the syntax and semantics of RE2 (https://github.com/google/re2/wiki/Syntax).

Rewrite is a string to be used for the rewrite if the Value compares successfully. Depending on the RewriteSpec's Method, Rewrite may contain backreferences captured from a regex match. +k8s:deepcopy-gen=true

func (*RewriteRule) DeepCopy

func (in *RewriteRule) DeepCopy() *RewriteRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RewriteRule.

func (*RewriteRule) DeepCopyInto

func (in *RewriteRule) DeepCopyInto(out *RewriteRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Rule

type Rule struct {
	Host    string
	PathMap map[PathKey]Service
}

Rule represents an IngressRule: a Host name (possibly empty) and a map from URL paths to Services. +k8s:deepcopy-gen=true

func (*Rule) DeepCopy

func (in *Rule) DeepCopy() *Rule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule.

func (*Rule) DeepCopyInto

func (in *Rule) DeepCopyInto(out *Rule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Rules

type Rules []Rule

Rules are semi unordered, because hosts need to be distinct the exceptions are - the empty host, which is always last - wildcard, which comes after non-wildcard

to keep things simple, we sort by length descending and then put * last

type SealedSpec

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

SealedSpec must not be modified

func (*SealedSpec) ConfigName

func (sealed *SealedSpec) ConfigName() string

ConfigName returns the name to be used for VCLs with this config

func (*SealedSpec) ExtSvcs

func (sealed *SealedSpec) ExtSvcs() map[string]Service

ExtSvcs is from the sealed spec

func (*SealedSpec) GetSrc

func (sealed *SealedSpec) GetSrc() (string, error)

GetSrc returns the VCL text

func (*SealedSpec) Hash

func (sealed *SealedSpec) Hash() string

Hash returns the sealed config's hash

func (*SealedSpec) IntSvcs

func (sealed *SealedSpec) IntSvcs() map[string]Service

IntSvcs is from the sealed spec

type SelectType

type SelectType uint8

SelectType classifies the determination of the rewrite rule to apply if more than one of them in the Rules array compares successfully. This is only possible when the Method specifies a regex or prefix match.

The values Unique, First or Last may be used for both regex and prefix matches; the others may only be used for prefix matches.

const (
	// Unique means that only one rewrite rule may match,
	// otherwise VCL failure is invoked.
	Unique SelectType = iota
	// First means that the first matching rule in the order of
	// the Rules array is executed.
	// Last means that the last matching rule is executed.
	First
	// Last means that the last matching rule is executed.
	Last
	// Exact means that, for a prefix match, the rule by which the
	// full string matched exactly is executed.
	Exact
	// Longest means that the rule for the longest prefix that
	// matched is executed.
	Longest
	// Shortest means that the rule for the shortest prefix that
	// matched is executed.
	Shortest
)

func (SelectType) String

func (s SelectType) String() string

The String method returns the upper-case name of the enum used for VMOD re2.

type Service

type Service struct {
	Name                string
	Addresses           Addresses
	Probe               *Probe
	Director            *Director
	NameTTL             *NameTTLSpec
	Authority           *string
	ExternalName        string
	ExternalPort        string
	HostHeader          string
	ConnectTimeout      string
	FirstByteTimeout    string
	BetweenBytesTimeout string
	DNSRetryDelay       string
	DomainUsageTimeout  string
	FirstLookupTimeout  string
	ResolverIdleTimeout string
	ResolverTimeout     string
	MaxConnections      uint32
	MaxDNSQueries       uint16
	ProxyHeader         uint8
	FollowDNSRedirects  bool
	Via                 bool
}

Service represents either a backend Service (Endpoints to which requests are routed) or a Varnish Service (with addresses for the admin ports). +k8s:deepcopy-gen=true

func (*Service) DeepCopy

func (in *Service) DeepCopy() *Service

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Service.

func (*Service) DeepCopyInto

func (in *Service) DeepCopyInto(out *Service)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Services

type Services []Service

Services are unordered

type ShardCluster

type ShardCluster struct {
	Nodes           Services
	Rules           []ShardRule
	Probe           *Probe
	MaxSecondaryTTL string
}

ShardCluster represents the configuration for self-sharding derived from the VarnishConfig Custom Resource. +k8s:deepcopy-gen=true

func (*ShardCluster) DeepCopy

func (in *ShardCluster) DeepCopy() *ShardCluster

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShardCluster.

func (*ShardCluster) DeepCopyInto

func (in *ShardCluster) DeepCopyInto(out *ShardCluster)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ShardRule

type ShardRule struct {
	Conditions  []Condition
	DefaultKey  string
	Key         string
	By          KeyBy
	Algo        HashAlgo
	PrimaryOnly bool
}

ShardRule represents a sharding configuration, and optional conditions under which the configuration holds. +k8s:deepcopy-gen=true

func (*ShardRule) DeepCopy

func (in *ShardRule) DeepCopy() *ShardRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShardRule.

func (*ShardRule) DeepCopyInto

func (in *ShardRule) DeepCopyInto(out *ShardRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Spec

type Spec struct {
	// DefaultService corresponds to the default IngressBackend in
	// an Ingress, if present.
	DefaultService Service
	// Rules corresponds to the IngressRules in an Ingress.
	Rules Rules
	// IntSvcs is a map of Service names to Service configurations
	// for in-cluster IngressBackends mentioned in an Ingress. May
	// include the default Backend.
	IntSvcs map[string]Service
	// ExtSvcs is a map of Service names to ExternalName Service
	// configurations that are IngressBackends mentioned in an
	// Ingress.
	ExtSvcs map[string]Service
	// ShardCluster is derived from the self-sharding
	// specification in a VarnishConfig resource.
	ShardCluster ShardCluster
	// Auths is a list of specifications for Basic or Proxy
	// Authentication, derived from the Auth section of a
	// VarnishConfig.
	Auths Auths
	// VCL is custom VCL, derived from VarnishConfig.Spec.VCL.
	VCL string
	// ACLs is a list of specifications for whitelisting or
	// blacklisting IPs with access control lists, derived from
	// VarnishConfig.Spec.ACLs.
	ACLs ACLs
	// Rewrites is a list of specifications for header and URL
	// rewriting, derived from VarnishConfig.Spec.Rewrites.
	Rewrites []Rewrite
	// Dispositions is a list of specifications for the
	// disposition of client requests, derived from
	// VarnishConfig.Spec.ReqDispositions.
	Dispositions []DispositionSpec
}

Spec is the specification for a VCL configuration derived from Ingresses and VarnishConfig Custom Resources. This abstracts the VCL to be loaded by all instances of a Varnish Service. +k8s:deepcopy-gen=true

func (Spec) Canonical

func (spec Spec) Canonical() Spec

Canonical returns a Canonicalize copy

func (Spec) Canonicalize

func (spec Spec) Canonicalize()

Canonicalize creates a canonical form of a Spec, in which all fields where the order does not matter are ordered. This ensures that reflect.DeepEqual and DeepHash return values consistent with the equivalence of two Specs.

func (*Spec) DeepCopy

func (in *Spec) DeepCopy() *Spec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Spec.

func (*Spec) DeepCopyInto

func (in *Spec) DeepCopyInto(out *Spec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Spec) DeepHash

func (spec Spec) DeepHash() string

DeepHash computes a alphanumerically encoded hash value from a Spec such that, almost certainly, two Specs are deeply equal iff their hash values are equal (unless we've discovered a SHA512 collision).

func (Spec) GetSrc

func (spec Spec) GetSrc() (string, error)

GetSrc returns the VCL generated to implement a Spec.

func (*Spec) Seal

func (spec *Spec) Seal() *SealedSpec

Seal seturns a sealed Spec (canonicaliyed and hash calculated)

type SubType

type SubType uint8

SubType classifies the VCL subroutine in which a rewrite is executed.

const (
	// Unspecified means that the VCL sub was not specified in the
	// user configuration, and will be inferred from the Source
	// and Target.
	Unspecified SubType = iota
	// Recv for vcl_recv
	Recv
	// Pipe for vcl_pipe
	Pipe
	// Pass for vcl_pass
	Pass
	// Hash for vcl_hash
	Hash
	// Purge for vcl_purge
	Purge
	// Miss for vcl_miss
	Miss
	// Hit for vcl_hit
	Hit
	// Deliver for vcl_deliver
	Deliver
	// Synth for vcl_synth
	Synth
	// BackendFetch for vcl_backend_fetch
	BackendFetch
	// BackendResponse for vcl_backend_response
	BackendResponse
	// BackendError for vcl_backend_error
	BackendError
)

Jump to

Keyboard shortcuts

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