Skip to content

Commit

Permalink
Fix provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Saratura committed Oct 30, 2024
1 parent 454080f commit e331de7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/comp-functions/functions/vshnpostgres/delay_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func DelayClusterDeployment(_ context.Context, comp *vshnv1.VSHNPostgreSQL, svc
return runtime.NewWarningResult("SGObjectStorage is not yet ready, skipping creation of cluster")
}

if !kubeObjectSyncedAndReady("pg-conf", svc) {
if !kubeObjectSyncedAndReady(comp.GetName()+"-"+configResourceName, svc) {
return runtime.NewWarningResult("SGPostgresConfig is not yet ready, skipping creation of cluster")
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/comp-functions/functions/vshnpostgres/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func enableTimescaleDB(ctx context.Context, svc *runtime.ServiceRuntime, name st

config := &stackgresv1.SGPostgresConfig{}

err := svc.GetDesiredKubeObject(config, configResourceName)
err := svc.GetDesiredKubeObject(config, name+"-"+configResourceName)
if err != nil && err == runtime.ErrNotFound {
controllerruntime.LoggerFrom(ctx).Info("no pg-conf found")
return nil
Expand All @@ -112,7 +112,7 @@ func disableTimescaleDB(ctx context.Context, svc *runtime.ServiceRuntime, name s

config := &stackgresv1.SGPostgresConfig{}

err := svc.GetDesiredKubeObject(config, configResourceName)
err := svc.GetDesiredKubeObject(config, name+"-"+configResourceName)
if err != nil && err == runtime.ErrNotFound {
controllerruntime.LoggerFrom(ctx).Info("no pg-conf found")
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/comp-functions/functions/vshnpostgres/extensions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ func Test_disableTimescaleDB(t *testing.T) {
svc := commontest.LoadRuntimeFromFile(t, tt.iofFile)

t.Run(tt.name, func(t *testing.T) {
if err := disableTimescaleDB(ctx, svc, configResourceName); (err != nil) != tt.wantErr {
if err := disableTimescaleDB(ctx, svc, "pgsql-gc9x4"); (err != nil) != tt.wantErr {
t.Errorf("disableTimescaleDB() error = %v, wantErr %v", err, tt.wantErr)
}
})

config := &stackgresv1.SGPostgresConfig{}

assert.NoError(t, svc.GetDesiredKubeObject(config, configResourceName))
assert.NoError(t, svc.GetDesiredKubeObject(config, "pgsql-gc9x4-"+configResourceName))

assert.NotContains(t, config.Spec.PostgresqlConf[sharedLibraries], timescaleExtName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ observed:
reason: ReconcileSuccess
status: 'True'
type: Synced
pg-conf:
pgsql-gc9x4-pg-conf:
resource:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ desired:
writeConnectionSecretToRef: {}
status: {}
resources:
pg-conf:
pgsql-gc9x4-pg-conf:
resource:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ desired:
writeConnectionSecretToRef: {}
status: {}
resources:
pg-conf:
pgsql-gc9x4-pg-conf:
resource:
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
Expand Down

0 comments on commit e331de7

Please sign in to comment.