Skip to content

Commit 32982e2

Browse files
committed
Consolidate GCP OAuth documentation
- Merge architecture/overview from GCP_OAUTH_SETUP.md into GCP_OAUTH_GKE_SETUP.md - Remove redundant GCP_OAUTH_SETUP.md file - Remove internal GCP_OAUTH_IMPLEMENTATION_STATUS.md file - Keep single comprehensive GKE deployment guide
1 parent d4e6a33 commit 32982e2

File tree

3 files changed

+48
-604
lines changed

3 files changed

+48
-604
lines changed

docs/GCP_OAUTH_GKE_SETUP.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,54 @@
22

33
This guide covers how to configure GCP OAuth authentication for Headlamp when deploying to Google Kubernetes Engine (GKE).
44

5+
## Overview
6+
7+
This implementation adds GCP OAuth 2.0 authentication support to Headlamp, replacing the deprecated Identity Service for GKE. Users authenticate with their Google Cloud account, and the authentication tokens are used to access Kubernetes resources with proper RBAC.
8+
9+
## Architecture
10+
11+
### Authentication Flow
12+
13+
1. **User Login**: User clicks "Sign in with Google" in Headlamp UI
14+
2. **OAuth Redirect**: User is redirected to Google's OAuth consent screen
15+
3. **Authorization**: User authorizes Headlamp to access their GCP account
16+
4. **Callback**: Google redirects back to Headlamp with authorization code
17+
5. **Token Exchange**: Headlamp exchanges code for access/refresh tokens
18+
6. **K8s API Access**: Tokens are used to authenticate with Kubernetes API
19+
7. **RBAC Authorization**: Kubernetes RBAC evaluates permissions based on user's GCP identity
20+
21+
### Components
22+
23+
#### Backend Changes
24+
25+
1. **GCP Authenticator** (`backend/pkg/gcp/auth.go`)
26+
- Implements OAuth 2.0 flow with Google
27+
- PKCE (Proof Key for Code Exchange) support for enhanced security
28+
- Token refresh and caching mechanisms
29+
- GKE cluster detection
30+
31+
2. **Route Handlers** (`backend/pkg/gcp/handlers.go`)
32+
- `/gcp-auth/login`: Initiates OAuth flow
33+
- `/gcp-auth/callback`: Handles OAuth callback
34+
- `/gcp-auth/refresh`: Refreshes expired tokens
35+
- `/gcp-auth/enabled`: Check if GCP OAuth is enabled
36+
37+
3. **Configuration** (`backend/pkg/config/config.go`)
38+
- `GCPOAuthEnabled`: Enable/disable GCP OAuth
39+
- `GCPClientID`: OAuth 2.0 Client ID
40+
- `GCPClientSecret`: OAuth 2.0 Client Secret
41+
- `GCPRedirectURL`: Callback URL for OAuth flow
42+
43+
#### Frontend Changes
44+
45+
1. **GCP Login Button** (`frontend/src/components/cluster/GCPLoginButton.tsx`)
46+
- React component that renders "Sign in with Google" button
47+
- Automatically shown for GKE clusters or when backend OAuth is enabled
48+
49+
2. **Auth Chooser** (`frontend/src/components/authchooser/index.tsx`)
50+
- Shows authentication options including GCP OAuth
51+
- Prevents auto-redirect to token page to allow users to choose auth method
52+
553
## Prerequisites
654

755
1. GKE cluster up and running

docs/GCP_OAUTH_IMPLEMENTATION_STATUS.md

Lines changed: 0 additions & 318 deletions
This file was deleted.

0 commit comments

Comments
 (0)