The APIKey CRD is part of the Developer Portal extension for Kuadrant. It represents a request for API access credentials by a developer for a specific APIProduct and plan tier. When approved, the APIKey creates a Kubernetes Secret containing the actual API key that can be used to authenticate requests. The APIKey resource manages the entire lifecycle of API access requests, from initial submission through approval/rejection to credential generation.
apiVersion:devportal.kuadrant.io/v1alpha1kind:APIKeymetadata:name:developer-john-premiumnamespace:payment-servicesspec:apiProductRef:name:payment-apiplanTier:premiumrequestedBy:userId:john-doe-123email:john.doe@example.comuseCase:Building a mobile payment application for retail customers
AuthPolicy is applied to the HTTPRoute that the APIProduct references. When an APIKey is approved, a Kubernetes Secret is created with an annotation secret.kuadrant.io/plan-id value. The AuthPolicy validates incoming API requests by checking the API key against secrets that match specific label selectors.
PlanPolicy defines the available tiers and their corresponding rate limits. When an APIKey specifies a planTier, the controller validates that this tier exists in the PlanPolicy attached to the HTTPRoute. If the tier is valid and the APIKey is approved, the Secret is annotated with secret.kuadrant.io/plan-id: <planTier>, allowing PlanPolicy's CEL predicates to match the request to the appropriate rate limits.