(ctx *gin.Context)
| 754 | } |
| 755 | |
| 756 | func (m *Modules) HelmTemplate(ctx *gin.Context) { |
| 757 | ctx.Header("Access-Control-Allow-Origin", "*") |
| 758 | |
| 759 | module, err := m.kubernetesClient.GetModule(ctx.Param("name")) |
| 760 | if err != nil { |
| 761 | fmt.Println(err) |
| 762 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error fetching module", err.Error())) |
| 763 | return |
| 764 | } |
| 765 | |
| 766 | currentTemplate, err := m.templatesRepo.GetTemplate( |
| 767 | module.Spec.TemplateRef.URL, |
| 768 | module.Spec.TemplateRef.Path, |
| 769 | module.Spec.TemplateRef.Version, |
| 770 | module.Status.TemplateResolvedVersion, |
| 771 | module.Spec.TemplateRef.SourceType, |
| 772 | ) |
| 773 | if err != nil { |
| 774 | fmt.Println(err) |
| 775 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error fetching template", err.Error())) |
| 776 | return |
| 777 | } |
| 778 | |
| 779 | _, err = m.renderer.HelmTemplate(*module, currentTemplate) |
| 780 | if err != nil { |
| 781 | fmt.Println(err) |
| 782 | ctx.JSON(http.StatusInternalServerError, dto.NewError("Error templating", err.Error())) |
| 783 | return |
| 784 | } |
| 785 | |
| 786 | ctx.JSON(http.StatusOK, "{}") |
| 787 | } |
| 788 | |
| 789 | //func (m *Modules) ModuleToResources(ctx *gin.Context) { |
| 790 | // err := m.kubernetesClient.ModuleToResources("test") |
no test coverage detected