A small refactoring
This commit is contained in:
		@@ -7,9 +7,9 @@ import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/helmhelper"
 | 
			
		||||
	"git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/helmrelease"
 | 
			
		||||
	"git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/helm"
 | 
			
		||||
	"git.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/kube"
 | 
			
		||||
	"git.badhouseplants.net/softplayer/softplayer-backend/internal/types/helmrelease"
 | 
			
		||||
	"github.com/google/uuid"
 | 
			
		||||
	"github.com/sirupsen/logrus"
 | 
			
		||||
	"gopkg.in/yaml.v2"
 | 
			
		||||
@@ -62,8 +62,8 @@ func (app *Application) Create(ctx context.Context) error {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	helm := helmhelper.NewHelm()
 | 
			
		||||
	release := &helmhelper.ReleaseData{
 | 
			
		||||
	helmEntry := helm.NewHelm()
 | 
			
		||||
	release := &helm.ReleaseData{
 | 
			
		||||
		Name:           app.Data.Name,
 | 
			
		||||
		Chart:          app.Data.Application,
 | 
			
		||||
		Version:        app.Data.Version,
 | 
			
		||||
@@ -75,7 +75,7 @@ func (app *Application) Create(ctx context.Context) error {
 | 
			
		||||
	if err := os.MkdirAll(goPath, 0777); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	path, err := helm.PullChart(goPath, release)
 | 
			
		||||
	path, err := helmEntry.PullChart(goPath, release)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		logrus.Error("0")
 | 
			
		||||
		return err
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,7 @@ type EnvironemntData struct {
 | 
			
		||||
	Kubernetes  string
 | 
			
		||||
	Location    string
 | 
			
		||||
	ServerType  string
 | 
			
		||||
	DiskSize    int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (e *EnvironemntData) buildVars() (string, error) {
 | 
			
		||||
@@ -41,16 +42,19 @@ func (e *EnvironemntData) buildVars() (string, error) {
 | 
			
		||||
SP_PROVIDER=%s
 | 
			
		||||
SP_KUBERNETES=%s
 | 
			
		||||
SP_SERVER_TYPE=%s
 | 
			
		||||
SP_SERVER_LOCATION=%s`,
 | 
			
		||||
SP_SERVER_LOCATION=%s
 | 
			
		||||
SP_DISK_SIZE=%d`,
 | 
			
		||||
		e.Provider,
 | 
			
		||||
		e.Kubernetes,
 | 
			
		||||
		e.ServerType,
 | 
			
		||||
		e.Location,
 | 
			
		||||
		e.DiskSize,
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	return vars, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Check whether used has passed the email verification
 | 
			
		||||
func (env *Environemnt) isNsVerified(ctx context.Context) error {
 | 
			
		||||
	client := env.Controller.GetClient()
 | 
			
		||||
	ns := &corev1.Namespace{}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package helmhelper
 | 
			
		||||
package helm
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package helmhelper
 | 
			
		||||
package helm
 | 
			
		||||
 | 
			
		||||
type Helmhelper interface {
 | 
			
		||||
	FindLatestVersion(workdirPath string, release *ReleaseData) (string, error)
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package providers
 | 
			
		||||
package infra
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
package providers
 | 
			
		||||
package infra
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
		Reference in New Issue
	
	Block a user