hostassignment

package
v0.0.0-...-5152f1c Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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

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 HostnameGenerator interface {
	GenerateHostname(*routev1.Route) (string, error)
}

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.

Jump to

Keyboard shortcuts

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