Documentation ¶
Index ¶
- Constants
- func AllocateHost(ctx context.Context, route *routev1.Route, ...) field.ErrorList
- func ValidateHostExternalCertificate(ctx context.Context, new, older *routev1.Route, ...) field.ErrorList
- func ValidateHostUpdate(ctx context.Context, route, older *routev1.Route, ...) field.ErrorList
- type HostnameGenerator
- type SimpleAllocationPlugin
Constants ¶
const ( // HostGeneratedAnnotationKey is the key for an annotation set to "true" // if the route's host was generated. HostGeneratedAnnotationKey = "openshift.io/host.generated" )
Variables ¶
This section is empty.
Functions ¶
func AllocateHost ¶
func AllocateHost(ctx context.Context, route *routev1.Route, sarc route.SubjectAccessReviewCreator, routeAllocator HostnameGenerator, opts route.RouteValidationOptions) field.ErrorList
AllocateHost allocates a host name ONLY if the route doesn't specify a subdomain wildcard policy and the host name on the route is empty and an allocator is configured. It must first allocate the shard and may return an error if shard allocation fails.
func ValidateHostExternalCertificate ¶
func ValidateHostExternalCertificate(ctx context.Context, new, older *routev1.Route, sarc routecommon.SubjectAccessReviewCreator, opts routecommon.RouteValidationOptions) field.ErrorList
ValidateHostExternalCertificate checks if the user has permissions to create and update custom-host subresource of routes. This check is required to be done prior to ValidateHostUpdate() since updating hosts while using externalCertificate is contingent on the user having both these permissions. The ValidateHostUpdate() cannot differentiate if the certificate has changed since now the certificates will be present as a secret object, due to this it proceeds with the assumption that the certificate has changed when the route has externalCertificate set. TODO: Consider merging this function into ValidateHostUpdate.
func ValidateHostUpdate ¶
func ValidateHostUpdate(ctx context.Context, route, older *routev1.Route, sarc route.SubjectAccessReviewCreator, opts route.RouteValidationOptions) field.ErrorList
ValidateHostUpdate checks if the user has the correct permissions based on the updates done to the route object. If the route's host/subdomain has been updated it checks if the user has "update" permission on custom-host subresource. If only the certificate has changed, it checks if the user has "create" permission on the custom-host subresource. Caveat here is that if the route uses externalCertificate, the certChanged condition will always be true since we cannot verify state of external secret object.
Types ¶
type HostnameGenerator ¶
type SimpleAllocationPlugin ¶
type SimpleAllocationPlugin struct {
DNSSuffix string
}
SimpleAllocationPlugin implements the route.AllocationPlugin interface to provide a simple unsharded (or single sharded) allocation plugin.
func NewSimpleAllocationPlugin ¶
func NewSimpleAllocationPlugin(suffix string) (*SimpleAllocationPlugin, error)
NewSimpleAllocationPlugin creates a new SimpleAllocationPlugin.
func (*SimpleAllocationPlugin) GenerateHostname ¶
func (p *SimpleAllocationPlugin) GenerateHostname(route *routev1.Route) (string, error)
GenerateHostname generates a host name for a route - using the service name, namespace (if provided) and the router shard dns suffix. TODO: move to router code, and have the routers set this back on the route status.