Documentation
¶
Index ¶
- type BackendGroup
- type BackendRef
- type ChangeProcessor
- type ChangeProcessorConfig
- type ChangeProcessorImpl
- type Configuration
- type FileManager
- type Filters
- type GatewayClassStatus
- type GatewayStatus
- type HTTPRouteStatus
- type HTTPRouteStatuses
- type IgnoredGatewayStatus
- type IgnoredGatewayStatuses
- type ListenerStatus
- type ListenerStatuses
- type MatchRule
- type ParentStatus
- type ParentStatuses
- type PathRule
- type SSL
- type Secret
- type SecretDiskMemoryManager
- type SecretDiskMemoryManagerImpl
- type SecretDiskMemoryManagerOption
- type SecretStore
- type SecretStoreImpl
- type Statuses
- type Upstream
- type VirtualServer
- type Warnings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendGroup ¶ added in v0.2.0
type BackendGroup struct { Errors []string Source types.NamespacedName RuleIdx int Backends []BackendRef }
BackendGroup represents a group of backends for a rule in an HTTPRoute.
func (*BackendGroup) GroupName ¶ added in v0.2.0
func (bg *BackendGroup) GroupName() string
GroupName returns the name of the backend group. This name must be unique across all HTTPRoutes and all rules within the same HTTPRoute. The RuleIdx is used to make the name unique across all rules within the same HTTPRoute. The RuleIdx may change for a given rule if an update is made to the HTTPRoute, but it will always match the index of the rule in the stored HTTPRoute.
type BackendRef ¶ added in v0.2.0
BackendRef is an internal representation of a backendRef in an HTTPRoute.
type ChangeProcessor ¶
type ChangeProcessor interface { // CaptureUpsertChange captures an upsert change to a resource. // It panics if the resource is of unsupported type or if the passed Gateway is different from the one this // ChangeProcessor was created for. CaptureUpsertChange(obj client.Object) // CaptureDeleteChange captures a delete change to a resource. // The method panics if the resource is of unsupported type or if the passed Gateway is different from the one // this ChangeProcessor was created for. CaptureDeleteChange(resourceType client.Object, nsname types.NamespacedName) // Process processes any captured changes and produces an internal representation of the Gateway configuration and // the status information about the processed resources. // If no changes were captured, the changed return argument will be false and both the configuration and statuses // will be empty. Process(ctx context.Context) (changed bool, conf Configuration, statuses Statuses) }
ChangeProcessor processes the changes to resources producing the internal representation of the Gateway configuration. ChangeProcessor only supports one GatewayClass resource.
type ChangeProcessorConfig ¶
type ChangeProcessorConfig struct { // GatewayCtlrName is the name of the Gateway controller. GatewayCtlrName string // GatewayClassName is the name of the GatewayClass resource. GatewayClassName string // SecretMemoryManager is the secret memory manager. SecretMemoryManager SecretDiskMemoryManager // ServiceResolver resolves Services to Endpoints. ServiceResolver resolver.ServiceResolver // RelationshipCapturer captures relationships between Kubernetes API resources and Gateway API resources. RelationshipCapturer relationship.Capturer // Logger is the logger for this Change Processor. Logger logr.Logger }
ChangeProcessorConfig holds configuration parameters for ChangeProcessorImpl.
type ChangeProcessorImpl ¶
type ChangeProcessorImpl struct {
// contains filtered or unexported fields
}
ChangeProcessorImpl is an implementation of ChangeProcessor.
func NewChangeProcessorImpl ¶
func NewChangeProcessorImpl(cfg ChangeProcessorConfig) *ChangeProcessorImpl
NewChangeProcessorImpl creates a new ChangeProcessorImpl for the Gateway resource with the configured namespace name.
func (*ChangeProcessorImpl) CaptureDeleteChange ¶
func (c *ChangeProcessorImpl) CaptureDeleteChange(resourceType client.Object, nsname types.NamespacedName)
func (*ChangeProcessorImpl) CaptureUpsertChange ¶
func (c *ChangeProcessorImpl) CaptureUpsertChange(obj client.Object)
func (*ChangeProcessorImpl) Process ¶
func (c *ChangeProcessorImpl) Process(ctx context.Context) (changed bool, conf Configuration, statuses Statuses)
type Configuration ¶
type Configuration struct { // HTTPServers holds all HTTPServers. // FIXME(pleshakov) We assume that all servers are HTTP and listen on port 80. HTTPServers []VirtualServer // SSLServers holds all SSLServers. // FIXME(kate-osborn) We assume that all SSL servers listen on port 443. SSLServers []VirtualServer // Upstreams holds all unique Upstreams. Upstreams []Upstream // BackendGroups holds all unique BackendGroups. BackendGroups []BackendGroup }
Configuration is an internal representation of Gateway configuration. We can think of Configuration as an intermediate state between the Gateway API resources and the data plane (NGINX) configuration.
type FileManager ¶
type FileManager interface { // ReadDir returns the directory entries for the directory. ReadDir(dirname string) ([]fs.DirEntry, error) // Remove file with given name. Remove(name string) error // Create file at the provided filepath. Create(name string) (*os.File, error) // Chmod sets the mode of the file. Chmod(file *os.File, mode os.FileMode) error // Write writes contents to the file. Write(file *os.File, contents []byte) error }
FileManager is an interface that exposes File I/O operations. Used for unit testing.
type Filters ¶ added in v0.2.0
type Filters struct {
RequestRedirect *v1beta1.HTTPRequestRedirectFilter
}
Filters hold the filters for a MatchRule.
type GatewayClassStatus ¶
type GatewayClassStatus struct { // Valid shows if the resource is valid. Valid bool // ErrorMsg describe the error when the resource is invalid. ErrorMsg string // ObservedGeneration is the generation of the resource that was processed. ObservedGeneration int64 }
GatewayClassStatus holds status-related infortmation about the GatewayClass resource.
type GatewayStatus ¶
type GatewayStatus struct { NsName types.NamespacedName ListenerStatuses ListenerStatuses }
GatewayStatus holds the status of the winning Gateway resource.
type HTTPRouteStatus ¶
type HTTPRouteStatus struct { // ObservedGeneration is the generation of the resource that was processed. ObservedGeneration int64 // ParentStatuses holds the statuses for parentRefs of the HTTPRoute. ParentStatuses ParentStatuses }
HTTPRouteStatus holds the status-related information about an HTTPRoute resource.
type HTTPRouteStatuses ¶
type HTTPRouteStatuses map[types.NamespacedName]HTTPRouteStatus
HTTPRouteStatuses holds the statuses of HTTPRoutes where the key is the namespaced name of an HTTPRoute.
type IgnoredGatewayStatus ¶
type IgnoredGatewayStatus struct {
ObservedGeneration int64
}
IgnoredGatewayStatus holds the status of an ignored Gateway resource.
type IgnoredGatewayStatuses ¶
type IgnoredGatewayStatuses map[types.NamespacedName]IgnoredGatewayStatus
IgnoredGatewayStatuses holds the statuses of the ignored Gateway resources.
type ListenerStatus ¶
type ListenerStatus struct { // Valid shows if the listener is valid. Valid bool // AttachedRoutes is the number of routes attached to the listener. AttachedRoutes int32 }
ListenerStatus holds the status-related information about a listener in the Gateway resource.
type ListenerStatuses ¶
type ListenerStatuses map[string]ListenerStatus
ListenerStatuses holds the statuses of listeners where the key is the name of a listener in the Gateway resource.
type MatchRule ¶
type MatchRule struct { // MatchIdx is the index of the rule in the Rule.Matches. MatchIdx int // RuleIdx is the index of the corresponding rule in the HTTPRoute. RuleIdx int // Filters holds the filters for the MatchRule. Filters Filters // BackendGroup is the group of Backends that the rule routes to. BackendGroup BackendGroup // Source is the corresponding HTTPRoute resource. // FIXME(pleshakov): Consider referencing only the parts needed for the config generation rather than // the entire resource. Source *v1beta1.HTTPRoute }
MatchRule represents a routing rule. It corresponds directly to a Match in the HTTPRoute resource. An HTTPRoute is guaranteed to have at least one rule with one match. If no rule or match is specified by the user, the default rule {{path:{ type: "PathPrefix", value: "/"}}} is set by the schema.
func (*MatchRule) GetMatch ¶
func (r *MatchRule) GetMatch() v1beta1.HTTPRouteMatch
GetMatch returns the HTTPRouteMatch of the Route .
type ParentStatus ¶
type ParentStatus struct { // Attached is true if the route attaches to the parent (listener). Attached bool }
ParentStatus holds status-related information related to how the HTTPRoute binds to a specific parentRef.
type ParentStatuses ¶
type ParentStatuses map[string]ParentStatus
ParentStatuses holds the statuses of parents where the key is the section name in a parentRef.
type PathRule ¶
type PathRule struct { // Path is a path. For example, '/hello'. Path string // MatchRules holds routing rules. MatchRules []MatchRule }
PathRule represents routing rules that share a common path.
type SSL ¶
type SSL struct { // CertificatePath is the path to the certificate file. CertificatePath string }
type Secret ¶
type Secret struct { // Secret is the Kubernetes Secret object. Secret *apiv1.Secret // Valid is whether the Kubernetes Secret is valid. Valid bool }
Secret is the internal representation of a Kubernetes Secret.
type SecretDiskMemoryManager ¶
type SecretDiskMemoryManager interface { // Request marks the secret as requested so that it can be written to disk before reloading NGINX. // Returns the path to the secret and an error if the secret does not exist in the secret store or the secret is invalid. Request(nsname types.NamespacedName) (string, error) // WriteAllRequestedSecrets writes all requested secrets to disk. WriteAllRequestedSecrets() error }
SecretDiskMemoryManager manages secrets that are requested by Gateway resources.
type SecretDiskMemoryManagerImpl ¶
type SecretDiskMemoryManagerImpl struct {
// contains filtered or unexported fields
}
FIXME(kate-osborn): Is it necessary to make this concurrent-safe?
func NewSecretDiskMemoryManager ¶
func NewSecretDiskMemoryManager(secretDirectory string, secretStore SecretStore, options ...SecretDiskMemoryManagerOption) *SecretDiskMemoryManagerImpl
func (*SecretDiskMemoryManagerImpl) Request ¶
func (s *SecretDiskMemoryManagerImpl) Request(nsname types.NamespacedName) (string, error)
func (*SecretDiskMemoryManagerImpl) WriteAllRequestedSecrets ¶
func (s *SecretDiskMemoryManagerImpl) WriteAllRequestedSecrets() error
type SecretDiskMemoryManagerOption ¶
type SecretDiskMemoryManagerOption func(*SecretDiskMemoryManagerImpl)
SecretDiskMemoryManagerOption is a function that modifies the configuration of the SecretDiskMemoryManager.
func WithSecretFileManager ¶
func WithSecretFileManager(fileManager FileManager) SecretDiskMemoryManagerOption
WithSecretFileManager sets the file manager of the SecretDiskMemoryManager. Used to inject a fake fileManager for unit tests.
type SecretStore ¶
type SecretStore interface { // Upsert upserts the secret into the store. Upsert(secret *apiv1.Secret) // Delete deletes the secret from the store. Delete(nsname types.NamespacedName) // Get gets the secret from the store. Get(nsname types.NamespacedName) *Secret }
SecretStore stores secrets.
type SecretStoreImpl ¶
type SecretStoreImpl struct {
// contains filtered or unexported fields
}
func NewSecretStore ¶
func NewSecretStore() *SecretStoreImpl
func (SecretStoreImpl) Delete ¶
func (s SecretStoreImpl) Delete(nsname types.NamespacedName)
func (SecretStoreImpl) Get ¶
func (s SecretStoreImpl) Get(nsname types.NamespacedName) *Secret
func (SecretStoreImpl) Upsert ¶
func (s SecretStoreImpl) Upsert(secret *apiv1.Secret)
type Statuses ¶
type Statuses struct { GatewayClassStatus *GatewayClassStatus GatewayStatus *GatewayStatus IgnoredGatewayStatuses IgnoredGatewayStatuses HTTPRouteStatuses HTTPRouteStatuses }
Statuses holds the status-related information about Gateway API resources.
type VirtualServer ¶
type VirtualServer struct { // Hostname is the hostname of the server. Hostname string // PathRules is a collection of routing rules. PathRules []PathRule // SSL holds the SSL configuration options fo the server. SSL *SSL }
VirtualServer is a virtual server.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
relationshipfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
resolverfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Code generated by counterfeiter.
|
Code generated by counterfeiter. |