Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Saratura committed Jan 24, 2025
1 parent 34dfb70 commit 19bd0ae
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@ func isSuccessful(conditions *[]stackgresv1.SGDbOpsStatusConditionsItem) bool {

// createMajorUpgradeSgDbOps create a major upgrade SgDbOps resource to start the upgrade process
func createMajorUpgradeSgDbOps(ctx context.Context, svc *runtime.ServiceRuntime, comp *vshnv1.VSHNPostgreSQL, expectedV string) *xfnproto.Result {
log := ctrl.LoggerFrom(ctx)

cluster := &stackgresv1.SGCluster{}
err := svc.GetObservedKubeObject(cluster, "cluster")
if err != nil {
return runtime.NewWarningResult(fmt.Sprintf("cannot get observed kube object cluster: %v", err))
}

log.Info("TEST", "sgNamespace", svc.Config.Data["sgNamespace"])
sgNamespace := svc.Config.Data["sgNamespace"]
username, password, err := getCredentials(ctx, sgNamespace)
log.Info("TEST", "password", password)
if err != nil {
return runtime.NewWarningResult(fmt.Sprintf("cannot get stackgres rest api credentials: %v", err))
}
Expand Down Expand Up @@ -193,6 +196,7 @@ func createMajorUpgradeSgDbOps(ctx context.Context, svc *runtime.ServiceRuntime,
}

func getCredentials(ctx context.Context, sgNamespace string) (username, password string, err error) {
log := ctrl.LoggerFrom(ctx)
kubeClient, err := client.New(ctrl.GetConfigOrDie(), client.Options{
Scheme: pkg.SetupScheme(),
})
Expand All @@ -208,6 +212,7 @@ func getCredentials(ctx context.Context, sgNamespace string) (username, password
if err != nil {
return "", "", err
}
log.Info("TEST DATA", "data", c.Data)

return string(c.Data["k8sUsername"]), string(c.Data["clearPassword"]), nil
}

0 comments on commit 19bd0ae

Please sign in to comment.