SecuredAccess

SecuredAccess is Skupper’s platform-abstraction layer for exposing the router’s inter-router and edge ports to the outside world. It translates a single SecuredAccess CR into the platform-specific resources — Service, Route, Ingress, LoadBalancer, or Gateway — that make the router reachable from remote sites.

The chain: linkAccess → RouterAccess → SecuredAccess

Enabling link access on a site triggers a three-step resource chain:

Site.Spec.LinkAccess = "default"
        ↓ site controller: checkDefaultRouterAccess()
RouterAccess CR
  (roles: inter-router:55671, edge:45671)
        ↓ site controller: CheckRouterAccess() → asSecuredAccessSpec()
SecuredAccess CR
  (ports: inter-router, edge; accessType from linkAccess value)
        ↓ SecuredAccessManager.reconcile()
Kubernetes Service  +  Route / Ingress / LB / Gateway
        ↓ endpoints resolved into
Site.Status.Endpoints[]

The site controller calls SecuredAccessManager.Ensure(...) when it processes a RouterAccess, which creates or updates the SecuredAccess CR. The SecuredAccessManager then reconciles that CR into the appropriate platform resources.

Access types

The SecuredAccessManager is configured with a set of enabled access types at startup. The default set (absent explicit configuration) is:

// internal/kube/securedaccess/config.go
func defaultEnabledAccessTypes() []string {
    return []string{"local", "loadbalancer", "route"}
}

The full set of supported types and their implementations:

Access type constantKubernetes resource createdNotes
routeOpenShift Route (TLS passthrough)Auto-selected as default when OpenShift route client is available
loadbalancerService of type LoadBalancerDefault on non-OpenShift if route is unavailable
ingressIngress (generic controller)Requires SKUPPER_INGRESS_DOMAIN to be set
ingress-nginxIngress with NGINX TLS annotationsRequires SKUPPER_INGRESS_DOMAIN; defaults ingressClassName to "nginx"
contour-http-proxyContour HTTPProxyRequires SKUPPER_HTTP_PROXY_DOMAIN
gatewayGateway API TLSRouteRequires SKUPPER_GATEWAY_CLASS and SKUPPER_GATEWAY_PORT
nodeportService of type NodePortRequires SKUPPER_CLUSTER_HOST
localService of type ClusterIPIn-cluster only; used for local access patterns

The default access type is resolved at startup:

// internal/kube/securedaccess/config.go
func (c *Config) getDefaultAccessType(clients internalclient.Clients) string {
    if c.DefaultAccessType == "" {
        if clients.GetRouteClient() != nil && c.isEnabled(ACCESS_TYPE_ROUTE) {
            return ACCESS_TYPE_ROUTE   // OpenShift: prefer route
        }
        if c.isEnabled(ACCESS_TYPE_LOADBALANCER) {
            return ACCESS_TYPE_LOADBALANCER
        }
        if len(c.EnabledAccessTypes) > 0 {
            return c.EnabledAccessTypes[0]
        }
    }
    return c.DefaultAccessType
}

SecuredAccessManager internals

SecuredAccessManager maintains in-memory maps of all owned resources, populated during recovery at startup:

type SecuredAccessManager struct {
    definitions map[string]*skupperv2alpha1.SecuredAccess
    services    map[string]*corev1.Service
    routes      map[string]*routev1.Route
    ingresses   map[string]*networkingv1.Ingress
    httpProxies map[string]*unstructured.Unstructured
    tlsRoutes   map[string]*unstructured.Unstructured
    ...
}

Reconcile flow

On each SecuredAccess change, reconcile runs a two-step process:

// internal/kube/securedaccess/access.go
func (m *SecuredAccessManager) reconcile(sa *skupperv2alpha1.SecuredAccess) error {
    svc, err := m.checkService(sa)        // 1. ensure Service exists and is correct
    endpoints, resourceErr := m.accessType(sa).RealiseAndResolve(sa, svc)  // 2. platform resource
    certErr := m.checkCertificate(sa)     // 3. ensure TLS certificate
    sa.SetResolved(endpoints)             // 4. write resolved endpoints to status
    sa.SetConfigured(errors.Join(resourceErr, certErr))
    return m.updateStatus(sa)
}

Step 1 — Service: every access type gets a Kubernetes Service as a backing resource. checkService creates or updates it with the correct type (ClusterIP, LoadBalancer, NodePort), selector, and ports.

Step 2 — Platform resource: each AccessType implements RealiseAndResolve(access, service) ([]Endpoint, error). It creates or reconciles the platform-specific object (Route, Ingress, etc.) and returns the resolved external endpoints (hostname/IP + port).

Step 3 — Certificate: if sa.Spec.Issuer is set, checkCertificate calls certMgr.Ensure(...) to issue a TLS certificate for the resolved hosts. This is the server certificate used for mTLS on the router ports.

Step 4 — Status: resolved endpoints are written to SecuredAccess.Status.Endpoints and propagated up to Site.Status.Endpoints by the site controller.

The AccessType interface

Each platform implementation satisfies one method:

type AccessType interface {
    RealiseAndResolve(access *skupperv2alpha1.SecuredAccess, service *corev1.Service) ([]skupperv2alpha1.Endpoint, error)
}

The implementation is responsible for creating or updating the platform object and returning the resolved external hostname/IP and port that remote sites can connect to.

Relationship to RouterAccess

The RouterAccess CR specifies which ports to expose and which TLS credentials to use. The SecuredAccess CR specifies how to expose them on the platform. The site controller converts a RouterAccess to a SecuredAccess spec via asSecuredAccessSpec:

// internal/kube/site/site.go (simplified)
func asSecuredAccessSpec(routerAccess *skupperv2alpha1.RouterAccess, group string, defaultIssuer string) skupperv2alpha1.SecuredAccessSpec {
    // maps RouterAccess roles (inter-router, edge) to SecuredAccess ports
    // sets Issuer from routerAccess.Spec.Issuer or site default
    // sets AccessType from routerAccess.Spec.AccessType
    ...
}

The name of the SecuredAccess CR matches the RouterAccess name within the same namespace.

Recovery

At controller startup, SecuredAccessResourceWatcher calls Recover* methods to repopulate the in-memory caches from existing Kubernetes resources, before the event loop starts reacting to changes:

// controller init
c.accessRecovery.Recover()
// internally calls:
//   accessMgr.RecoverRoute(route)
//   accessMgr.RecoverIngress(ingress)
//   accessMgr.RecoverService(svc)
//   ...

This prevents the manager from re-creating resources that already exist.

Environment variables / flags

Flag / Env varPurpose
SKUPPER_ENABLED_ACCESS_TYPESComma-separated list of allowed access types
SKUPPER_DEFAULT_ACCESS_TYPEOverride the auto-detected default
SKUPPER_INGRESS_DOMAINDomain suffix for Ingress hostnames
SKUPPER_INGRESS_CLASS_NAMEOptional ingressClassName for Ingress objects
SKUPPER_HTTP_PROXY_DOMAINDomain suffix for Contour HTTPProxy hostnames
SKUPPER_GATEWAY_CLASSGateway API gatewayClassName
SKUPPER_GATEWAY_PORTPort for Gateway listeners (default 8443)
SKUPPER_GATEWAY_DOMAINDomain suffix for Gateway TLSRoute hostnames
SKUPPER_CLUSTER_HOSTCluster hostname for NodePort access type

References