-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Reconcile Dex client secret when .spec.dex is set (#877)
Signed-off-by: jannfis <jann@mistrust.net>
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
tests/ocp/1-005_validate_dex_clientsecret_deprecated/01-assert.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,15 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestAssert | ||
timeout: 120 | ||
--- | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ArgoCD | ||
metadata: | ||
name: example-argocd | ||
status: | ||
phase: Available | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: example-argocd-argocd-dex-server |
7 changes: 7 additions & 0 deletions
7
tests/ocp/1-005_validate_dex_clientsecret_deprecated/01-install.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,7 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ArgoCD | ||
metadata: | ||
name: example-argocd | ||
spec: | ||
dex: | ||
openShiftOAuth: true |
19 changes: 19 additions & 0 deletions
19
tests/ocp/1-005_validate_dex_clientsecret_deprecated/02-verify-clientsecret.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,19 @@ | ||
apiVersion: kuttl.dev/v1beta1 | ||
kind: TestStep | ||
commands: | ||
- script: | | ||
# This test validates the Dex Client Secret copied by the operator from dex serviceaccount token secret in to argocd-secret. | ||
# To verify the behavior we should first get the token secret name of the dex service account. | ||
secret=$(oc get -n $NAMESPACE sa example-argocd-argocd-dex-server -o json | jq -r '.secrets' | grep token | sed 's/ "name": "//g' | sed 's/"//g') | ||
# Extract the clientSecret | ||
expectedClientSecret=$(oc get secret $secret -n $NAMESPACE -o json | jq -r '.data.token') | ||
# actualClientSecret is the value of the secret in argocd-secret where argocd-operator should copy the secret from | ||
actualClientSecret=$(oc get secret argocd-secret -o json -n $NAMESPACE | jq -r '.data."oidc.dex.clientSecret"') | ||
# Verify | ||
if $expectedClientSecret != $actualClientSecret; then | ||
echo "Error: Dex Client Secret for OIDC is not valid" | ||
exit 1 | ||
fi |