Kube backend: add `compose convert` for displaying the generated chart content

Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
aiordache 2021-02-05 11:12:56 +01:00
parent 9f56fc9fd6
commit a9247e5412
1 changed files with 12 additions and 1 deletions

View File

@ -164,7 +164,18 @@ func (s *composeService) Ps(ctx context.Context, projectName string, options com
// Convert translate compose model into backend's native format
func (s *composeService) Convert(ctx context.Context, project *types.Project, options compose.ConvertOptions) ([]byte, error) {
return nil, errdefs.ErrNotImplemented
chart, err := helm.GetChartInMemory(project)
if err != nil {
return nil, err
}
buff := []byte{}
for _, f := range chart.Raw {
header := "\n" + f.Name + "\n" + strings.Repeat("-", len(f.Name)) + "\n"
buff = append(buff, []byte(header)...)
buff = append(buff, f.Data...)
buff = append(buff, []byte("\n")...)
}
return buff, nil
}
func (s *composeService) Kill(ctx context.Context, project *types.Project, options compose.KillOptions) error {