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

[BACKWARDS INCOMPATIBLE] S3 env var #250

Merged
merged 4 commits into from
Feb 21, 2023
Merged

[BACKWARDS INCOMPATIBLE] S3 env var #250

merged 4 commits into from
Feb 21, 2023

Conversation

jhsinger-klotho
Copy link
Contributor

• Does any part of it require special attention?
• Does it relate to or fix any issue? closes #227 and closes https://github.com/klothoplatform/klotho-pro/issues/51

Changes our logic so that we create a bucket per ID with an FS annotation. We also create a new InternalResource concept so that we can track the resource we use for proxy/dispatcher (payloads bucket)

We use env vars to inject the bucket names into the fs runtime and we have a file per bucket at the moment. Opened #249 as an enhancement so we can limit the number of runtime files in the future.

We also can fully do sanitization at the IAC layer and now our payloads bucket will have the wording InternalKlothoPayloads.

opened klotho #247 because we cant fully remove the payloads bucket from template config until we take out the hardcoding from pubsub

Standard checks

Further testing https://github.com/klothoplatform/klotho/actions/runs/4198937619

  • Unit tests: Any special considerations? changed some of the transform ones where possible
  • Docs: Do we need to update any docs, internal or public? Im not sure because we never documented that we dont create multiple buckets
  • Backwards compatibility: Will this break existing apps? If so, what would be the extra work required to keep them working? No. This is none and stated in the task, we will need to send out an email

@@ -97,7 +99,7 @@ func (r *AwsRuntime) TransformPersist(file *core.SourceFile, annot *core.Annotat
importModule := ""
switch kind {
case core.PersistFileKind:
importModule = "fs"
importModule = "fs_" + annot.Capability.ID
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be sanitized? I forget what (if any) restrictions we enforce on ids.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is just for the import itself in the file. I cut a card so that we actually just pass the bucket name to the open call, but that requires a lot of extra work, so for now we are just importing an fs runtime per bucket and thats why we need different import modules

}

fsEnvVar := core.EnvironmentVariable{
Name: cap.Capability.ID + "_bucket_name",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto on sanitization here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name is just the env var name, so it doesnt go through sanitization. The actual bucket name will be the value and that is dynamically generated based on the sanitized bucket name

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do annotation ids have any restriction, do you know offhand? For example, can they contain spaces? (afaik, an env var can't.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the annotation ids are the same regex as the app name, so i believe that it should be valid env vars.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot to change the radio box to "Approve" when I submitted the previous review. Neither of my comments is blocking.

@github-actions
Copy link

Package Line Rate Health
github.com/klothoplatform/klotho/pkg/analytics 3%
github.com/klothoplatform/klotho/pkg/annotation 23%
github.com/klothoplatform/klotho/pkg/cli 4%
github.com/klothoplatform/klotho/pkg/core 21%
github.com/klothoplatform/klotho/pkg/env_var 82%
github.com/klothoplatform/klotho/pkg/exec_unit 54%
github.com/klothoplatform/klotho/pkg/infra/kubernetes 59%
github.com/klothoplatform/klotho/pkg/infra/kubernetes/helm 39%
github.com/klothoplatform/klotho/pkg/input 72%
github.com/klothoplatform/klotho/pkg/lang 38%
github.com/klothoplatform/klotho/pkg/lang/dockerfile 0%
github.com/klothoplatform/klotho/pkg/lang/golang 36%
github.com/klothoplatform/klotho/pkg/lang/javascript 48%
github.com/klothoplatform/klotho/pkg/lang/python 63%
github.com/klothoplatform/klotho/pkg/lang/yaml 0%
github.com/klothoplatform/klotho/pkg/logging 6%
github.com/klothoplatform/klotho/pkg/multierr 95%
github.com/klothoplatform/klotho/pkg/provider/aws 50%
github.com/klothoplatform/klotho/pkg/provider/aws/resources 70%
github.com/klothoplatform/klotho/pkg/runtime 78%
github.com/klothoplatform/klotho/pkg/static_unit 33%
github.com/klothoplatform/klotho/pkg/updater 30%
github.com/klothoplatform/klotho/pkg/validation 74%
github.com/klothoplatform/klotho/pkg/yaml_util 79%
Summary 42% (4166 / 9912)

@jhsinger-klotho jhsinger-klotho merged commit 2772bad into main Feb 21, 2023
@jhsinger-klotho jhsinger-klotho deleted the s3_env_var branch February 21, 2023 18:51
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

Successfully merging this pull request may close these issues.

refactor fs to create buckets based on ID
1 participant