Skip to content

Commit

Permalink
Skip check to oauth_id/oauth_secret if using basic auth (kubeflow#2687)
Browse files Browse the repository at this point in the history
* use MkdirAll to silently succeed if file already exists

* disable client_id/client_secret check if using basic auth

* revert changes to go.sum
  • Loading branch information
gabrielwen authored and k8s-ci-robot committed Mar 13, 2019
1 parent 692fc8b commit 0de698e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bootstrap/pkg/client/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func (gcp *Gcp) generateDMConfigs(options map[string]interface{}) error {
// TODO(gabrielwen): Use YAML support instead of string replacement.
appDir := gcp.GcpApp.Spec.AppDir
gcpConfigDir := path.Join(appDir, GCP_CONFIG)
gcpConfigDirErr := os.Mkdir(gcpConfigDir, os.ModePerm)
gcpConfigDirErr := os.MkdirAll(gcpConfigDir, os.ModePerm)
if gcpConfigDirErr != nil {
return fmt.Errorf("cannot create directory %v", gcpConfigDirErr)
}
Expand Down Expand Up @@ -669,7 +669,7 @@ func (gcp *Gcp) generateDMConfigs(options map[string]interface{}) error {
func (gcp *Gcp) downloadK8sManifests() error {
appDir := gcp.GcpApp.Spec.AppDir
k8sSpecsDir := path.Join(appDir, K8S_SPECS)
k8sSpecsDirErr := os.Mkdir(k8sSpecsDir, os.ModePerm)
k8sSpecsDirErr := os.MkdirAll(k8sSpecsDir, os.ModePerm)
if k8sSpecsDirErr != nil {
return fmt.Errorf("cannot create directory %v Error %v", k8sSpecsDir, k8sSpecsDirErr)
}
Expand Down Expand Up @@ -783,7 +783,7 @@ func (gcp *Gcp) createSecrets(options map[string]interface{}) error {
} else {
oauthId = os.Getenv(CLIENT_ID)
}
if oauthId == "" {
if oauthId == "" && !gcp.GcpApp.Spec.UseBasicAuth {
return fmt.Errorf("At least one of --%v or ENV `%v` needs to be set.",
string(kftypes.OAUTH_ID), CLIENT_ID)
}
Expand All @@ -794,7 +794,7 @@ func (gcp *Gcp) createSecrets(options map[string]interface{}) error {
} else {
oauthSecret = os.Getenv(CLIENT_SECRET)
}
if oauthSecret == "" {
if oauthSecret == "" && !gcp.GcpApp.Spec.UseBasicAuth {
return fmt.Errorf("At least one of --%v or ENV `%v` needs to be set.",
string(kftypes.OAUTH_SECRET), CLIENT_SECRET)
}
Expand Down

0 comments on commit 0de698e

Please sign in to comment.