Fix on port 443 do not add port to url

[ZITADOPER-1]
This commit is contained in:
Haim Kortovich
2024-05-13 14:05:33 -05:00
parent 2a94620b96
commit 02ff904c6a
4 changed files with 17 additions and 2 deletions

View File

@@ -1,6 +1,8 @@
package controller package controller
import ( import (
"strings"
zitadelv1alpha1 "bitbucket.org/topmanage-software-engineering/zitadel-k8s-operator/src/api/v1alpha1" zitadelv1alpha1 "bitbucket.org/topmanage-software-engineering/zitadel-k8s-operator/src/api/v1alpha1"
"bitbucket.org/topmanage-software-engineering/zitadel-k8s-operator/src/pkg/controller/zitadel" "bitbucket.org/topmanage-software-engineering/zitadel-k8s-operator/src/pkg/controller/zitadel"
@@ -69,6 +71,9 @@ func (wf *wrappedOIDCAppFinalizer) Reconcile(ctx context.Context, ztdClient *man
} }
_, err = ztdClient.RemoveApp(middleware.SetOrgID(ctx, org.Status.OrgId), &pb.RemoveAppRequest{ProjectId: project.Status.ProjectId, AppId: wf.OIDCApp.Status.AppId}) _, err = ztdClient.RemoveApp(middleware.SetOrgID(ctx, org.Status.OrgId), &pb.RemoveAppRequest{ProjectId: project.Status.ProjectId, AppId: wf.OIDCApp.Status.AppId})
if err != nil { if err != nil {
if strings.Contains(err.Error(), "doesn't exist") {
return nil
}
return err return err
} }
return nil return nil

View File

@@ -96,7 +96,7 @@ func (wr *wrappedProjectReconciler) Reconcile(ctx context.Context, ztdClient *ma
if err != nil { if err != nil {
return err return err
} }
{ if wr.project.Status.ProjectId != "" {
_, err := ztdClient.GetProjectByID(middleware.SetOrgID(ctx, org.Status.OrgId), &pb.GetProjectByIDRequest{Id: wr.project.Status.ProjectId}) _, err := ztdClient.GetProjectByID(middleware.SetOrgID(ctx, org.Status.OrgId), &pb.GetProjectByIDRequest{Id: wr.project.Status.ProjectId})
if err != nil { if err != nil {
if !strings.Contains(err.Error(), "not found") { if !strings.Contains(err.Error(), "not found") {

View File

@@ -426,7 +426,14 @@ func (r *ZitadelClusterReconciler) reconcileDefaultInstance(ctx context.Context,
} }
func GetIssuer(zitadel *zitadelv1alpha1.ZitadelCluster) string { func GetIssuer(zitadel *zitadelv1alpha1.ZitadelCluster) string {
return "https://" scheme := "http"
if zitadel.Spec.ExternalSecure {
scheme = "https"
}
if zitadel.Spec.ExternalPort == 443 {
return fmt.Sprintf("%s://%s", scheme, zitadel.Spec.Host)
}
return fmt.Sprintf("%s://%s:%d", scheme, zitadel.Spec.Host, zitadel.Spec.ExternalPort)
} }
func GetAPI(zitadel *zitadelv1alpha1.ZitadelCluster) string { func GetAPI(zitadel *zitadelv1alpha1.ZitadelCluster) string {

View File

@@ -55,6 +55,9 @@ func GetIssuer(zitadel *zitadelv1alpha1.ZitadelCluster) string {
if zitadel.Spec.ExternalSecure { if zitadel.Spec.ExternalSecure {
scheme = "https" scheme = "https"
} }
if zitadel.Spec.ExternalPort == 443 {
return fmt.Sprintf("%s://%s", scheme, zitadel.Spec.Host)
}
return fmt.Sprintf("%s://%s:%d", scheme, zitadel.Spec.Host, zitadel.Spec.ExternalPort) return fmt.Sprintf("%s://%s:%d", scheme, zitadel.Spec.Host, zitadel.Spec.ExternalPort)
} }