Documentation
¶
Index ¶
Constants ¶
const ( // ClientSecretKey is the key in the OAuth2 proxy Secret that holds the OAuth2 client secret ClientSecretKey = defaults.OAuthClientSecretKeyName // DefaultResyncInterval is how often each RadixApplication is reconciled to correct drift DefaultResyncInterval = time.Hour // DefaultSecretRotationInterval is how old a client secret can be before it is rotated, when not set DefaultSecretRotationInterval = 90 * 24 * time.Hour // SyncTimeout is how long the sync of one RadixApplication can take. The sync is not cancelled on shutdown, so the // manager's GracefulShutdownTimeout must be longer than this. SyncTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DexClientManager ¶
type DexClientManager interface {
// EnsureClient creates or updates the client, rotates its secret when it is older than secretRotationInterval,
// and returns the secret and when it must be rotated
EnsureClient(ctx context.Context, desired dex.Client, secretRotationInterval time.Duration) (secret string, rotateAt time.Time, err error)
}
DexClientManager ensures that the OAuth2 client of an application exists in Dex
type RadixApplicationReconciler ¶
type RadixApplicationReconciler struct {
// contains filtered or unexported fields
}
RadixApplicationReconciler reconciles a RadixApplication object
func NewRadixApplicationReconciler ¶
func NewRadixApplicationReconciler( c dynclient.Client, dexClients DexClientManager, oauth2Template *radixv1.OAuth2, clusterName, dnsZone, appAliasBaseURL string, secretRotationInterval time.Duration, maxConcurrentReconciles int, ) *RadixApplicationReconciler
NewRadixApplicationReconciler returns a reconciler that reads and writes Kubernetes objects with c, and manages the OAuth2 clients of applications in Dex with dexClients. secretRotationInterval defaults to DefaultSecretRotationInterval when not set.
func (*RadixApplicationReconciler) Reconcile ¶
func (r *RadixApplicationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
Reconcile ensures that RadixApplications with the EasyAuth annotation have the EasyAuth OAuth2 configuration on the public components of all their RadixDeployments, an OAuth2 client in Dex with redirect URIs for all public hosts, and that the client secret from Dex is synced to the OAuth2 proxy of each public component.
The manager cancels ctx on shutdown, so the sync runs on a context that is not cancelled with it, and only bounded by SyncTimeout. A started sync is completed before the manager releases the leader lease, so the Dex client and the client secret in the OAuth2 proxy Secrets are never left half-synced by a shutdown.
func (*RadixApplicationReconciler) SetupWithManager ¶
func (r *RadixApplicationReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.