Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
nabuskey committed Mar 4, 2024
1 parent 70f3c31 commit 3ac024b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions hack/argo-cd/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: {{ .Host }}
- host: {{ .IngressHost }}
http:
paths:
- path: /argocd(/|$)(.*)
Expand All @@ -36,7 +36,7 @@ metadata:
spec:
ingressClassName: "nginx"
rules:
- host: argocd.{{ .Host }}
- host: argocd.{{ .IngressHost }}
http:
paths:
- path: /
Expand Down
4 changes: 2 additions & 2 deletions hack/gitea/ingress.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: {{ .Host }}
- host: {{ .IngressHost }}
http:
paths:
- backend:
Expand All @@ -34,7 +34,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: gitea.{{ .Host }}
- host: gitea.{{ .IngressHost }}
http:
paths:
- path: /
Expand Down
6 changes: 6 additions & 0 deletions pkg/cmd/create/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var (
noExit bool
protocol string
host string
ingressHost string
port string
pathRouting bool
)
Expand All @@ -47,6 +48,7 @@ func init() {
CreateCmd.PersistentFlags().StringVar(&extraPortsMapping, "extra-ports", "", "List of extra ports to expose on the docker container and kubernetes cluster as nodePort (e.g. \"22:32222,9090:39090,etc\").")
CreateCmd.PersistentFlags().StringVar(&kindConfigPath, "kind-config", "", "Path of the kind config file to be used instead of the default.")
CreateCmd.PersistentFlags().StringVar(&host, "host", "cnoe.localtest.me", "Host name to access resources in this cluster.")
CreateCmd.PersistentFlags().StringVar(&ingressHost, "ingress-host-name", "", "Host name used by ingresses. Useful when you have another proxy infront of idpbuilder.")
CreateCmd.PersistentFlags().StringVar(&protocol, "protocol", "https", "Protocol to use to access web UIs. http or https.")
CreateCmd.PersistentFlags().StringVar(&port, "port", "8443", "Port number under which idpBuilder tools are accessible.")
CreateCmd.PersistentFlags().BoolVar(&pathRouting, "use-path-routing", false, "When set to true, web UIs are exposed under single domain name.")
Expand All @@ -66,6 +68,9 @@ func create(cmd *cobra.Command, args []string) error {

protocol = strings.ToLower(protocol)
host = strings.ToLower(host)
if ingressHost == "" {
ingressHost = host
}

err := validate()
if err != nil {
Expand All @@ -91,6 +96,7 @@ func create(cmd *cobra.Command, args []string) error {
util.CorePackageTemplateConfig{
Protocol: protocol,
Host: host,
IngressHost: ingressHost,
Port: port,
UsePathRouting: pathRouting,
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/gitrepository/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ func (r *RepositoryReconciler) reconcileRepoContent(ctx context.Context, repo *v
// if we cannot clone with gitea's configured url, then we fallback to using the url provided in spec.
logger.V(1).Info("failed cloning with returned clone URL. Falling back to default url.", "err", err)

cloneOptions.URL = fmt.Sprintf("%s://%s:%s/%s.git", r.Config.Protocol, repo.Spec.GitURL, r.Config.Port, giteaRepo.FullName)
cloneOptions.URL = fmt.Sprintf("%s/%s.git", repo.Spec.GitURL, giteaRepo.FullName)
c, retErr := git.PlainClone(tempDir, false, cloneOptions)
if retErr != nil {
return fmt.Errorf("cloning repo fall back url: %w", err)
return fmt.Errorf("cloning repo with fall back url: %w", retErr)
}
clonedRepo = c
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/localbuild/resources/argo/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: {{ .Host }}
- host: {{ .IngressHost }}
http:
paths:
- path: /argocd(/|$)(.*)
Expand All @@ -36,7 +36,7 @@ metadata:
spec:
ingressClassName: "nginx"
rules:
- host: argocd.{{ .Host }}
- host: argocd.{{ .IngressHost }}
http:
paths:
- path: /
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/localbuild/resources/gitea/k8s/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: {{ .Host }}
- host: {{ .IngressHost }}
http:
paths:
- backend:
Expand All @@ -588,7 +588,7 @@ metadata:
spec:
ingressClassName: nginx
rules:
- host: gitea.{{ .Host }}
- host: gitea.{{ .IngressHost }}
http:
paths:
- path: /
Expand Down
1 change: 1 addition & 0 deletions pkg/util/build_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package util
type CorePackageTemplateConfig struct {
Protocol string
Host string
IngressHost string
Port string
UsePathRouting bool
}

0 comments on commit 3ac024b

Please sign in to comment.