Documentation
¶
Index ¶
- func ValidateTargetRef(ref v1alpha2.LocalPolicyTargetReference, basePath *field.Path, ...) error
- type CompositeGenerator
- func (g *CompositeGenerator) GenerateForInternalLocation(policies []Policy) GenerateResultFiles
- func (g *CompositeGenerator) GenerateForLocation(policies []Policy, location http.Location) GenerateResultFiles
- func (g *CompositeGenerator) GenerateForServer(policies []Policy, server http.Server) GenerateResultFiles
- type CompositeValidator
- type File
- type GenerateResultFiles
- type Generator
- type GlobalSettings
- type ManagerConfig
- type Policy
- type UnimplementedGenerator
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompositeGenerator ¶
type CompositeGenerator struct {
// contains filtered or unexported fields
}
CompositeGenerator contains all policy generators.
func NewCompositeGenerator ¶
func NewCompositeGenerator(generators ...Generator) *CompositeGenerator
NewCompositeGenerator returns a new instance of a CompositeGenerator.
func (*CompositeGenerator) GenerateForInternalLocation ¶
func (g *CompositeGenerator) GenerateForInternalLocation(policies []Policy) GenerateResultFiles
GenerateForInternalLocation calls all policy generators for an internal location block.
func (*CompositeGenerator) GenerateForLocation ¶
func (g *CompositeGenerator) GenerateForLocation(policies []Policy, location http.Location) GenerateResultFiles
GenerateForLocation calls all policy generators for a normal location block.
func (*CompositeGenerator) GenerateForServer ¶
func (g *CompositeGenerator) GenerateForServer(policies []Policy, server http.Server) GenerateResultFiles
GenerateForServer calls all policy generators for the server block.
type CompositeValidator ¶
type CompositeValidator struct {
// contains filtered or unexported fields
}
CompositeValidator manages the validators for NGF Policies.
func NewManager ¶
func NewManager( mustExtractGVK kinds.MustExtractGVK, configs ...ManagerConfig, ) *CompositeValidator
NewManager returns a new CompositeValidator. Implements validation.PolicyValidator.
func (*CompositeValidator) Conflicts ¶
func (m *CompositeValidator) Conflicts(polA, polB Policy) bool
Conflicts returns true if the policies conflict.
func (*CompositeValidator) Validate ¶
func (m *CompositeValidator) Validate(policy Policy) []conditions.Condition
Validate validates the policy.
func (*CompositeValidator) ValidateGlobalSettings ¶
func (m *CompositeValidator) ValidateGlobalSettings( policy Policy, globalSettings *GlobalSettings, ) []conditions.Condition
ValidateGlobalSettings validates an NGF Policy with the NginxProxy settings.
type GenerateResultFiles ¶
type GenerateResultFiles []File
GenerateResultFiles is a list of files generated for inclusion by policy generators.
type Generator ¶
type Generator interface {
// GenerateForServer generates policy configuration for the server block.
GenerateForServer(policies []Policy, server http.Server) GenerateResultFiles
// GenerateForLocation generates policy configuration for a normal location block.
GenerateForLocation(policies []Policy, location http.Location) GenerateResultFiles
// GenerateForInternalLocation generates policy configuration for an internal location block.
GenerateForInternalLocation(policies []Policy) GenerateResultFiles
}
Generator defines an interface for a policy to implement its appropriate generator functions.
type GlobalSettings ¶
type GlobalSettings struct {
// TelemetryEnabled is whether telemetry is enabled in the NginxProxy resource.
TelemetryEnabled bool
}
GlobalSettings contains global settings from the current state of the graph that may be needed for policy validation or generation if certain policies rely on those global settings.
type ManagerConfig ¶
type ManagerConfig struct {
// Validator is the Validator for the Policy.
Validator Validator
// GVK is the GroupVersionKind of the Policy.
GVK schema.GroupVersionKind
}
ManagerConfig contains the config to register a Policy with the CompositeValidator.
type Policy ¶
type Policy interface {
GetTargetRefs() []v1alpha2.LocalPolicyTargetReference
GetPolicyStatus() v1alpha2.PolicyStatus
SetPolicyStatus(status v1alpha2.PolicyStatus)
client.Object
}
Policy is an extension of client.Object. It adds methods that are common among all NGF Policies.
type UnimplementedGenerator ¶
type UnimplementedGenerator struct{}
UnimplementedGenerator can be inherited by any policy generator that may not need to implement all of possible generations, in order to satisfy the Generator interface.
func (UnimplementedGenerator) GenerateForInternalLocation ¶
func (u UnimplementedGenerator) GenerateForInternalLocation(_ []Policy) GenerateResultFiles
func (UnimplementedGenerator) GenerateForLocation ¶
func (u UnimplementedGenerator) GenerateForLocation(_ []Policy, _ http.Location) GenerateResultFiles
func (UnimplementedGenerator) GenerateForServer ¶
func (u UnimplementedGenerator) GenerateForServer(_ []Policy, _ http.Server) GenerateResultFiles
type Validator ¶
type Validator interface {
// Validate validates an NGF Policy.
Validate(policy Policy) []conditions.Condition
// ValidateGlobalSettings validates an NGF Policy with the NginxProxy settings.
ValidateGlobalSettings(policy Policy, globalSettings *GlobalSettings) []conditions.Condition
// Conflicts returns true if the two Policies conflict.
Conflicts(a, b Policy) bool
}
Validator validates an NGF Policy.