Skip to content

feat(secretstores): Add Akeyless Secretstore - #4385

Open
kgal-akl wants to merge 10 commits into
dapr:mainfrom
akeylesslabs:add-akeyless-secretstore
Open

feat(secretstores): Add Akeyless Secretstore#4385
kgal-akl wants to merge 10 commits into
dapr:mainfrom
akeylesslabs:add-akeyless-secretstore

Conversation

@kgal-akl

Copy link
Copy Markdown

Description

continuation of #4036.

Issue reference

Please reference the issue this PR will close: #4063

Checklist

kgal-akl and others added 3 commits March 5, 2026 21:36
Signed-off-by: Kobbi Gal <kobbi.g@akeyless.io>
Signed-off-by: Kobbi Gal <195813801+kgal-akl@users.noreply.github.com>
Signed-off-by: Kobbi Gal <195813801+kgal-akl@users.noreply.github.com>
@kgal-akl
kgal-akl requested review from a team as code owners May 12, 2026 18:43
kgal-akl added 2 commits May 12, 2026 14:46
Signed-off-by: Kobbi Gal <195813801+kgal-akl@users.noreply.github.com>
Signed-off-by: Kobbi Gal <195813801+kgal-akl@users.noreply.github.com>
@dapr-bot

Copy link
Copy Markdown
Collaborator

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@dapr-bot dapr-bot added the stale label Jun 11, 2026
Signed-off-by: kgal-akl <kobbi.g@akeyless.io>
@kgal-akl kgal-akl changed the title Add Akeyless Secretstore feat(secretstores): Add Akeyless Secretstore Jun 15, 2026
@kgal-akl

Copy link
Copy Markdown
Author

/ok-to-test

@kgal-akl

Copy link
Copy Markdown
Author

@cicoyle @sicoyle can we please get this reviewed?

@sicoyle sicoyle 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.

first round of feedback from me - thank you!!!

Comment thread secretstores/akeyless/metadata.yaml Outdated
type: secretstores
name: akeyless
version: v1
status: beta

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.

typically when we introduce new components we make them alpha

Suggested change
status: beta
status: alpha

urls:
- title: Reference
url: https://docs.dapr.io/reference/components-reference/supported-secret-stores/akeyless/
metadata:

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.

pls mv the auth related fields into an authenticationProfiles: section similar to that of here https://github.com/dapr/components-contrib/blob/main/pubsub/kafka/metadata.yaml#L72

Comment thread secretstores/akeyless/metadata.yaml Outdated
- name: k8sAuthConfigName
required: false
description: |
If using the k8s auth method, specify the name of the k8s auth config.

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.

is this referring to ~/.kube/config or a config map? This is not clear to me. Please adjust to be clearer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

it's a config that includes some metadata the k8s service account jwt used for tokenreview api.
see https://docs.akeyless.io/docs/auth-with-kubernetes#create-kubernetes-gateway-auth-config-using-gateway-serviceaccount.

Comment thread secretstores/akeyless/metadata.yaml Outdated
example: "eyJ..."
type: string
sensitive: true
- name: k8sAuthConfigName

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.

duplicate

Comment thread secretstores/akeyless/metadata.yaml Outdated
Comment on lines +86 to +96
example: "k8s-auth-config"
type: string
- name: k8sGatewayUrl
required: false
description: |
The gateway URL that where the k8s auth config is located.
example: "https://gw.akeyless.svc.cluster.local"
type: string
- name: k8sServiceAccountToken
required: false
description: |

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.

rest of these are dupes

Comment thread secretstores/akeyless/utils.go Outdated
authRequest.SetK8sServiceAccountToken(metadata.K8sServiceAccountToken)

if metadata.K8SGatewayURL == "" {
a.logger.Debug("k8s gateway url is missing, using gatewayUrl")

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.

Suggested change
a.logger.Debug("k8s gateway url is missing, using gatewayUrl")
a.logger.Debug("k8s gateway url is missing, using default")

?

Comment thread secretstores/akeyless/utils.go Outdated
func parseSecretTypes(secretTypes string) ([]string, error) {
// Handle "all" or empty string which returns all supported secret types
if secretTypes == AllSecretTypes || secretTypes == "" {
return supportedSecretTypes, 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.

Suggested change
return supportedSecretTypes, nil
return return append([]string(nil), supportedSecretTypes...), nil

Comment thread secretstores/akeyless/utils.go Outdated
Comment on lines +262 to +263
return nil, errors.New("no secret types provided")
}

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.

strings.Split returns [""] in an empty case so this is unreachable - pls rm

Comment thread secretstores/akeyless/akeyless.go Outdated
}

// startTokenRefreshRoutine starts a bg goroutine that refreshes the token
func (a *akeylessSecretStore) startTokenRefreshRoutine(ctx context.Context, metadata *akeylessMetadata) {

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.

is ctx used?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

removed as part of #4385 (comment).

Comment thread secretstores/akeyless/akeyless.go Outdated

refreshDuration := time.Until(expiry.Add(-TokenRefreshGracePeriod))
if refreshDuration <= 0 {
refreshDuration = time.Minute // Refresh immediately if less than 1 minute left

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.

pls double check with the aws x509 refresher at components-contrib/common/aws/auth/auth_x509.go and make sure the time choice and such you have here aligns nicely

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

aws cert refresh is lazy loaded. changed proactive approach to lazy load (store token in secretstore instance, check if valid (> 1m), if not, refresh). simplified flow so secret store apis call sdk directly (rm retry with 401) after token validity check. addressed in 09036f2.

kgal-akl and others added 2 commits June 17, 2026 17:03
Restructure metadata with authenticationProfiles, set status to alpha,
and nest Kubernetes auth fields in akeylessK8sAuth.

Signed-off-by: Kobbi Gal <195813801+kgal-akl@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Rename constants with prefix-first naming, introduce SecretType and
SecretResponse types, simplify stringifyStaticSecret, and split utils.go
into auth.go, constants.go, secrets.go, and tls.go.

Signed-off-by: Kobbi Gal <195813801+kgal-akl@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@kgal-akl

Copy link
Copy Markdown
Author

Addressed the remaining utils.go review feedback in akeylesslabs@e445b1be:

  • Split utils.go into auth.go, constants.go, secrets.go, and tls.go
  • Renamed constants with prefix-first naming (e.g. SecretResponseStatic, SecretTypeStatic, AuthTypeAccessKey)
  • Introduced typed SecretResponse and SecretType to avoid mixing API response values with metadata types
  • Simplified stringifyStaticSecret and return an error on nil secret values
  • Extracted producer/rotator status strings and the K8s service account token path to constants
  • Returned a defensive copy from parseSecretTypes and removed unreachable post-strings.Split code

Prior commits on this branch also cover the metadata/README/auth-profile changes, lazy token refresh, and removal of proactive background refresh / executeWithRetryOn401.

Docs PR update is still pending separately.

@kgal-akl
kgal-akl requested a review from sicoyle June 17, 2026 21:29
@kgal-akl

Copy link
Copy Markdown
Author

@sicoyle changes addressed, please review again 🙏

@dapr-bot

Copy link
Copy Markdown
Collaborator

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@dapr-bot dapr-bot added the stale label Jul 19, 2026
@mikeee

mikeee commented Jul 25, 2026

Copy link
Copy Markdown
Member

@kgal-akl - before I review; could you please address the conflicts! Sorry about this.

@dapr-bot dapr-bot removed the stale label Jul 25, 2026
Signed-off-by: kgal-akl <kobbi.g@akeyless.io>
@kgal-akl

kgal-akl commented Jul 27, 2026

Copy link
Copy Markdown
Author

@kgal-akl - before I review; could you please address the conflicts! Sorry about this.

@mikeee done.

Copilot AI 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.

Pull request overview

Adds a new Akeyless implementation of the Dapr Secret Store component, including client auth handling, TLS support for custom gateway CAs, component metadata/docs, and a comprehensive test suite.

Changes:

  • Introduces the secretstores/akeyless component implementation (auth, secret retrieval, bulk listing, TLS helper, constants).
  • Adds component docs (README.md) and component metadata (metadata.yaml) for configuration/auth profiles.
  • Adds unit/integration-style tests using httptest plus new Go module dependencies for the Akeyless SDK.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
secretstores/akeyless/akeyless.go Main secret store implementation (init/auth, GetSecret, BulkGetSecret, token refresh, list/filter logic).
secretstores/akeyless/auth.go Auth helpers (accessId parsing/type detection, k8s auth config, token expiry parsing).
secretstores/akeyless/constants.go Component constants and supported secret types.
secretstores/akeyless/secrets.go Secret type parsing, static secret stringification, and secret “active” filtering logic.
secretstores/akeyless/tls.go TLS config builder from base64-encoded PEM CA.
secretstores/akeyless/akeyless_test.go Test suite using mock gateways and token refresh coverage.
secretstores/akeyless/README.md End-user documentation and configuration examples.
secretstores/akeyless/metadata.yaml Component metadata schema (fields + auth profiles).
go.mod Adds Akeyless SDK deps; updates Azure SDK versions.
go.sum Dependency checksum updates corresponding to go.mod changes.
Comments suppressed due to low confidence (1)

secretstores/akeyless/akeyless.go:313

  • This inline comment says only static secrets are supported for bulk get, but the code immediately retrieves dynamic and rotated secrets too. Keeping this comment accurate helps prevent future regressions.
	// separate items by type since only static secrets are supported for bulk get
	staticItemNames, dynamicItemNames, rotatedItemNames := a.separateItemsByType(listItems)
	a.logger.Infof("%d items returned (static: %d, dynamic: %d, rotated: %d)", len(listItems), len(staticItemNames), len(dynamicItemNames), len(rotatedItemNames))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +266 to +273
if value, ok := req.Metadata[MetadataKeyPath]; ok {
// normalize path
if !strings.HasPrefix(value, "/") {
secretsPath = "/" + value
}

a.logger.Debugf("using path '%s' from metadata...", secretsPath)
} else {
Comment thread secretstores/akeyless/akeyless.go
Comment thread secretstores/akeyless/akeyless.go
Comment thread secretstores/akeyless/secrets.go
Comment thread secretstores/akeyless/secrets.go
Comment thread secretstores/akeyless/akeyless_test.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: kgal-akl <kobbi.g@akeyless.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Akeyless Secret Store Component

5 participants