Skip to content

Commit c0b2541

Browse files
pooknullCopilotmayankshah1607hors
authored
K8SPSMDB-1448: sync user secrets with vault (#2121)
* K8SPSMDB-1448: sync user secrets with vault https://perconadev.atlassian.net/browse/K8SPSMDB-1448 * use `github.com/pkg/errors` * add `serviceAccountTokenPath` * Update pkg/apis/psmdb/v1/psmdb_defaults.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * `go mod tidy` * add `tlsSecret` field * use `errors.Wrap` * fix validation message * add unit-tests * fix users-vault test * improve validation * small fixes * small go mod change * add test cases * improve test * implement cached vault * fix tests * refactor * remove debug prints * small improvements * small fix * `make manifests` * fix unit-tests * address comments * return on logged error * fix cached vault * secret client per cluster + provider handler for future secret storages * mac fix * logging improvements * implement critical errors * fix wrapped errors * small fix * fix if condition * fix unit-tests * apply copilot suggestions * make `endpointURL` required * fix test * fix validation error * improve logs * continue reconcile on failed connection to the vault * small test fix * fix test * block reconcile when user secret doesn't exist * final fix for `users-vault` test --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Mayank Shah <mayank.shah@percona.com> Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 00affaf commit c0b2541

File tree

26 files changed

+1540
-151
lines changed

26 files changed

+1540
-151
lines changed

config/crd/bases/psmdb.percona.com_perconaservermongodbs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24852,6 +24852,29 @@ spec:
2485224852
- roles
2485324853
type: object
2485424854
type: array
24855+
vault:
24856+
properties:
24857+
endpointURL:
24858+
type: string
24859+
x-kubernetes-validations:
24860+
- message: endpointURL must be a valid URL
24861+
rule: isURL(self)
24862+
syncUsers:
24863+
properties:
24864+
keyPath:
24865+
type: string
24866+
mountPath:
24867+
type: string
24868+
role:
24869+
type: string
24870+
tokenSecret:
24871+
type: string
24872+
type: object
24873+
tlsSecret:
24874+
type: string
24875+
required:
24876+
- endpointURL
24877+
type: object
2485524878
required:
2485624879
- image
2485724880
type: object

deploy/bundle.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25711,6 +25711,29 @@ spec:
2571125711
- roles
2571225712
type: object
2571325713
type: array
25714+
vault:
25715+
properties:
25716+
endpointURL:
25717+
type: string
25718+
x-kubernetes-validations:
25719+
- message: endpointURL must be a valid URL
25720+
rule: isURL(self)
25721+
syncUsers:
25722+
properties:
25723+
keyPath:
25724+
type: string
25725+
mountPath:
25726+
type: string
25727+
role:
25728+
type: string
25729+
tokenSecret:
25730+
type: string
25731+
type: object
25732+
tlsSecret:
25733+
type: string
25734+
required:
25735+
- endpointURL
25736+
type: object
2571425737
required:
2571525738
- image
2571625739
type: object

deploy/cr.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ spec:
4949
apply: disabled
5050
schedule: "0 2 * * *"
5151
setFCV: false
52+
# vault:
53+
# endpointURL: https://vault-service:8200
54+
# tlsSecret: my-tls-vault-secret
55+
# syncUsers:
56+
# role: operator
57+
# mountPath: secrets
58+
# keyPath: psmdb/operator/namespace/my-cluster-name/users
59+
# tokenSecret: my-vault-sync-token-secret
5260
secrets:
5361
users: my-cluster-name-secrets
5462
encryptionKey: my-cluster-name-mongodb-encryption-key

deploy/crd.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25711,6 +25711,29 @@ spec:
2571125711
- roles
2571225712
type: object
2571325713
type: array
25714+
vault:
25715+
properties:
25716+
endpointURL:
25717+
type: string
25718+
x-kubernetes-validations:
25719+
- message: endpointURL must be a valid URL
25720+
rule: isURL(self)
25721+
syncUsers:
25722+
properties:
25723+
keyPath:
25724+
type: string
25725+
mountPath:
25726+
type: string
25727+
role:
25728+
type: string
25729+
tokenSecret:
25730+
type: string
25731+
type: object
25732+
tlsSecret:
25733+
type: string
25734+
required:
25735+
- endpointURL
25736+
type: object
2571425737
required:
2571525738
- image
2571625739
type: object

deploy/cw-bundle.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25711,6 +25711,29 @@ spec:
2571125711
- roles
2571225712
type: object
2571325713
type: array
25714+
vault:
25715+
properties:
25716+
endpointURL:
25717+
type: string
25718+
x-kubernetes-validations:
25719+
- message: endpointURL must be a valid URL
25720+
rule: isURL(self)
25721+
syncUsers:
25722+
properties:
25723+
keyPath:
25724+
type: string
25725+
mountPath:
25726+
type: string
25727+
role:
25728+
type: string
25729+
tokenSecret:
25730+
type: string
25731+
type: object
25732+
tlsSecret:
25733+
type: string
25734+
required:
25735+
- endpointURL
25736+
type: object
2571425737
required:
2571525738
- image
2571625739
type: object

0 commit comments

Comments
 (0)