feat(ncp): implement direct IAM token generation for NKS clusters#1645
Merged
powerkimhub merged 1 commit intocloud-barista:masterfrom Feb 2, 2026
Merged
feat(ncp): implement direct IAM token generation for NKS clusters#1645powerkimhub merged 1 commit intocloud-barista:masterfrom
powerkimhub merged 1 commit intocloud-barista:masterfrom
Conversation
- Add generateNCPIAMToken() with HMAC-SHA256 signature - Embed tokens directly in kubeconfig (no external CLI needed) - Use CredentialInfo.ClientId/ClientSecret for token generation - Add region-to-stage mapping based on official ncp-iam-authenticator
powerkimhub
approved these changes
Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Direct IAM Token Generation for NCP NKS Clusters
Summary
This PR implements direct NCP IAM token generation using HMAC-SHA256 signatures for NCP NKS (Naver Kubernetes Service) cluster authentication. The token is embedded directly in the kubeconfig, providing a streamlined authentication experience using only CB-Spider's CredentialInfo.
Solution
Direct Token Generation
This implementation generates NCP IAM tokens directly within the driver using:
ClientId(AccessKey) andClientSecret(SecretKey)New kubeconfig Format
Technical Implementation
Token Generation Algorithm
The NCP IAM token follows this structure:
Where the claim contains:
{ "timestamp": "1769417107192", "accessKey": "ncp_iam_EXAMPLE_KEY_xxxxxxxxxxxx", "signature": "LbjXgC1NZGiQ0IiNr0jDksGLlcOEt68k6MGn4dm9180=", "path": "/iam/v1/user?clusterUuid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }Signature Generation
The signature is created using HMAC-SHA256:
Token Expiration
GetCluster()callCode Changes
Modified Files
ClusterHandler.go (~1965 lines)
CredentialInfofield toNcpVpcClusterHandlerstructgenerateNCPIAMToken()function (main token generation)makeNCPSignature()function (HMAC-SHA256 signing)getNCPIAMPath()function (API path construction)getNCPRegionStage()function (region to stage mapping)addIAMAuthentication()to use direct token generation instead of execncpTokenClaimstruct for JSON serializationNcpVpcCloudConnection.go
CreateClusterHandler()to passCredentialInfoto ClusterHandlerNew Dependencies
Key Functions
generateNCPIAMToken()k8s-ncp-v1.{claim}formatmakeNCPSignature()getNCPRegionStage()v1sgn-v1jpn-v1krs-v1v1v1{region}-v1(automatic fallback)Note: The
v1in IAM path (/iam/v1/user) is different from NKS API version (/vnks/v2):/iam/v1/user?clusterUuid=xxx- IAM authentication endpoint (used for token signature)/vnks/v2/clusters- NKS management API endpoint (used for cluster operations)Testing Results
Environment
Authentication Test
Namespace & Pod Test
nginx Deployment Test
Deployment Creation
Deployment Status
Service Configuration
nginx Access Test (Pod Internal)
nginx Access Test (ClusterIP via DNS)
Test Results Summary
✅ Authentication: Successfully authenticated using generated NCP IAM token
✅ Cluster Info: Retrieved cluster information and node status
✅ Resource Management: Created and managed Deployments, Services, Pods
✅ Networking: ClusterIP and NodePort services working correctly
✅ DNS Resolution: CoreDNS service discovery functioning properly
✅ Pod Scheduling: Pods scheduled and running on worker nodes
✅ Application Deployment: nginx deployment fully operational
Comparison with Other CSP Implementations
AWS EKS
StsClientto generate presigned URLsGCP GKE
CredentialInfofor OAuth2 JWT tokensNCP NKS (This Implementation)
CredentialInfofor HMAC-SHA256 presigned tokensBreaking Changes
None. This is a transparent implementation change:
GetCluster()callReferences
cloud-driver-libs/region/ncp_region_meta.yaml