Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support a subject alternate name on ingresses #900

Closed
ryan-a-baker opened this issue Mar 15, 2021 · 9 comments
Closed

Support a subject alternate name on ingresses #900

ryan-a-baker opened this issue Mar 15, 2021 · 9 comments
Labels

Comments

@ryan-a-baker
Copy link

We have a globally replicated Harbor instance, and I'd love to front it all with DNS leveraging Geo-location.

Unfortunately, I'm unable to do this because the value for the ingress host is only a single entry. The helm chart should support multiple hosts so that dynamically generated certificates (such as Let's Encrypt) can have SANs.

@reasonerjt
Copy link
Contributor

@ryan-a-baker
Per my understanding this is a highly customized deployment approach, I'm reluctant to merge it into master.
I suggest that we wait until there are enough use cases like yours before we merge it.

@ryan-a-baker
Copy link
Author

I understand. This was something I did a while back and just now opening the PR for it. We can work around it for now. In the meantime, I'll add more testing results and context to the issue and the PR, as I did this all in a bit of a hurry.

@mothershipper
Copy link

I'd like to add a plus one to this -- we also have a globally replicated harbor deployment

@sspreitzer
Copy link

Adding my 👍 to this request. Seems trivial.

@cfiehe
Copy link

cfiehe commented Nov 29, 2023

We are facing the same limitation. We have a new harbor deployment with a new hostname, but we have to be backward-compatible with the old hostname. The plan is that the old hostname becomes a CNAME for the new one. I have modified the ingress resource, so that ingress.hosts.core becomes a list instead of a single hostname:

{{- if eq .Values.expose.type "ingress" }}
{{- $ingress := .Values.expose.ingress -}}
{{- $tls := .Values.expose.tls -}}
{{- if eq .Values.expose.ingress.controller "gce" }}
  {{- $_ := set . "portal_path" "/*" -}}
  {{- $_ := set . "api_path" "/api/*" -}}
  {{- $_ := set . "service_path" "/service/*" -}}
  {{- $_ := set . "v2_path" "/v2/*" -}}
  {{- $_ := set . "chartrepo_path" "/chartrepo/*" -}}
  {{- $_ := set . "controller_path" "/c/*" -}}
{{- else if eq .Values.expose.ingress.controller "ncp" }}
  {{- $_ := set . "portal_path" "/.*" -}}
  {{- $_ := set . "api_path" "/api/.*" -}}
  {{- $_ := set . "service_path" "/service/.*" -}}
  {{- $_ := set . "v2_path" "/v2/.*" -}}
  {{- $_ := set . "chartrepo_path" "/chartrepo/.*" -}}
  {{- $_ := set . "controller_path" "/c/.*" -}}
{{- else }}
  {{- $_ := set . "portal_path" "/" -}}
  {{- $_ := set . "api_path" "/api/" -}}
  {{- $_ := set . "service_path" "/service/" -}}
  {{- $_ := set . "v2_path" "/v2/" -}}
  {{- $_ := set . "chartrepo_path" "/chartrepo/" -}}
  {{- $_ := set . "controller_path" "/c/" -}}
{{- end }}

---
{{- if semverCompare "<1.14-0" (include "harbor.ingress.kubeVersion" .) }}
apiVersion: extensions/v1beta1
{{- else if semverCompare "<1.19-0" (include "harbor.ingress.kubeVersion" .) }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: networking.k8s.io/v1
{{- end }}
kind: Ingress
metadata:
  name: "{{ template "harbor.ingress" . }}"
  labels:
{{ include "harbor.labels" . | indent 4 }}
{{- if $ingress.harbor.labels }}
{{ toYaml $ingress.harbor.labels | indent 4 }}
{{- end }}
  annotations:
{{ toYaml $ingress.annotations | indent 4 }}
{{- if .Values.internalTLS.enabled }}
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
{{- end }}
{{- if eq .Values.expose.ingress.controller "ncp" }}
    ncp/use-regex: "true"
    {{- if $tls.enabled }}
    ncp/http-redirect: "true"
    {{- end }}
{{- end }}
{{- if $ingress.harbor.annotations }}
{{ toYaml $ingress.harbor.annotations | indent 4 }}
{{- end }}
spec:
  {{- if $ingress.className }}
  ingressClassName: {{ $ingress.className }}
  {{- end }}
  {{- if $tls.enabled }}
  tls:
  - secretName: {{ template "harbor.tlsCoreSecretForIngress" . }}
    {{- if $ingress.hosts.core }}
    hosts:
    {{- range $ingress.hosts.core }}
    - {{ . | quote }}
    {{- end }}
  {{- end }}
  rules:
  {{- range $ingress.hosts.core }}
  - host: {{ . | quote }}
    http:
      paths:
{{- if semverCompare "<1.19-0" (include "harbor.ingress.kubeVersion" $) }}
      - path: {{ $.api_path }}
        backend:
          serviceName: {{ template "harbor.core" $ }}
          servicePort: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.service_path }}
        backend:
          serviceName: {{ template "harbor.core" $ }}
          servicePort: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.v2_path }}
        backend:
          serviceName: {{ template "harbor.core" $ }}
          servicePort: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.chartrepo_path }}
        backend:
          serviceName: {{ template "harbor.core" $ }}
          servicePort: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.controller_path }}
        backend:
          serviceName: {{ template "harbor.core" $ }}
          servicePort: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.portal_path }}
        backend:
          serviceName: {{ template "harbor.portal" $ }}
          servicePort: {{ template "harbor.portal.servicePort" $ }}
{{- else }}
      - path: {{ $.api_path }}
        pathType: Prefix
        backend:
          service:
            name: {{ template "harbor.core" $ }}
            port:
              number: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.service_path }}
        pathType: Prefix
        backend:
          service:
            name: {{ template "harbor.core" $ }}
            port:
              number: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.v2_path }}
        pathType: Prefix
        backend:
          service:
            name: {{ template "harbor.core" $ }}
            port:
              number: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.chartrepo_path }}
        pathType: Prefix
        backend:
          service:
            name: {{ template "harbor.core" $ }}
            port:
              number: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.controller_path }}
        pathType: Prefix
        backend:
          service:
            name: {{ template "harbor.core" $ }}
            port:
              number: {{ template "harbor.core.servicePort" $ }}
      - path: {{ $.portal_path }}
        pathType: Prefix
        backend:
          service:
            name: {{ template "harbor.portal" $ }}
            port:
              number: {{ template "harbor.portal.servicePort" $ }}
  {{- end }}
{{- end }}
{{- end }}
{{- end }}

@fretb
Copy link

fretb commented Feb 1, 2024

Hi everyone

We are facing the same limitation here. Supporting multiple hosts for the core ingress seems like good practice. Adding my 👍 here.

@xanderpetit01
Copy link

xanderpetit01 commented Feb 1, 2024

Adding my 👍 to this request as well.

Copy link

github-actions bot commented Apr 2, 2024

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

@github-actions github-actions bot added the Stale label Apr 2, 2024
Copy link

github-actions bot commented May 2, 2024

This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants