diff --git a/pkg/util.go b/pkg/util.go index 428b932ee..86b3e12df 100644 --- a/pkg/util.go +++ b/pkg/util.go @@ -114,8 +114,11 @@ func (opt *postgresOptions) setDatabaseCredentials(appBinding *appcatalog.AppBin } userName := "" - - if _, ok := appBindingSecret.Data[core.TLSPrivateKeyKey]; ok { + if appBinding.Spec.TLSSecret != nil && appBinding.Spec.TLSSecret.Name != "" { + appBindingSecret, err = opt.kubeClient.CoreV1().Secrets(appBinding.Namespace).Get(context.TODO(), appBinding.Spec.TLSSecret.Name, metav1.GetOptions{}) + if err != nil { + return err + } certByte, ok := appBindingSecret.Data[core.TLSCertKey] if !ok { return fmt.Errorf("can't find client cert")