MCPcopy
hub / github.com/cyclops-ui/cyclops / HelmTemplate

Method HelmTemplate

cyclops-ctrl/internal/controller/modules.go:756–787  ·  view source on GitHub ↗
(ctx *gin.Context)

Source from the content-addressed store, hash-verified

754}
755
756func (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")

Callers 6

ManifestMethod · 0.45
CurrentManifestMethod · 0.45
HistoryEntryManifestMethod · 0.45
ResourcesForModuleMethod · 0.45
TemplateMethod · 0.45
generateResourcesMethod · 0.45

Calls 4

PrintlnMethod · 0.80
ErrorMethod · 0.80
GetModuleMethod · 0.65
GetTemplateMethod · 0.65

Tested by

no test coverage detected