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

feat: export some plugin functions #1067

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/modules/generators/app_configurations_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (g *appConfigurationGenerator) Generate(spec *v1.Spec) error {

// patch workload with resource patchers
for _, p := range patchers {
if err = patchWorkload(&wl, &p); err != nil {
SparkYuan marked this conversation as resolved.
Show resolved Hide resolved
if err = PatchWorkload(&wl, &p); err != nil {
return err
}
}
Expand All @@ -152,7 +152,7 @@ func (g *appConfigurationGenerator) Generate(spec *v1.Spec) error {
return nil
}

func patchWorkload(workload *v1.Resource, patcher *internalv1.Patcher) error {
func PatchWorkload(workload *v1.Resource, patcher *internalv1.Patcher) error {
if patcher == nil {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/modules/generators/app_configurations_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func Test_patchWorkload(t *testing.T) {
Annotations: map[string]string{"newAnnotation": "newValue"},
}

err := patchWorkload(res, patcher)
err := PatchWorkload(res, patcher)
assert.NoError(t, err)

workloadLabels := res.Attributes["metadata"].(map[string]interface{})["labels"].(map[string]interface{})
Expand Down Expand Up @@ -321,7 +321,7 @@ func Test_patchWorkload(t *testing.T) {
},
}

err = patchWorkload(res, patcher)
err = PatchWorkload(res, patcher)
assert.NoError(t, err)

containers := res.Attributes["spec"].(map[string]interface{})["template"].(map[string]interface{})["spec"].(map[string]interface{})["containers"].([]interface{})
Expand Down
4 changes: 2 additions & 2 deletions pkg/modules/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (p *Plugin) initModule() error {
return err
}
pluginName := prefix[0] + "-" + prefix[1]
client, err := newPluginClient(pluginPath, pluginName)
client, err := NewPluginClient(pluginPath, pluginName)
if err != nil {
return err
}
Expand Down Expand Up @@ -122,7 +122,7 @@ func buildPluginPath(namespace, resourceType, version string) (string, error) {
return p, nil
}

func newPluginClient(modulePluginPath, moduleName string) (*plugin.Client, error) {
func NewPluginClient(modulePluginPath, moduleName string) (*plugin.Client, error) {
// create the plugin log file
var logFilePath string
dir, err := kfile.KusionDataFolder()
Expand Down
Loading