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(health): add PushSecret health status and force-sync action (arg…
…oproj#14375) * feat(health): add `PushSecret` health status Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * add status healthy Signed-off-by: Alexandre Gaudreault <alexandre.gaudreault@logmein.com> * Push action 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
3962597
commit af4034d
Showing
11 changed files
with
223 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
resource_customizations/external-secrets.io/PushSecret/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: push | ||
inputPath: testdata/push-secret.yaml | ||
expectedOutputPath: testdata/push-secret-updated.yaml |
3 changes: 3 additions & 0 deletions
3
resource_customizations/external-secrets.io/PushSecret/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["push"] = {["disabled"] = false} | ||
return actions |
6 changes: 6 additions & 0 deletions
6
resource_customizations/external-secrets.io/PushSecret/actions/push/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 |
41 changes: 41 additions & 0 deletions
41
...e_customizations/external-secrets.io/PushSecret/actions/testdata/push-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,41 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: PushSecret | ||
metadata: | ||
annotations: | ||
force-sync: '0001-01-01T00:00:00Z' | ||
creationTimestamp: '2023-07-05T20:49:16Z' | ||
generation: 1 | ||
name: test-healthy | ||
namespace: external-secret | ||
resourceVersion: '777692391' | ||
uid: 88cb613a-07b0-4fb2-8fdb-d5a5a9c2c917 | ||
spec: | ||
data: | ||
- match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test | ||
deletionPolicy: None | ||
refreshInterval: 5m | ||
secretStoreRefs: | ||
- kind: ClusterSecretStore | ||
name: my-store | ||
selector: | ||
secret: | ||
name: existing-secret | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2023-07-05T20:49:16Z' | ||
message: PushSecret synced successfully | ||
reason: Synced | ||
status: 'True' | ||
type: Ready | ||
syncedPushSecrets: | ||
ClusterSecretStore/my-store: | ||
remote/path/test: | ||
match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test |
39 changes: 39 additions & 0 deletions
39
resource_customizations/external-secrets.io/PushSecret/actions/testdata/push-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,39 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: PushSecret | ||
metadata: | ||
creationTimestamp: '2023-07-05T20:49:16Z' | ||
generation: 1 | ||
name: test-healthy | ||
namespace: external-secret | ||
resourceVersion: '777692391' | ||
uid: 88cb613a-07b0-4fb2-8fdb-d5a5a9c2c917 | ||
spec: | ||
data: | ||
- match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test | ||
deletionPolicy: None | ||
refreshInterval: 5m | ||
secretStoreRefs: | ||
- kind: ClusterSecretStore | ||
name: my-store | ||
selector: | ||
secret: | ||
name: existing-secret | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2023-07-05T20:49:16Z' | ||
message: PushSecret synced successfully | ||
reason: Synced | ||
status: 'True' | ||
type: Ready | ||
syncedPushSecrets: | ||
ClusterSecretStore/my-store: | ||
remote/path/test: | ||
match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test |
20 changes: 20 additions & 0 deletions
20
resource_customizations/external-secrets.io/PushSecret/health.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,20 @@ | ||
hs = {} | ||
if obj.status ~= nil then | ||
if obj.status.conditions ~= nil then | ||
for i, condition in ipairs(obj.status.conditions) do | ||
if condition.type == "Ready" and condition.status == "False" then | ||
hs.status = "Degraded" | ||
hs.message = condition.message | ||
return hs | ||
end | ||
if condition.type == "Ready" and condition.status == "True" then | ||
hs.status = "Healthy" | ||
hs.message = condition.message | ||
return hs | ||
end | ||
end | ||
end | ||
end | ||
hs.status = "Progressing" | ||
hs.message = "Waiting for PushSecret" | ||
return hs |
13 changes: 13 additions & 0 deletions
13
resource_customizations/external-secrets.io/PushSecret/health_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,13 @@ | ||
tests: | ||
- healthStatus: | ||
status: Progressing | ||
message: Waiting for PushSecret | ||
inputPath: testdata/progressing.yaml | ||
- healthStatus: | ||
status: Degraded | ||
message: 'set secret failed: could not write remote ref test to target secretstore my-store: Error making API request.' | ||
inputPath: testdata/degraded.yaml | ||
- healthStatus: | ||
status: Healthy | ||
message: 'PushSecret synced successfully' | ||
inputPath: testdata/healthy.yaml |
33 changes: 33 additions & 0 deletions
33
resource_customizations/external-secrets.io/PushSecret/testdata/degraded.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,33 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: PushSecret | ||
metadata: | ||
creationTimestamp: '2023-07-05T20:49:16Z' | ||
generation: 1 | ||
name: test-degraded | ||
namespace: external-secret | ||
resourceVersion: '777692391' | ||
uid: 88cb613a-07b0-4fb2-8fdb-d5a5a9c2c917 | ||
spec: | ||
data: | ||
- match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test | ||
deletionPolicy: None | ||
refreshInterval: 5m | ||
secretStoreRefs: | ||
- kind: ClusterSecretStore | ||
name: my-store | ||
selector: | ||
secret: | ||
name: existing-secret | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2023-07-05T20:49:16Z' | ||
message: 'set secret failed: could not write remote ref test to target secretstore my-store: Error making API request.' | ||
reason: Errored | ||
status: 'False' | ||
type: Ready | ||
syncedPushSecrets: | ||
ClusterSecretStore/my-store: {} |
39 changes: 39 additions & 0 deletions
39
resource_customizations/external-secrets.io/PushSecret/testdata/healthy.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,39 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: PushSecret | ||
metadata: | ||
creationTimestamp: '2023-07-05T20:49:16Z' | ||
generation: 1 | ||
name: test-healthy | ||
namespace: external-secret | ||
resourceVersion: '777692391' | ||
uid: 88cb613a-07b0-4fb2-8fdb-d5a5a9c2c917 | ||
spec: | ||
data: | ||
- match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test | ||
deletionPolicy: None | ||
refreshInterval: 5m | ||
secretStoreRefs: | ||
- kind: ClusterSecretStore | ||
name: my-store | ||
selector: | ||
secret: | ||
name: existing-secret | ||
status: | ||
conditions: | ||
- lastTransitionTime: '2023-07-05T20:49:16Z' | ||
message: PushSecret synced successfully | ||
reason: Synced | ||
status: 'True' | ||
type: Ready | ||
syncedPushSecrets: | ||
ClusterSecretStore/my-store: | ||
remote/path/test: | ||
match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test |
24 changes: 24 additions & 0 deletions
24
resource_customizations/external-secrets.io/PushSecret/testdata/progressing.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,24 @@ | ||
apiVersion: external-secrets.io/v1alpha1 | ||
kind: PushSecret | ||
metadata: | ||
creationTimestamp: '2023-07-05T20:49:16Z' | ||
generation: 1 | ||
name: test-progressing | ||
namespace: external-secret | ||
resourceVersion: '777692391' | ||
uid: 88cb613a-07b0-4fb2-8fdb-d5a5a9c2c917 | ||
spec: | ||
data: | ||
- match: | ||
remoteRef: | ||
property: test | ||
remoteKey: remote/path | ||
secretKey: test | ||
deletionPolicy: None | ||
refreshInterval: 5m | ||
secretStoreRefs: | ||
- kind: ClusterSecretStore | ||
name: my-store | ||
selector: | ||
secret: | ||
name: existing-secret |
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