bug: when ingress.hosts has one or more items, ROOT_URL is conformed for ingress even though ingress.enabled is false #648

Closed
opened 2024-04-28 18:11:22 +00:00 by wilson0x4d · 2 comments
wilson0x4d commented 2024-04-28 18:11:22 +00:00 (Migrated from gitea.com)

Discovered in version 1.21.11 built with GNU Make 4.4.1, go1.21.9 : bindata, timetzdata, sqlite, sqlite_unlock_notify.

Repro

modify values.xml with an ingress dict such as:

ingress:
  enabled: false
  hosts:
    - host: git.my-domain.com
      paths:
        - path: /
          pathType: Prefix

and a config.server dict such as:

  config:
    server:
      ROOT_URL: https://test.my-domain.com
      PROTOCOL: http
      HTTP_PORT: 3000
      SSH_PORT: 22 # rootful image
      SSH_LISTEN_PORT: 2222 # rootless image
      SSH_DOMAIN: git.my-domain.com
      DOMAIN: test.my-domain.com

Expected

Expected generated app.ini to contain a ROOT_URL value of https://test.my-domain.com.

Actual

Actual generated app.ini contains a ROOT_URL value of http://git.my-domain.com.

Notes

Within _helpers.tpl there appears a snippet such as this, which is what led me to realizing what was causing this behavior. I am not familiar enough with Helm templating to know that this is really root-cause, but, it is what led me to updating my values so the rollout generated a correct app.ini:

{{- define "gitea.inline_configuration.defaults.server" -}}
  {{- if not (hasKey .Values.gitea.config.server "HTTP_PORT") -}}
    {{- $ := set .Values.gitea.config.server "HTTPPORT" .Values.service.http.port -}}
  {{- end -}}
  {{- if not .Values.gitea.config.server.PROTOCOL -}}
    {{- $ := set .Values.gitea.config.server "PROTOCOL" "http" -}}
  {{- end -}}
  {{- if not (.Values.gitea.config.server.DOMAIN) -}}
    {{- if gt (len .Values.ingress.hosts) 0 -}}
      {{- $_ := set .Values.gitea.config.server "DOMAIN" ( tpl (index .Values.ingress.hosts 0).host $) -}}
Discovered in version `1.21.11 built with GNU Make 4.4.1, go1.21.9 : bindata, timetzdata, sqlite, sqlite_unlock_notify`. **Repro** modify values.xml with an `ingress` dict such as: ``` ingress: enabled: false hosts: - host: git.my-domain.com paths: - path: / pathType: Prefix ``` and a `config.server` dict such as: ``` config: server: ROOT_URL: https://test.my-domain.com PROTOCOL: http HTTP_PORT: 3000 SSH_PORT: 22 # rootful image SSH_LISTEN_PORT: 2222 # rootless image SSH_DOMAIN: git.my-domain.com DOMAIN: test.my-domain.com ``` **Expected** Expected generated `app.ini` to contain a `ROOT_URL` value of `https://test.my-domain.com`. **Actual** Actual generated `app.ini` contains a `ROOT_URL` value of `http://git.my-domain.com`. **Notes** Within `_helpers.tpl` there appears a snippet such as this, which is what led me to realizing what was causing this behavior. I am not familiar enough with Helm templating to know that this is really root-cause, but, it is what led me to updating my values so the rollout generated a correct `app.ini`: ``` {{- define "gitea.inline_configuration.defaults.server" -}} {{- if not (hasKey .Values.gitea.config.server "HTTP_PORT") -}} {{- $ := set .Values.gitea.config.server "HTTPPORT" .Values.service.http.port -}} {{- end -}} {{- if not .Values.gitea.config.server.PROTOCOL -}} {{- $ := set .Values.gitea.config.server "PROTOCOL" "http" -}} {{- end -}} {{- if not (.Values.gitea.config.server.DOMAIN) -}} {{- if gt (len .Values.ingress.hosts) 0 -}} {{- $_ := set .Values.gitea.config.server "DOMAIN" ( tpl (index .Values.ingress.hosts 0).host $) -}} ```
justusbunsi commented 2024-05-03 18:11:29 +00:00 (Migrated from gitea.com)

Using the provided values I am not able to reproduce your issue. In my rendered files - either with current main branch, or latest release - I get the https ROOT_URL in app.ini.

image image

Could you share your whole values.yaml (without sensitive information of course)

Using the provided values I am not able to reproduce your issue. In my rendered files - either with current main branch, or latest release - I get the https ROOT_URL in app.ini. <img width="272" alt="image" src="/attachments/d84bffde-5eb4-4203-940b-a2a65ee2baf4"> <img width="362" alt="image" src="/attachments/a638a943-7690-4fae-ad67-b5fd9aa1354c"> Could you share your whole values.yaml (without sensitive information of course)
pat-s commented 2024-05-23 09:19:13 +00:00 (Migrated from gitea.com)

I am also not able to reproduce this. Given that this is a core setting used in almost any instance, I'd expect a lot more people to open issues if there would be really an issue here.

@wilson0x4d I guess we would need more info here or a missing config setting that is possibly different in your instance. Also, if you want to provide additional info, please reference the chart version.

FWIW, using PROTOCOL: http and a https ROOT_URL also likely won't go along well.

I am also not able to reproduce this. Given that this is a core setting used in almost any instance, I'd expect a lot more people to open issues if there would be really an issue here. @wilson0x4d I guess we would need more info here or a missing config setting that is possibly different in your instance. Also, if you want to provide additional info, please reference the chart version. FWIW, using `PROTOCOL: http` and a https `ROOT_URL` also likely won't go along well.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lunny/helm-chart#648
No description provided.