|
| 1 | +--- |
| 2 | +title: oidc-routes-integration |
| 3 | +authors: |
| 4 | + - "@anirudhAgniRedhat" |
| 5 | + - "@PillaiManish" |
| 6 | +reviewers: |
| 7 | + - "@tgeer" |
| 8 | +approvers: |
| 9 | + - "@tgeer" |
| 10 | +api-approvers: |
| 11 | + - "@tgeer" |
| 12 | +creation-date: 2025-08-08 |
| 13 | +last-updated: 2025-08-25 |
| 14 | +tracking-link: |
| 15 | + - https://issues.redhat.com/browse/OCPSTRAT-1691 |
| 16 | +--- |
| 17 | + |
| 18 | +# OIDC Routes Integration for Zero Trust Workload Identity Manager |
| 19 | + |
| 20 | +## Summary |
| 21 | + |
| 22 | +This enhancement proposes exposing SPIRE OIDC Discovery Provider endpoints through OpenShift Routes under the domain `*.apps.<cluster-domain>` for the selected default installation. |
| 23 | + |
| 24 | +## Motivation |
| 25 | + |
| 26 | +The SpireOIDCDiscoveryProvider serves as a critical bridge between SPIFFE identities and OIDC standards, allowing external systems to validate and trust SPIRE-issued JWTs. By exposing well-known endpoints (/.well-known/openid-configuration and /keys), it provides the OIDC discovery document and corresponding public keys required for verifying JWT-SVIDs. |
| 27 | + |
| 28 | +In OpenShift environments, administrators need a straightforward and reliable way to make these endpoints accessible. They may choose to leverage the default OpenShift wildcard DNS entry (*.apps.<cluster-domain>), which points to the ingress routers, or alternatively configure a custom DNS entry that aligns with organizational requirements. Providing flexibility in how the SpireOIDCDiscoveryProvider endpoints are exposed ensures smoother integration with external identity consumers and supports varied deployment scenarios. |
| 29 | + |
| 30 | + |
| 31 | +### User Stories |
| 32 | + |
| 33 | +- As an OpenShift cluster administrator, I want to enable a managed Route for the SPIRE OIDC Discovery Provider by setting `spec.managedRoute: true`, so that the discovery endpoints are exposed on the cluster’s default `*.apps.<cluster-domain>` without additional YAML or manual DNS steps. |
| 34 | + |
| 35 | +- As an OpenShift cluster administrator, I want to optionally specify a custom host, so that I can expose the OIDC issuer on an organization-owned domain (e.g., `oidc.example.com`) that aligns with corporate DNS and certificate policies |
| 36 | + |
| 37 | +- As an OpenShift cluster administrator, I want to disable the managed Route by setting `spec.managedRoute: false`, so that I can expose the endpoints through self-managed OpenShift routes or ingress. |
| 38 | + |
| 39 | +- As an Openshift security engineer, I want to attach labels/annotations to the managed `Route`, so that I can integrate with tools for auditability. |
| 40 | + |
| 41 | +- As an SRE, I want clear status conditions on the CR and events, so that I can quickly diagnose exposure, DNS, or certificate issues. |
| 42 | + |
| 43 | +- As an OpenShift cluster administrator, I want RBAC guardrails and explicit errors if the operator lacks permission to manage Routes, so that I can understand required privileges and safely delegate responsibilities. |
| 44 | + |
| 45 | +- As an OpenShift cluster administrator, I want the managed Route to default to Service CA certificates so that the endpoints are automatically secured and trusted in-cluster without manual certificate management. |
| 46 | + |
| 47 | +- As an Openshift security engineer, I want the managed Route to support re-encrypt termination so that TLS is enforced end-to-end with cluster-managed certificates, providing stronger security than edge while avoiding the operational burden of passthrough. |
| 48 | + |
| 49 | + |
| 50 | +### Goals |
| 51 | +- Provide a managed Route option for the SpireOIDCDiscoveryProvider that automatically exposes OIDC discovery endpoints on the cluster’s default `*.apps.<cluster-domain>`. |
| 52 | +- Allow administrators to disable the managed Route, supporting self-managed exposure of the endpoints through OpenShift Routes, ingress, or service mesh gateways. |
| 53 | +- Support attaching labels and annotations to the managed Route for better auditing and monitoring. |
| 54 | +- Default the managed Route to use Service CA–issued certificates, ensuring automatic TLS and certificate rotation. |
| 55 | +- Default re-encrypt termination for the managed Route, providing end-to-end TLS with cluster-managed certificates as a stronger security option compared to edge termination, while avoiding the complexity of passthrough. |
| 56 | +- Provide clear status conditions and events so that SREs can quickly diagnose DNS, TLS, or exposure issues. |
| 57 | +- Validation check to reject updates to Route termination type or configurations that override usage of ServiceCA operator managed certificates. |
| 58 | +- Allow the use of custom PKI with the default managed Route for TLS connections between clients and the ingress router. |
| 59 | + |
| 60 | +### Non-Goals |
| 61 | +- Manage custom PKI without default managed Route. |
| 62 | +- Deletion of default managed Route automatically when the option is disabled. |
| 63 | +- Support managed Route for applications that are not using default Openshift `*.apps.<cluster-domain>` |
| 64 | +- Reconciliation of updates to DNS changes for SpireOIDCDiscoveryProvider endpoints. |
| 65 | +- Support edge and passthrough termination types for default managed Route. |
| 66 | +- Support usage of SVIDs for SpireOIDCDiscoveryProvider endpoints. |
| 67 | +- Custom PKI integration for the default managed Route of the SpireOIDCDiscoveryProvider endpoints to replace Service CA–issued certificates when using re-encrypt termination. |
| 68 | + |
| 69 | + |
| 70 | +## Proposal |
| 71 | + |
| 72 | +This enhancement implements default OIDC route creation by extending the existing `SpireOIDCDiscoveryProvider` controller and introducing an optional API field to control managed route creation. |
| 73 | + |
| 74 | +#### Automatic Route Creation |
| 75 | + |
| 76 | +The implementation enhances the existing `SpireOIDCDiscoveryProvider` controller to create and manage `Routes` as part of its reconciliation logic. These `Routes` will integrate with OpenShift’s Service CA operator, enabling automatic TLS certificate provisioning and lifecycle management without manual intervention. By default, all Routes will be created with secure configurations, including `re-encrypt` TLS termination and enforced redirection of insecure requests. In addition, the controller will ensure that a complete certificate trust chain is automatically established from the Route to the backing Service using the Service CA, providing end-to-end security and minimizing the operational burden on administrators. |
| 77 | + |
| 78 | +For example, when a SpireOIDCDiscoveryProvider resource is created as |
| 79 | + |
| 80 | +```yaml |
| 81 | +apiVersion: operator.openshift.io/v1alpha1 |
| 82 | +kind: SpireOIDCDiscoveryProvider |
| 83 | +metadata: |
| 84 | + name: cluster |
| 85 | +spec: |
| 86 | + trustDomain: cluster.local |
| 87 | + managedRoute: "true" # Enable operator-managed Route (default) |
| 88 | + # ... other existing fields remain unchanged |
| 89 | +``` |
| 90 | +the controller automatically provisions a secure Route with Service CA–managed certificates and configures it with secure defaults. |
| 91 | + |
| 92 | +### Workflow Description |
| 93 | + |
| 94 | +This section outlines an end-to-end workflow. |
| 95 | + |
| 96 | +#### Initial Setup |
| 97 | +1. **User Action**: Creates `SpireOIDCDiscoveryProvider` resource with `managedRoute` flag being enabled. |
| 98 | +2. **Controller Response**: Detects the resource and initiates automatic route setup |
| 99 | +3. **Service Preparation**: Adds Service CA annotation to the OIDC discovery service |
| 100 | +4. **Certificate Provisioning**: Service CA operator generates certificates and creates `oidc-serving-cert` secret |
| 101 | +5. **Route Creation**: Controller creates OpenShift Route with secure defaults (reencrypt TLS, HTTPS redirect) |
| 102 | + |
| 103 | +#### Ongoing Operations |
| 104 | +6. **External Access**: OIDC discovery endpoint becomes available at `https://<route-hostname>/.well-known/openid_configuration` |
| 105 | +7. **Certificate Management**: Service CA automatically handles certificate renewal and rotation |
| 106 | +8. **Route Maintenance**: Controller manages route lifecycle tied to `SpireOIDCDiscoveryProvider` resource lifecycle |
| 107 | + |
| 108 | +#### Enhanced Workflow Diagram |
| 109 | + |
| 110 | +```mermaid |
| 111 | +sequenceDiagram |
| 112 | + participant User |
| 113 | + participant Controller |
| 114 | + participant ServiceCA as Service CA |
| 115 | + participant Route as OpenShift Route |
| 116 | + participant ExternalClient as External Client |
| 117 | +
|
| 118 | + Note over User,ExternalClient: Initial Setup |
| 119 | + User->>Controller: Create SpireOIDCDiscoveryProvider |
| 120 | + Controller->>ServiceCA: Add annotation to OIDC service |
| 121 | + ServiceCA->>ServiceCA: Generate certificate & secret |
| 122 | + Controller->>Route: Create route with reencrypt TLS |
| 123 | + Route->>Route: Configure Service CA trust chain |
| 124 | + |
| 125 | + Note over User,ExternalClient: External Access |
| 126 | + ExternalClient->>Route: HTTPS request to /.well-known/openid_configuration |
| 127 | + Route->>Route: TLS termination & reencrypt |
| 128 | + Route->>ExternalClient: Return OIDC discovery document |
| 129 | + |
| 130 | + Note over User,ExternalClient: Ongoing Certificate Management |
| 131 | + ServiceCA->>ServiceCA: Auto-rotate certificates |
| 132 | + Route->>Route: Auto-update trust chain |
| 133 | +``` |
| 134 | +### API Extensions |
| 135 | + |
| 136 | +```go |
| 137 | +// managedRoute is for enabling routes for oidc-discovery-provider |
| 138 | +// +kubebuilder:default:="true" |
| 139 | +// +kubebuilder:validation:Enum:="true";"false" |
| 140 | +// +kubebuilder:validation:required |
| 141 | +ManagedRoute string `json:"managedRoute"` |
| 142 | +``` |
| 143 | + |
| 144 | +The enhancement adds a mandatory `managedRoute` field to `SpireOIDCDiscoveryProvider` CR. Correspondingly, a new `ManagedRouteReady` condition is introduced to provide detailed status, reason, and message fields for troubleshooting the OIDC Route. |
| 145 | + |
| 146 | +When `managedRoute` is enabled (default), the controller automatically creates OpenShift Routes with re-encrypt TLS termination and integrates with the Service CA operator for comprehensive certificate management. The controller annotates the `spire-oidc-discovery-provider` service with `service.beta.openshift.io/serving-cert-secret-name: oidc-serving-cert` to enable automatic certificate generation, provisioning, and lifecycle management including renewal and trust establishment with the cluster's Certificate Authority. |
| 147 | + |
| 148 | + |
| 149 | +### Topology Considerations |
| 150 | + |
| 151 | +#### Hypershift / Hosted Control Planes |
| 152 | + |
| 153 | +#### Standalone Clusters |
| 154 | + |
| 155 | +Only standalone cluster topology is in consideration for the tech-preview |
| 156 | + |
| 157 | +#### Single-node Deployments or MicroShift |
| 158 | + |
| 159 | + |
| 160 | +### Implementation Details/Notes/Constraints |
| 161 | + |
| 162 | +The implementation enhances the existing SPIRE OIDC Discovery Provider controller to automatically create and manage OpenShift Routes with integrated certificate management through the Service CA operator. |
| 163 | + |
| 164 | +As part of this implementation, the spiffe-helper container will be removed from the spire-oidc-discovery-provider deployment to streamline the attestation flow through the SPIRE agent’s Workload API socket when requesting JWKS bundles and eliminate the dependency on SPIRE server–generated certificates for endpoints. The spire-oidc-discovery-provider will instead use Service CA–managed certificates. |
| 165 | + |
| 166 | +#### Managed Route Lifecycle and Validation |
| 167 | + |
| 168 | +The controller manages the Route lifecycle based on the managedRoute flag. The Route object has ownerReference `spire-spiffe-oidc-discovery-provider` deployment object. |
| 169 | + |
| 170 | +When managedRoute is enabled, the controller creates Routes automatically with secure defaults, including TLS re-encryption and enforced best practices for exposure. |
| 171 | + |
| 172 | +When managedRoute is disabled, the controller stops managing Routes but preserves any existing configurations. This allows users to add custom Route object. |
| 173 | + |
| 174 | +If managedRoute is re-enabled, the controller attempts to create a new Route. If an existing Route is already present, it validates the configuration against the expected defaults. If there are deviations from expected defaults, the controller records an error in the CR status and sets the `ManagedRouteReady` condition to `false`. This ensures operators receive clear signals when Routes are misconfigured or diverge from secure defaults. |
| 175 | + |
| 176 | +#### TLS Security and Validation |
| 177 | + |
| 178 | +Re-encrypt termination is enforced to ensure end-to-end TLS, dual-layer certificate validation, and seamless integration with OpenShift’s Service CA for automated certificate lifecycle management. This approach delivers key benefits as it supports custom PKI integration in environments with strict security policies or existing PKI infrastructures and it mitigates risks from external PKI compromise by re-encrypting traffic at the router, providing an additional layer of protection through internal–external separation. |
| 179 | + |
| 180 | +#### RBAC Validation |
| 181 | + |
| 182 | +The controller validates required RBAC permissions before attempting Route operations, checking for `routes.route.openshift.io` (create, update, get, list, watch, delete) and `services` (get, update, patch) permissions. When permissions are missing, the controller provides specific error messages identifying the missing permissions for administrators. The controller sets status conditions to indicate permission errors while continuing to manage other aspects of the SpireOIDCDiscoveryProvider. |
| 183 | + |
| 184 | +#### Labels/Annotations |
| 185 | + |
| 186 | +The Route object inherits user-defined labels and annotations from `SpireOIDCDiscoveryProvider` CRD fields, with controller-managed labels taking precedence over user labels for conflicts. |
| 187 | + |
| 188 | +#### Constraints |
| 189 | + |
| 190 | +- Toggling the `spec.managedRoute` from `false` to `true` will not overwrite the Route object. User will have to delete any conflicting existing Route for successful operation. |
| 191 | +- The deletion of a `SpireOIDCDiscoveryProvider` custom resource triggers a cascade of cleanup operations that removes managed Route. |
| 192 | +- Uninstallation of managed Route object is not supported. |
| 193 | +- Routes are always created in the same namespace as their corresponding `spire-spiffe-oidc-discovery-provider` deployment resource. |
| 194 | +- The managed Route is supported only for applications that use the *.apps.<cluster-domain> wildcard DNS. |
| 195 | + |
| 196 | +### Risks and Mitigations |
| 197 | + |
| 198 | +### Drawbacks |
| 199 | + |
| 200 | +The approach introduces a dependency on Service CA operations for certificate management, which may not align with all organizational requirements. Additionally, the solution can incur performance overhead, increase troubleshooting complexity, and lead to higher resource consumption under heavy load. |
| 201 | + |
| 202 | +## Alternatives (Not Implemented) |
| 203 | + |
| 204 | +### Manual Route Configuration |
| 205 | +- **Pros**: Full control over route configuration. |
| 206 | +- **Cons**: Prone to external PKI compromises and compliance errors, possibilities of leaking cluster-internal CAs, management of custom DNS entries and routes. |
| 207 | +- **Decision**: Rejected in favour of integration with Service CA operator as default secured route. |
| 208 | + |
| 209 | +## Test Plan |
| 210 | + |
| 211 | +- Managed Route enable/disable and re-enable behavior with drift validation. |
| 212 | +- Custom host support with DNS, cert issuance, and discovery validation. |
| 213 | +- Secure defaults enforced with re-encrypt termination and redirects. |
| 214 | +- Service CA integration with cert issuance, rotation, and trust chain verification. |
| 215 | +- RBAC guardrails with explicit errors on insufficient permissions. |
| 216 | +- Label/annotation propagation for auditability and policy integration. |
| 217 | +- Status and events accuracy via ManagedRouteReady condition and diagnostics. |
| 218 | + |
| 219 | +## Graduation Criteria |
| 220 | + |
| 221 | +### Dev Preview -> Tech Preview |
| 222 | + |
| 223 | +- Feature available for end-to-end usage. |
| 224 | +- Complete end user documentation. |
| 225 | +- UTs and e2e tests are present. |
| 226 | +- Gather feedback from the users. |
| 227 | + |
| 228 | +### Tech Preview -> GA |
| 229 | +N/A. This feature is for Tech Preview, until decided for GA. |
| 230 | + |
| 231 | +### Removing a deprecated feature |
| 232 | + |
| 233 | +## Upgrade / Downgrade Strategy |
| 234 | + |
| 235 | +Upgrades scenarios not supported in the Tech Preview version. |
| 236 | + |
| 237 | +## Version Skew Strategy |
| 238 | + |
| 239 | +## Operational Aspects of API Extensions |
| 240 | + |
| 241 | +## Support Procedures |
| 242 | + |
| 243 | +## Infrastructure Needed [optional] |
| 244 | +None |
0 commit comments