forked from argoproj/argo-cd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(action): support refresh of ExternalSecret (argoproj#13951)
* feat(action): support refresh of ExternalSecret Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * fix test Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> --------- Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com>
- Loading branch information
1 parent
e8d526e
commit 87bd919
Showing
6 changed files
with
133 additions
and
5 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
resource_customizations/external-secrets.io/ExternalSecret/actions/action_test.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
actionTests: | ||
- action: refresh | ||
inputPath: testdata/external-secret.yaml | ||
expectedOutputPath: testdata/external-secret-updated.yaml |
3 changes: 3 additions & 0 deletions
3
resource_customizations/external-secrets.io/ExternalSecret/actions/discovery.lua
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
actions = {} | ||
actions["refresh"] = {["disabled"] = false} | ||
return actions |
6 changes: 6 additions & 0 deletions
6
resource_customizations/external-secrets.io/ExternalSecret/actions/refresh/action.lua
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
local os = require("os") | ||
if obj.metadata.annotations == nil then | ||
obj.metadata.annotations = {} | ||
end | ||
obj.metadata.annotations["force-sync"] = os.date("!%Y-%m-%dT%XZ") | ||
return obj |
56 changes: 56 additions & 0 deletions
56
...izations/external-secrets.io/ExternalSecret/actions/testdata/external-secret-updated.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: ExternalSecret | ||
metadata: | ||
annotations: | ||
force-sync: '0001-01-01T00:00:00Z' | ||
creationTimestamp: '2021-11-16T21:59:33Z' | ||
generation: 1 | ||
name: test-healthy | ||
namespace: argocd | ||
resourceVersion: '136487331' | ||
selfLink: /apis/external-secrets.io/v1alpha1/namespaces/argocd/externalsecrets/test-healthy | ||
uid: 1e754a7e-0781-4d57-932d-4651d5b19586 | ||
spec: | ||
data: | ||
- remoteRef: | ||
key: secret/sa/example | ||
property: api.address | ||
secretKey: url | ||
- remoteRef: | ||
key: secret/sa/example | ||
property: ca.crt | ||
secretKey: ca | ||
- remoteRef: | ||
key: secret/sa/example | ||
property: token | ||
secretKey: token | ||
refreshInterval: 1m | ||
secretStoreRef: | ||
kind: SecretStore | ||
name: example | ||
target: | ||
creationPolicy: Owner | ||
template: | ||
data: | ||
config: | | ||
{ | ||
"bearerToken": "{{ .token | base64decode | toString }}", | ||
"tlsClientConfig": { | ||
"insecure": false, | ||
"caData": "{{ .ca | toString }}" | ||
} | ||
} | ||
name: cluster-test | ||
server: '{{ .url | toString }}' | ||
metadata: | ||
labels: | ||
argocd.argoproj.io/secret-type: cluster | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2021-11-16T21:59:34Z' | ||
message: Secret was synced | ||
reason: SecretSynced | ||
status: 'True' | ||
type: Ready | ||
refreshTime: '2021-11-29T18:32:24Z' | ||
syncedResourceVersion: 1-519a61da0dc68b2575b4f8efada70e42 |
54 changes: 54 additions & 0 deletions
54
...e_customizations/external-secrets.io/ExternalSecret/actions/testdata/external-secret.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: ExternalSecret | ||
metadata: | ||
creationTimestamp: '2021-11-16T21:59:33Z' | ||
generation: 1 | ||
name: test-healthy | ||
namespace: argocd | ||
resourceVersion: '136487331' | ||
selfLink: /apis/external-secrets.io/v1alpha1/namespaces/argocd/externalsecrets/test-healthy | ||
uid: 1e754a7e-0781-4d57-932d-4651d5b19586 | ||
spec: | ||
data: | ||
- remoteRef: | ||
key: secret/sa/example | ||
property: api.address | ||
secretKey: url | ||
- remoteRef: | ||
key: secret/sa/example | ||
property: ca.crt | ||
secretKey: ca | ||
- remoteRef: | ||
key: secret/sa/example | ||
property: token | ||
secretKey: token | ||
refreshInterval: 1m | ||
secretStoreRef: | ||
kind: SecretStore | ||
name: example | ||
target: | ||
creationPolicy: Owner | ||
template: | ||
data: | ||
config: | | ||
{ | ||
"bearerToken": "{{ .token | base64decode | toString }}", | ||
"tlsClientConfig": { | ||
"insecure": false, | ||
"caData": "{{ .ca | toString }}" | ||
} | ||
} | ||
name: cluster-test | ||
server: '{{ .url | toString }}' | ||
metadata: | ||
labels: | ||
argocd.argoproj.io/secret-type: cluster | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2021-11-16T21:59:34Z' | ||
message: Secret was synced | ||
reason: SecretSynced | ||
status: 'True' | ||
type: Ready | ||
refreshTime: '2021-11-29T18:32:24Z' | ||
syncedResourceVersion: 1-519a61da0dc68b2575b4f8efada70e42 |
This file contains 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