Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Add inline plugin
Browse files Browse the repository at this point in the history
So we can mix existing groups with inline definition
  • Loading branch information
Gsantomaggio committed Oct 31, 2020
1 parent 10eaad5 commit b1627c0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
8 changes: 8 additions & 0 deletions cmd/tools/cli/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ func applyGroup(config kctl.Config, groupName string) error {
}
}
}

for _, inlinePlugin := range group.InlinePlugins {
err = kctl.Apply(config, inlinePlugin, nil)
if err != nil {
return err
}
}

}

return nil
Expand Down
7 changes: 7 additions & 0 deletions cmd/tools/cli/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ func deleteGroup(config kctl.Config, groupName string) error {
}
}
}

for _, inlinePlugin := range group.InlinePlugins {
err = kctl.Delete(config, inlinePlugin)
if err != nil {
return err
}
}
}
return nil
}
Expand Down
7 changes: 4 additions & 3 deletions internal/plugins/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ type PluginGroup struct {

//Group is the specification of each k3ai plugins group
type Group struct {
PluginType string `yaml:"plugin-type"`
GroupName string `yaml:"group-name"`
Plugins []PluginGroup `yaml:"plugins,flow"`
PluginType string `yaml:"plugin-type"`
GroupName string `yaml:"group-name"`
Plugins []PluginGroup `yaml:"plugins,flow"`
InlinePlugins []Plugin `yaml:"inline-plugins,flow"`
}

//Groups is the specification of each k3ai plugins group
Expand Down
8 changes: 6 additions & 2 deletions internal/plugins/testdata/groups/two_plugins/group.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ plugin-type: group
group-name: test_two_plugins
plugins:
- name: test
enabled: false
- name: argo-workflow
enabled: true
- name: argo
enabled: true
inline-plugins:
- plugin-name: Argo-bind-traefik
yaml:
- url: "https://raw.githubusercontent.com/kf5i/k3ai-plugins/main/common/traefik/argo-bind.yaml"

0 comments on commit b1627c0

Please sign in to comment.