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

Open
opened 2024-04-28 18:11:22 +00:00 by wilson0x4d · 1 comment

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 $) -}} ```
Member

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)
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

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