-
Notifications
You must be signed in to change notification settings - Fork 273
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
Plugin refactor pt2 #71
Conversation
Plugins are now registered and loaded separately, and are now defined as modules with an exported `gardenPlugin` function. BREAKING CHANGE: This includes some changes to the project schema and how it is resolved, as well as how the main `Garden` class is instantiated. The `Garden` class is now called with an environment name, which is then fixed for the session. The env configuration is resolved by merging the specific environment configuration with a global configuration specified on the new `global` key in the project config. The schema for the `providers` key also different - its keys should now match plugin names, and contain configuration for those plugins.
43dcb55
to
9cd85c3
Compare
This needed a few changes, but will be super useful as complexity grows in system-level deployments.
@@ -33,10 +33,9 @@ export const configSchema = Joi.object() | |||
project: projectSchema, | |||
}) | |||
.optionalKeys(["module", "project"]) | |||
.options({ allowUnknown: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edvald This causes an error on the module.image key since it's missing from the baseModuleSchema. Should we:
a) Allow unknown keys on the configSchema?
b) Allow unknown keys on the baseModuleSchema?
c) Add the image key to the baseModuleSchema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...I'll go for c) unless there are any objections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has actually been fixed in #75
We shouldn't allow unknown keys there, but rather in the individual sub-schemas. I just missed that one in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I'll fix it here though so that we don't merge a broken PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can also merge #75 in here before merging this into master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah you already did it, all good.
return <T>new Module(ctx, config) | ||
} | ||
// TODO: find a different way to solve type export issues | ||
let _serviceConfig: ServiceConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for? Also noticed it on the npm-package
plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's this slightly annoying thing in Typescript - if a module exports something that uses a certain type, it needs to be explicitly imported in the module. I couldn't quickly find a better way than this - just importing the type without using it raises linting errors, so I needed to put it in a dummy variable.
Deploy k8s system via sub-Garden
This is a bulky one... From the commit msg:
Plugins are now registered and loaded separately, and are now defined
as modules with an exported
gardenPlugin
function.BREAKING CHANGE:
This includes some changes to the project schema and how it is resolved,
as well as how the main
Garden
class is instantiated. TheGarden
class is now called with an environment name, which is then fixed for
the session. The env configuration is resolved by merging the specific
environment configuration with a global configuration specified on the
new
global
key in the project config. The schema for theproviders
key also different - its keys should now match plugin names, and
contain configuration for those plugins.