amazon-archives / aws-service-operator

AWS Service Operator allows you to create AWS resources using kubectl.
Apache License 2.0
732 stars 97 forks source link

Add bucket param to operator config args #194

Open ciaranRoche opened 5 years ago

ciaranRoche commented 5 years ago

Issue #, if available: https://github.com/awslabs/aws-service-operator/issues/193

Description of changes: This change adds the bucket param to the operator deployment config. It also makes a minor change to the documentation, removing the optional tag from creating an S3 bucket. As with out the use of an S3 bucket a user encounters a number of errors when creating the cloudformation templates.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

marcindulak commented 5 years ago

https://github.com/awslabs/aws-service-operator/blob/76312848693937324f5920d771cde1abe2f51fdd/configs/aws-service-operator.yaml is auto-generated from https://github.com/awslabs/aws-service-operator/blob/76312848693937324f5920d771cde1abe2f51fdd/code-generation/pkg/codegen/assets/aws-service-operator.yaml.templ (see https://github.com/awslabs/aws-service-operator/blob/master/development.adoc) so - --bucket=<BUCKET_NAME> needs to be added to the templ file too.

It may be worth removing the aws-operator default value (setting it to an empty string) from https://github.com/awslabs/aws-service-operator/blob/76312848693937324f5920d771cde1abe2f51fdd/cmd/aws-service-operator/main.go#L57

marcindulak commented 5 years ago

When providing a custom bucket in the --bucket=test-cluster-aws-service-operator-random-string, and applying a custom template with

kubectl -n aws-service-operator apply -f examples/cloudformationtemplates/dynamodb.yaml

the bucket stays empty and aws-service-operator logs

time="2019-06-28T20:00:12Z" level=error msg="error uploading cloudformation" error="NoSuchBucket: The specified bucket does not exist\n\tstatus code: 404, request id: 84A7357DF705903F, host id: XXX" hostname=aws-service-operator-865978fc59-x2njq

Moreover, changing the bucket name to something else that the default aws-operator and kubectl applying a custom cloudformationtemplate as above, results in aws-service-operator inability to create resources

kubectl -n aws-service-operator apply -f examples/dynamodb.yaml
MMartyn commented 5 years ago

I am trying to follow along, but it isn't clear to me. Should adding a bucket in us-east-1 work at this point?

marcindulak commented 5 years ago

If I remember well, using a custom bucket is not working.

MMartyn commented 5 years ago

If I remember well, using a custom bucket is not working.

OK, thanks. That is my experience as well.

Looking through the code if I had to guess it is because my bucket is private and it is trying to add these as public-read: https://github.com/awslabs/aws-service-operator/blob/master/pkg/customizations/cloudformationtemplate/cloudformationtemplate.go#L67