hostassignment

package
v0.0.0-...-6018a90 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 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 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.

Which means "update" permission is required to change host/subdomain and either "create" or "update" permission is required to change certificate. Removing certificate info is allowed without any permission. https://github.com/openshift/origin/pull/18177#issuecomment-360660024.

Caveat here is that if the (newer/updated) route uses externalCertificate, the certChanged condition will always be true (even when the secret name remains unchanged), since we cannot verify state of external secret object. Due to this it proceeds with the assumption that the certificate has changed when the route has externalCertificate set.

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