From d22be2e86d77545ba4ef07ac239e7e84daf3c76e Mon Sep 17 00:00:00 2001 From: Daniel Kovacs Date: Thu, 22 Jul 2021 13:10:42 +1000 Subject: [PATCH 1/2] aws-bugfix: aws_config directory related error messages are now displayed correctly --- pkg/kfapp/aws/aws.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/kfapp/aws/aws.go b/pkg/kfapp/aws/aws.go index c6bd8e5d3..b201cc1f7 100644 --- a/pkg/kfapp/aws/aws.go +++ b/pkg/kfapp/aws/aws.go @@ -308,7 +308,11 @@ func (aws *Aws) generateInfraConfigs() error { log.Infof("Creating AWS infrastructure configs in directory %v", destDir) destDirErr := os.MkdirAll(destDir, os.ModePerm) if destDirErr != nil { - return destDirErr + return &kfapis.KfError{ + Code: destDirErr.(*kfapis.KfError).Code, + Message: fmt.Sprintf("Could not create directory %v: %v", + destDir, destDirErr.(*kfapis.KfError).Message), + } } } else { log.Infof("AWS infrastructure configs already exist in directory %v", destDir) @@ -317,7 +321,11 @@ func (aws *Aws) generateInfraConfigs() error { // List all the files under source directory files, err := ioutil.ReadDir(sourceDir) if err != nil { - return err + return &kfapis.KfError{ + Code: err.(*kfapis.KfError).Code, + Message: fmt.Sprintf("Could not list files in source directory %v: %v", + sourceDir, err.(*kfapis.KfError).Message), + } } for _, file := range files { @@ -927,7 +935,7 @@ func (aws *Aws) deleteIamRolePolicy(roleName, policyName string) error { // attachIamInlinePolicy attach inline policy to IAM role func (aws *Aws) attachIamInlinePolicy(roleName, policyName, policyDocumentPath string) error { - log.Infof("Attaching inline policy %s for iam role %s", policyName, roleName) + log.Infof("Attaching inline policy %s for iam role %s: from file: %s", policyName, roleName, policyDocumentPath) policyDocumentJSONBytes, _ := ioutil.ReadFile(policyDocumentPath) input := &iam.PutRolePolicyInput{ From 32e6ec7c2eaab29dee1d09df7921c42c13ac5a7f Mon Sep 17 00:00:00 2001 From: Daniel Kovacs Date: Thu, 22 Jul 2021 19:52:35 +1000 Subject: [PATCH 2/2] bugfix: kfctl is now correctly looking for aws/infra_configs under `distributions`, where it has moved in kubeflow/manifests. --- pkg/kfapp/aws/aws.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/kfapp/aws/aws.go b/pkg/kfapp/aws/aws.go index b201cc1f7..0605cba62 100644 --- a/pkg/kfapp/aws/aws.go +++ b/pkg/kfapp/aws/aws.go @@ -56,7 +56,7 @@ const ( PATH = "path" BASIC_AUTH_SECRET = "kubeflow-login" // Path in manifests repo to where the additional configs are located - CONFIG_LOCAL_PATH = "aws/infra_configs" + CONFIG_LOCAL_PATH = "distributions/aws/infra_configs" ALB_OIDC_SECRET = "alb-oidc-secret" @@ -308,6 +308,7 @@ func (aws *Aws) generateInfraConfigs() error { log.Infof("Creating AWS infrastructure configs in directory %v", destDir) destDirErr := os.MkdirAll(destDir, os.ModePerm) if destDirErr != nil { + log.Errorf("There was a problem creating the directory; %v", destDirErr) return &kfapis.KfError{ Code: destDirErr.(*kfapis.KfError).Code, Message: fmt.Sprintf("Could not create directory %v: %v", @@ -319,8 +320,10 @@ func (aws *Aws) generateInfraConfigs() error { } // List all the files under source directory + log.Infof("Reading source directory: %v", sourceDir) files, err := ioutil.ReadDir(sourceDir) if err != nil { + log.Errorf("There was a problem reading the source directory; %v", err) return &kfapis.KfError{ Code: err.(*kfapis.KfError).Code, Message: fmt.Sprintf("Could not list files in source directory %v: %v", @@ -328,11 +331,13 @@ func (aws *Aws) generateInfraConfigs() error { } } + log.Infof("Copying aws_config files...") for _, file := range files { sourceFile := filepath.Join(sourceDir, file.Name()) destFile := filepath.Join(destDir, file.Name()) copyErr := copyFile(sourceFile, destFile) if copyErr != nil { + log.Errorf("There was a problem copying file: %v to %v: %v", sourceFile, destFile, copyErr) return &kfapis.KfError{ Code: copyErr.(*kfapis.KfError).Code, Message: fmt.Sprintf("Could not copy %v to %v: %v", @@ -343,6 +348,7 @@ func (aws *Aws) generateInfraConfigs() error { // 2. Reading from cluster_config.yaml and replace placeholders with values in aws.kfDef.Spec. clusterConfigFile := filepath.Join(destDir, CLUSTER_CONFIG_FILE) + log.Infof("Updating cluster_config from file: %v", clusterConfigFile) if err := aws.updateClusterConfig(clusterConfigFile); err != nil { return err }