Skip to content

Commit

Permalink
Merge pull request #74 from intelops/cluster-auth-login
Browse files Browse the repository at this point in the history
add cluster auth login path
  • Loading branch information
vramk23 authored Jan 27, 2024
2 parents 1193387 + 591d3fd commit da32e97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/api/types.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package api

const (
vaultPolicyReadPath = `path "secret/data/%s" {capabilities = ["read"]}`
vaultPolicyWritePath = `path "secret/data/%s" {capabilities = ["create","read","update","delete","list"]}`
vaultPolicyReadPath = `path "secret/data/%s" {capabilities = ["read"]}`
vaultPolicyWritePath = `path "secret/data/%s" {capabilities = ["create","read","update","delete","list"]}`
vaultPolicyClusterAuthPath = `path "auth/k8s-%s/login" {capabilities = ["create","read","update"]}`
)
2 changes: 2 additions & 0 deletions internal/api/vault_k8s_role_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func (v *VaultCredServ) CreateK8SAuthRole(ctx context.Context, request *vaultcre
}
policyData = policyData + "\n" + credPathPolicy
}
clusterAuthLoginPath := fmt.Sprintf(vaultPolicyClusterAuthPath, request.ClusterName)
policyData = policyData + "\n" + clusterAuthLoginPath

policyName := "policy-" + request.ClusterName + "-" + request.RoleName
err = vc.CreateOrUpdatePolicy(policyName, policyData)
Expand Down

0 comments on commit da32e97

Please sign in to comment.