Skip to content

feat(nas): support access point rrsa authentication - #1613

Open
iltyty wants to merge 2 commits into
kubernetes-sigs:masterfrom
iltyty:nas-ap-rrsa
Open

feat(nas): support access point rrsa authentication#1613
iltyty wants to merge 2 commits into
kubernetes-sigs:masterfrom
iltyty:nas-ap-rrsa

Conversation

@iltyty

@iltyty iltyty commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Support NAS access point RRSA authentication.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 9, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: iltyty
Once this PR has been reviewed and has the lgtm label, please assign mowangdk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 9, 2026
@iltyty
iltyty force-pushed the nas-ap-rrsa branch 5 times, most recently from 08de0b4 to e9aa17c Compare January 12, 2026 05:55
@iltyty

iltyty commented Jan 13, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2026

@mowangdk mowangdk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlbeeSo Please take a look as well

Comment on lines +81 to +86
if op == nil || op.AuthConfig == nil {
return handler(ctx, op)
}
if op.AuthConfig.AuthType != rrsaAuthType && (op.AuthConfig.AccessKey == "" || op.AuthConfig.AccessSecret == "") {
return handler(ctx, op)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine these two if statements? There doesn't seem to be any difference between them

return
}

if op.AuthConfig != nil && op.AuthConfig.AuthType == rrsaAuthType {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these statements into a switch block? Just emit an error if the credential file doesn't exist.

RoleArn: tea.String(roleArn),
RoleSessionName: tea.String(session),
}
resp, err := i.stsClient.AssumeRoleWithOIDC(req)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will there be a scenario where a node doesn't have AssumeRoleWithOIDCRequests policys?

RoleSessionName: tea.String(session),
}
resp, err := i.stsClient.AssumeRoleWithOIDC(req)
if err != nil || resp.Body == nil || resp.Body.Credentials == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should at least log the error, so that we can identify why request failed

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2026

@mowangdk mowangdk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Summary: Adds RRSA (RAM Role for Service Account) authentication support for NAS access points, including OIDC token exchange via STS and mount-proxy integration for credential injection.

Issues Found:

  • The AssumeRoleWithOIDC method was added to the STSInterface — ensure the mock implementation matches the real STS client signature exactly.
  • The mounter refactoring (MountOperationMountRequest from mounter/utils) is a good consolidation, but it touches multiple mounter implementations (AdaptorMounter, OssCmdMounter, ConnectorMounter). Ensure all mount paths still work correctly.
  • The alinas_secret.go interceptor file shows a significant rewrite (from 56 lines of context visible). This is the security-sensitive path — ensure credential handling doesn't leak secrets in logs.
  • csi-agent/main.go changes from WrapNodeServerWithValidator to WrapNodeServer — verify this doesn't remove important request validation.

Suggestions:

  • The STS token exchange is a security-critical path. Add unit tests covering: successful OIDC exchange, expired token handling, invalid role ARN, and network failures.
  • Document the end-to-end flow: ServiceAccount → projected token → STS AssumeRoleWithOIDC → NAS access credentials.

Overall: Significant feature enabling fine-grained NAS access control via RRSA. The mounter refactoring is clean. Security-critical paths need thorough test coverage.

@mowangdk mowangdk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Summary: Adds NAS access point RRSA authentication support via OIDC token exchange, with a background refresh loop that keeps tokens fresh while the mount point is active.

Overall: Significant feature with good test coverage. Some concurrency and error handling concerns.

}

func (i *AlinasSecretInterceptor) startTokenRefreshLoop(op *mounterutils.MountRequest) {
if op == nil || op.Target == "" || op.AuthConfig == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The startTokenRefreshLoop goroutine runs forever with a 5-second ticker polling isMountPoint. This is a high polling frequency for a stat syscall. Consider using a longer interval (e.g., 30s-60s) since token refresh only needs to happen every ~5 minutes anyway, and the mount point check just gates the loop lifetime.

if err = handler(ctx, op); err != nil {
return
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go i.startTokenRefreshLoop(op) captures op by pointer. If the caller modifies op after Intercept returns, the goroutine will see the mutations. This is likely fine given the current calling pattern, but it's fragile. Consider copying the relevant fields (VolumeID, Target, AuthConfig) into the goroutine's closure.

return
}

cred := alicred.FromCredentialsProvider(provider.GetProviderName(), provider)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newSTSClient returns (nil, nil) when regionID is empty. Callers of NewAlinasSecretInterceptor will succeed, but later calls to refreshRRSAToken check i.stsClient == nil and just log an error without returning it clearly. The interceptor will silently fail token refresh. Consider returning an error from NewAlinasSecretInterceptor when regionID is empty but RRSA is expected, or make the nil-client path more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants