Skip to content
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

Provisioning fails if helm chart installed with aws.key="" #252

Open
mkhattab opened this issue Mar 26, 2022 · 0 comments
Open

Provisioning fails if helm chart installed with aws.key="" #252

mkhattab opened this issue Mar 26, 2022 · 0 comments

Comments

@mkhattab
Copy link

mkhattab commented Mar 26, 2022

Describe the bug

The following assumes the service broker is configured to use a custom S3 bucket. If the aws.key field during helm install is set to an empty string, i.e.

helm install aws-sb aws-sb/aws-servicebroker \
    # other options ...
    --set aws.key=""

Provisioning will fail with the following message (in the logs):

Failed to create the CloudFormation stack: ValidationError: S3 error: Access Denied

I believe I have narrowed to this specific line:

bl := AwsBroker{
        ...
	s3key:   addTrailingSlash(o.S3Key),   // This sets s3key: "/" if o.S3Key = ""
        ...
}

I think the fix in addTrailingSlash should check if the string is empty before adding a trailing slash.

func addTrailingSlash(s string) string {
	if s != "" && strings.HasSuffix(s, "/") == false {  // add check to make sure `s` is not empty
		s = s + "/"
	}
	return s
}

It's probably a good idea to trim whitespace here as well, although not sure if it's necessary (just thinking defensively).

To Reproduce

Install helm chart with --set aws.key=""

Expected behavior

Should provision resources normally.

Screenshots

None

Environment (please complete the following information):

  • Application Platform: [Kubernetes]
  • Application Platform Version: [e.g. k8s 1.21.10]
  • Broker Version [e.g. v1.0.4]

Additional context

Nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant