-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: read dex clientSecret from argocd-secret #847
Conversation
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with a minor comment.
@@ -164,7 +160,7 @@ func (r *ReconcileArgoCD) getOpenShiftDexConfig(cr *argoprojv1a1.ArgoCD) (string | |||
Config: map[string]interface{}{ | |||
"issuer": "https://kubernetes.default.svc", // TODO: Should this be hard-coded? | |||
"clientID": getDexOAuthClientID(cr), | |||
"clientSecret": *clientSecret, | |||
"clientSecret": "$oidc.dex.clientSecret", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have defined the ArgoCDDexSecretKey
constant already, would it make sense to use it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and works for me! The original request was that the user wished that the token would not be exposed as that is a security concern, but an additional issue we were running into was that even writing the clientSecret in a variable was getting overwritten during reconciliation. With this PR even if the user wishes to change their secret, they can do so in argocd-secret and it won't get overwritten. Two birds with one stone- thanks Abhishek! :D
@@ -228,4 +228,7 @@ const ( | |||
|
|||
// ArgoCDServerClusterRoleEnvName is an environment variable to specify a custom cluster role for Argo CD server | |||
ArgoCDServerClusterRoleEnvName = "SERVER_CLUSTER_ROLE" | |||
|
|||
// ArgoCDDexSecretKey is used to reference Dex secret from Argo CD secret into Argo CD configmap | |||
ArgoCDDexSecretKey = "oidc.dex.clientSecret" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be $oidc.dex.clientSecret
?
Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com>
* feat: read dex clientSecret from argocd-secret Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com> * chore: add example file for dex openshift connector Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com> * fix: upgrade path and unit tests Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com> --------- Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com> Signed-off-by: Yi Cai <yicai@redhat.com>
Signed-off-by: iam-veeramalla abhishek.veeramalla@gmail.com
What type of PR is this?
What does this PR do / why we need it:
This PR will introduce a behavioral change in the way operator configures Dex for OpenShift connector.
Currently, Operator configures dex openshift connector to the Argo CD Instance when
.spec.dex.OpenShiftOAuth: true
&&.spec.provider: dex
. While this configuration works as expected, the oidc configuration which includes theclientSecret
is placed in the configmap as plain text. This can be a security risk.Once this PR is merged, operator will provide the reference of the
clientSecret
in the configmap and not the actual secret. Argo CD Server will read thisclientSecret
reference fromargocd-secret
.The new configuration will look something like below
kubectl get cm argocd-cm -oyaml
Have you updated the necessary documentation?
NA
How to test changes / Special notes to the reviewer:
make install run
clientSecret
is not comprised but is just a reference to theoidc.dex.clientSecret
inargocd-secret
.