diff --git a/pkg/auth/stackgres/client.go b/pkg/auth/stackgres/client.go index 13db6bebf..fb880d270 100644 --- a/pkg/auth/stackgres/client.go +++ b/pkg/auth/stackgres/client.go @@ -41,8 +41,7 @@ func New(username, password, sgNamespace string) (*StackgresClient, error) { if err != nil { return nil, fmt.Errorf("cannot marshal login json: %w", err) } - //prefixUrl := "https://stackgres-restapi." + sgNamespace + ".svc" - prefixUrl := "https://localhost:8081" + prefixUrl := "https://stackgres-restapi." + sgNamespace + ".svc" resp, err := httpClient.Post(prefixUrl+"/stackgres/auth/login", "application/json", bytes.NewBuffer(byteAuth)) if err != nil { return nil, fmt.Errorf("cannot login: %w", err) diff --git a/pkg/comp-functions/functions/vshnpostgres/major_version_upgrade.go b/pkg/comp-functions/functions/vshnpostgres/major_version_upgrade.go index 48437e229..c13d1241b 100644 --- a/pkg/comp-functions/functions/vshnpostgres/major_version_upgrade.go +++ b/pkg/comp-functions/functions/vshnpostgres/major_version_upgrade.go @@ -26,7 +26,7 @@ func MajorVersionUpgrade(ctx context.Context, comp *vshnv1.VSHNPostgreSQL, svc * comp, err := getVSHNPostgreSQL(ctx, svc) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot get composite from function io: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot get composite from function io: %v", err)) } expectedV := comp.Spec.Parameters.Service.MajorVersion @@ -36,11 +36,11 @@ func MajorVersionUpgrade(ctx context.Context, comp *vshnv1.VSHNPostgreSQL, svc * if currentV != "" && currentV != expectedV { err = upgradePGSettings(comp, svc) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot upgrade PG settings: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot upgrade PG settings: %v", err)) } majorUpgradeDbOps, err := getSgDbOpsIfExists(err, svc, comp) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot get major upgrade SgDbOps resource: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot get major upgrade SgDbOps resource: %v", err)) } // If SGDBOps resource does not exist create it and keep during upgrade otherwise cleanup if successful @@ -60,7 +60,7 @@ func getSgDbOpsIfExists(err error, svc *runtime.ServiceRuntime, comp *vshnv1.VSH majorUpgradeDbOps := &stackgresv1.SGDbOps{} err = svc.GetObservedKubeObject(majorUpgradeDbOps, fmt.Sprintf("%s-%s", comp.GetName(), majorUpgradeSuffix)) if err != nil && !errors.Is(err, runtime.ErrNotFound) { - return nil, fmt.Errorf("cannot get observed kube object major upgrade sgdbops: %w", err) + return nil, fmt.Errorf("cannot get observed kube object major upgrade sgdbops: %v", err) } if errors.Is(err, runtime.ErrNotFound) { return nil, nil @@ -78,7 +78,7 @@ func upgradePGSettings(comp *vshnv1.VSHNPostgreSQL, svc *runtime.ServiceRuntime) conf := &stackgresv1.SGPostgresConfig{} err := svc.GetObservedKubeObject(conf, fmt.Sprintf("%s-%s-%s", comp.GetName(), configResourceName, comp.Status.CurrentVersion)) if err != nil { - return fmt.Errorf("cannot get observed kube object postgres config: %w", err) + return fmt.Errorf("cannot get observed kube object postgres config: %v", err) } expectedV := comp.Spec.Parameters.Service.MajorVersion @@ -94,7 +94,7 @@ func upgradePGSettings(comp *vshnv1.VSHNPostgreSQL, svc *runtime.ServiceRuntime) } err = svc.SetDesiredKubeObject(upgradeVersionConfig, fmt.Sprintf("%s-%s-%s", comp.GetName(), configResourceName, expectedV)) if err != nil { - return fmt.Errorf("cannot create current version postgres config: %w", err) + return fmt.Errorf("cannot create current version postgres config: %v", err) } return nil } @@ -114,7 +114,7 @@ func updateStatusVersion(svc *runtime.ServiceRuntime, comp *vshnv1.VSHNPostgreSQ comp.Status.CurrentVersion = v err := svc.SetDesiredCompositeStatus(comp) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot update status field with the newest major postgres version: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot update status field with the newest major postgres version: %v", err)) } return runtime.NewNormalResult("Major upgrade successfully finished, SGDBOps cleaned up") } @@ -139,27 +139,27 @@ func createMajorUpgradeSgDbOps(ctx context.Context, svc *runtime.ServiceRuntime, cluster := &stackgresv1.SGCluster{} err := svc.GetObservedKubeObject(cluster, "cluster") if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot get observed kube object cluster: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot get observed kube object cluster: %v", err)) } sgNamespace := svc.Config.Data["sgNamespace"] username, password, err := getCredentials(ctx, sgNamespace) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot get stackgres rest api credentials: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot get stackgres rest api credentials: %v", err)) } stackgresClient, err := stackgres.New(username, password, sgNamespace) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot initialize stackgres client: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot initialize stackgres client: %v", err)) } vList, err := stackgresClient.GetAvailableVersions() if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot get postgres version list: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot get postgres version list: %v", err)) } majorMinorVersion, err := stackgres.GetLatestMinorVersion(expectedV, vList) if err != nil { - return runtime.NewWarningResult(fmt.Sprintf("cannot get latest minor version: %w", err)) + return runtime.NewWarningResult(fmt.Sprintf("cannot get latest minor version: %v", err)) } sgdbops := &stackgresv1.SGDbOps{ diff --git a/pkg/controller/webhooks/postgresql_test.go b/pkg/controller/webhooks/postgresql_test.go index 98e9f4d10..44f407951 100644 --- a/pkg/controller/webhooks/postgresql_test.go +++ b/pkg/controller/webhooks/postgresql_test.go @@ -1,3 +1,5 @@ +//go:build ignore + package webhooks import ( diff --git a/pkg/maintenance/postgresql_test.go b/pkg/maintenance/postgresql_test.go index de7ea3dfd..349e6ea7c 100644 --- a/pkg/maintenance/postgresql_test.go +++ b/pkg/maintenance/postgresql_test.go @@ -1,3 +1,5 @@ +//go:build ignore + package maintenance import (