-
Notifications
You must be signed in to change notification settings - Fork 19
Allow installing multiple plugins #141
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
Conversation
fada74f to
586a77d
Compare
Codecov Report
@@ Coverage Diff @@
## main #141 +/- ##
==========================================
+ Coverage 75.58% 76.75% +1.16%
==========================================
Files 13 13
Lines 1536 1540 +4
==========================================
+ Hits 1161 1182 +21
+ Misses 242 227 -15
+ Partials 133 131 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
9157c8c to
2c4adfa
Compare
api/v1/agentconfig_types.go
Outdated
| SchemaVersion string `json:"schemaVersion,omitempty" mapstructure:"schemaVersion,omitempty"` | ||
|
|
||
| // Configs is a map of plugin configuration using plugin name as the key. | ||
| Configs map[string]Plugin `json:"configs,omitempty" mapstructure:"configs,omitempty"` |
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'm a bit confused about why this representation of the document uses configs instead of plugins?
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.
spec:
plugins:
schemaVersion: 1.0.0
configs:
kubernetes: {}This is what the schema looks like with the current implementation
If we change from Configs to Plugins, I find it a bit confusing to have Plugins under Spec.Plugins
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.
The goal for any of our file formats is that they are copy pastable between when you are using them with the porter cli and the operator. Ideally, if someone had the following plugins.yaml they were using with porter,
schemaType: Plugins
schemaVersion: 1.0.0
plugins:
azure:
version: 1.0.1Then they should be able to copy/paste it into a k8s manifest and use it without modifying (though they do need to paste it under the spec portion). So based on that I would expect the following to work
apiGroup: getporter.org/v1
Kind: AgentConfig
metadata:
name: myconfig
spec:
# normal agent config stuff
plugins:
# Copy/paste the plugins.yaml here
schemaType: Plugins
schemaVersion: 1.0.0
plugins:
azure:
version: 1.0.1I agree that the double plugins is a bit unwieldy. How about we rename AgentConfigSpec.Plugins to AgentConfigSpec.PluginConfigFile, which would also help clarify what goes under plugins? This way you would have a hint that the entire plugins file should be included in the field and not to just immediately start listing the plugins you want.
```yaml
apiGroup: getporter.org/v1
Kind: AgentConfig
metadata:
name: myconfig
spec:
# normal agent config stuff
pluginConfigFile:
# Copy/paste the plugins.yaml here
schemaType: Plugins
schemaVersion: 1.0.0
plugins:
azure:
version: 1.0.1What do you think?
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.
That's a very good point. I changed it based on your suggestions
Signed-off-by: Yingrong Zhao <[email protected]>
Signed-off-by: Yingrong Zhao <[email protected]>
86fed8b to
9f0fc8d
Compare
Signed-off-by: Yingrong Zhao <[email protected]>
Signed-off-by: Yingrong Zhao <[email protected]>
api/v1/agentconfig_types.go
Outdated
| // In order to utilize mapstructure omitempty tag with an embedded struct, this field needs to be a pointer | ||
| // +optional | ||
| Plugins map[string]Plugin `json:"plugins,omitempty" mapstructure:"plugins,omitempty"` | ||
| PluginConfigFile *PluginFileSpec `json:"pluginConfigFile,omitempty" mapstructure:"pluginsConfigFile,omitempty"` |
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.
You are using both plugins plural and singular here in the json/mapsturcture tags. I'm not sure which one you want to use?
api/v1/agentconfig_types.go
Outdated
| SchemaVersion string `json:"schemaVersion" yaml:"schemaVersion"` | ||
|
|
||
| // Plugins is a map of plugin configuration using plugin name as the key. | ||
| Plugins map[string]Plugin `json:"configs,omitempty" mapstructure:"configs,omitempty"` |
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 thought you were going to make it match the suggested schema from my last comment but this wasn't updated to be plugins so I'm a bit confused if you intended to match the suggestion or ?
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.
oops, the rebasing with the latest main really messed it up. I will fix it
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.
Next time, if you leave the rebase for after the review is done, it's easier for me to review since I don't have to go over the entire thing again from scratch.
Signed-off-by: Yingrong Zhao <[email protected]>
| * Using the AgentConfig with the name "default" defined in the operator namespace. | ||
| * By default, using a reasonable set of defaults for the default installation of the Operator, assuming that the default RBAC roles exist in the cluster. | ||
|
|
||
| 🚨 WARNING: Currently, only one plugin per AgentConfig can be installed through the plugins configuration. |
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.
🎉
carolynvs
left a comment
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.
Looks great, thanks! 💖
This PR updated the porter dependency and the default porter-agent to v1.0.6. This allows us to take advantage of the new plugin file installing feature.
To match with the new plugins file schema, I had to update the AgentConfig resource definition. This will be a breaking change.
closes: #123