-
Notifications
You must be signed in to change notification settings - Fork 111
Add Identity Provider CA to kubeconfig #149
base: master
Are you sure you want to change the base?
Conversation
This change enables usage of self signed cert for the IdP by providing a config `idpCAPath` in the config map. Closes: vmware-archive#148 Signed-off-by: Vijay Katam <[email protected]>
@@ -63,7 +63,8 @@ kubectl config set-credentials "{{ .KubeCfgUser }}" \ | |||
--auth-provider-arg='client-id={{ .ClientID }}' \ | |||
--auth-provider-arg='client-secret={{ .ClientSecret }}' \ | |||
--auth-provider-arg='refresh-token={{ .RefreshToken }}' \ | |||
--auth-provider-arg='id-token={{ .IDToken }}' | |||
--auth-provider-arg='id-token={{ .IDToken }}' \ | |||
--auth-provider-arg='idp-certificate-authority-data={{ .IdentityProviderCA }}' \ |
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.
If idp-certificate-authority-data
is empty it is ignored.
Signed-off-by: Vijay Katam <[email protected]>
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.
Comment left.
if cfg.IdentityProviderCAPath != "" { | ||
caFile, err := os.Open(cfg.IdentityProviderCAPath) | ||
if err != nil { | ||
log.Errorf("Failed to open CA file. %s", err.Error()) |
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.
log.Errorf("Failed to open CA file. %s", err.Error()) | |
log.Errorf("Failed to open CA file. %s", err) |
defer caFile.Close() | ||
idpCA, err := ioutil.ReadAll(caFile) | ||
if err != nil { | ||
log.Errorf("Could not read CA file: %s", err.Error()) |
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.
log.Errorf("Could not read CA file: %s", err.Error()) | |
log.Errorf("Could not read CA file: %s", err) |
log.Errorf("Could not read CA file: %s", err) | ||
http.Error(w, "Could not read CA file", http.StatusInternalServerError) | ||
return nil |
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.
This change make go test
failed. Consider leave it as it was or update the testing code.
|
||
# The path to find the CA bundle for the IdP, optional. Used to configure kubectl. | ||
# Env var: GANGWAY_IDP_CA_PATH | ||
# idpCAPath: "/cacerts/idpca.cert" |
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.
configuration doc should be updated also.
From my point of view, IdentityProviderCA is the same as TrustedCAPath since it should both points the same server, am I right? If yes, then all we have to do is embed the |
Any plans to finish this PR? |
Hey @vijaykatam would you mind rebasing this as well as looking at the comments + failing tests? Thanks! |
This change enables usage of self signed cert for the IdP by providing
a config
idpCAPath
in the config map.Signed-off-by: Vijay Katam [email protected]
Closes: #148