A small refactoring

This commit is contained in:
2024-05-06 10:44:08 +02:00
parent 638e35b60d
commit 7d1effa22a
12 changed files with 47 additions and 21 deletions

View File

@ -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

View File

@ -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{}