configure-gitea does not work with extraConfigs #720

Closed
opened 2024-10-26 13:20:54 +00:00 by ednxzu · 1 comment
ednxzu commented 2024-10-26 13:20:54 +00:00 (Migrated from gitea.com)

I tried deploying the chart in version 10.5.0

The configure-gitea will always fail stating that database infos aren't present even if the app.ini has them.

values.yml

---
service:
  http:
    type: ClusterIP
    port: 3000
    clusterIP: None
  ssh:
    type: ClusterIP
    port: 22
    clusterIP: None

ingress:
  enabled: true
  className: traefik-traefik-release
  annotations:
    external-dns.alpha.kubernetes.io/hostname: xxxxxxxxxxxxxx
    external-dns.alpha.kubernetes.io/target: xxxxxxxxxxxxxxxxxxx
    traefik.ingress.kubernetes.io/router.entrypoints: websecure,websecure-ext
  hosts:
    - host: xxxxxxxxxxxxxxxx
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: xxxxxxxxxxxxxx
      hosts:
        - xxxxxxxxxxxxxxx

resources:
  limits:
    memory: 2048Mi
  requests:
    cpu: 768m
    memory: 1024Mi

deployment:
  env:
    - name: USER_UID
      value: "1000"
    - name: USER_GID
      value: "1000"

persistence:
  enabled: true
  create: true
  mount: true
  size: 50Gi
  accessModes:
    - ReadWriteOnce
  storageClass: csi-cinder-sc-delete

gitea:
  admin:
    existingSecret: gitea-gitea-administrator

  metrics:
    enabled: true
    serviceMonitor:
      enabled: true
      #  additionalLabels:
      #    prometheus-release: prom1
      interval: ""
      relabelings: []
      scheme: ""
      scrapeTimeout: ""
      tlsConfig: {}

  # Either specify inline `key` and `secret` or refer to them via `existingSecret`
  ## @param gitea.oauth OAuth configuration
  oauth:
    []
    # - name: 'OAuth 1'
    #   provider:
    #   key:
    #   secret:
    #   existingSecret:
    #   autoDiscoverUrl:
    #   useCustomUrls:
    #   customAuthUrl:
    #   customTokenUrl:
    #   customProfileUrl:
    #   customEmailUrl:

  config:
    APP_NAME: "Gitea"
    server:
      ROOT_URL: "https://xxxxxxxxxxxxxxxxx/"
      SSH_PORT: 5022
      SSH_LISTEN_PORT: 22
    openid:
      ENABLE_OPENID_SIGNIN: "true"
      ENABLE_OPENID_SIGNUP: "true"
      WHITELISTED_URIS: auth.xxxxxx.fr
      OPENID_CONNECT_SCOPES: groups,profile,email
    service:
      DISABLE_REGISTRATION: "false"
      ALLOW_ONLY_EXTERNAL_REGISTRATION: "true"
      SHOW_REGISTRATION_BUTTON: "false"
      REQUIRE_SIGNIN_VIEW: "false"
      DEFAULT_ALLOW_CREATE_ORGANIZATION: "false"
      DEFAULT_KEEP_EMAIL_PRIVATE: "true"
    migrations:
      ALLOWED_DOMAINS: github.com,gitlab.com
    actions:
      ENABLED: "true"
      DEFAULT_ACTIONS_URL: github
      ARTIFACT_RETENTION_DAYS: 1
    repository:
      ANSI_CHARSET: UTF-8
    webhook:
      ALLOWED_HOST_LIST: loopback,private,external

  additionalConfigSources:
    - secret:
        secretName: gitea-gitea-config-database
    - secret:
        secretName: gitea-gitea-config-session
    - secret:
        secretName: gitea-gitea-config-mailer

redis-cluster:
  enabled: false

redis:
  enabled: false

postgresql-ha:
  enabled: false

postgresql:
  enabled: false

checkDeprecation: true
test:
  enabled: true
  image:
    name: busybox
    tag: latest

the init-app-ini container seems to works just fine

❯ k logs -n gitea pod/gitea-gitea-release-76d575ff56-8qb68 init-app-ini
...Initial secrets generated

Processing inlines...
queue
+ 'CONN_STR'
+ 'TYPE'
repository
+ 'ANSI_CHARSET'
+ 'ROOT'
webhook
+ 'ALLOWED_HOST_LIST'
metrics
+ 'ENABLED'
cache
+ 'ADAPTER'
+ 'HOST'
migrations
+ 'ALLOWED_DOMAINS'
indexer
+ 'ISSUE_INDEXER_TYPE'
service
+ 'ALLOW_ONLY_EXTERNAL_REGISTRATION'
+ 'DEFAULT_ALLOW_CREATE_ORGANIZATION'
+ 'DEFAULT_KEEP_EMAIL_PRIVATE'
+ 'DISABLE_REGISTRATION'
+ 'REQUIRE_SIGNIN_VIEW'
+ 'SHOW_REGISTRATION_BUTTON'
security
+ 'INSTALL_LOCK'
actions
+ 'ARTIFACT_RETENTION_DAYS'
+ 'DEFAULT_ACTIONS_URL'
+ 'ENABLED'
session
+ 'PROVIDER'
+ 'PROVIDER_CONFIG'
server
+ 'APP_DATA_PATH'
+ 'DOMAIN'
+ 'ENABLE_PPROF'
+ 'HTTP_PORT'
+ 'PROTOCOL'
+ 'ROOT_URL'
+ 'SSH_DOMAIN'
+ 'SSH_LISTEN_PORT'
+ 'SSH_PORT'
+ 'START_SSH_SERVER'
[ini root]
+ 'APP_NAME'
openid
+ 'ENABLE_OPENID_SIGNIN'
+ 'ENABLE_OPENID_SIGNUP'
+ 'OPENID_CONNECT_SCOPES'
+ 'WHITELISTED_URIS'

Processing additionals...
mailer
+ 'ENABLED'
+ 'PROTOCOL'
+ 'SMTP_ADDR'
+ 'SMTP_PORT'
+ 'USER'
+ 'PASSWD'
+ 'FROM'
session
+ 'PROVIDER'
+ 'COOKIE_SECURE'
+ 'PROVIDER_CONFIG'
database
+ 'TYPE'
+ 'HOST'
+ 'NAME'
+ 'USER'
+ 'PASSWD'

killing gitea deployment and mounting the pvc inside a busybox pod I can get the app.ini just fine

/mnt/pvc/gitea # cat conf/app.ini 
APP_NAME = <REDACTED>

[mailer]
PASSWD = <REDACTED>
SUBJECT_PREFIX = <REDACTED>
SMTP_ADDR = <REDACTED>
SMTP_PORT = 587
PROTOCOL = smtp+starttls
ENABLED = true
USER = <REDACTED>
FROM = <REDACTED>
SUBJECT_PREFIX=[Gitea]

[database]
NAME = gitea
TYPE = mysql
HOST = gitea-mariadb-release.gitea.svc.cluster.local:3306
USER = gitea
PASSWD = <REDACTED>

[indexer]
ISSUE_INDEXER_TYPE = db

[server]
LFS_JWT_SECRET = <REDACTED>
ROOT_URL = https://<REDACTED>/
ENABLE_PPROF = false
SSH_PORT = 5022
APP_DATA_PATH = /data
SSH_LISTEN_PORT = 22
PROTOCOL = http
HTTP_PORT = 3000
START_SSH_SERVER = true
SSH_DOMAIN = <REDACTED>
DOMAIN = <REDACTED>

[service]
ALLOW_ONLY_EXTERNAL_REGISTRATION = true
DEFAULT_KEEP_EMAIL_PRIVATE = true
REQUIRE_SIGNIN_VIEW = false
SHOW_REGISTRATION_BUTTON = false
DISABLE_REGISTRATION = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = false

[session]
PROVIDER = redis
PROVIDER_CONFIG = redis://<REDACTED>@redis.gitea.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s
COOKIE_SECURE = true

[actions]
ENABLED = true
ARTIFACT_RETENTION_DAYS = 1
DEFAULT_ACTIONS_URL = github

[openid]
WHITELISTED_URIS = <REDACTED>
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
OPENID_CONNECT_SCOPES = groups,profile,email

[repository]
ROOT = /data/git/gitea-repositories
ANSI_CHARSET = UTF-8

[webhook]
ALLOWED_HOST_LIST = loopback,private,external

[cache]
HOST = 
ADAPTER = memory

[security]
INTERNAL_TOKEN = <REDACTED>
SECRET_KEY = <REDACTED>
INSTALL_LOCK = true

[queue]
TYPE = level
CONN_STR = 

[metrics]
ENABLED = true

[migrations]
ALLOWED_DOMAINS = github.com,gitlab.com

[oauth2]
JWT_SECRET = <REDACTED>

passing values as environment variables either in deployment.env or the additionalConfigsFromEnvs yields the same result.

❯ k logs -n gitea pod/gitea-gitea-release-76d575ff56-vwjcw configure-gitea -f
==== BEGIN GITEA CONFIGURATION ====
2024/10/26 13:20:41 cmd/cmd.go:66:initDB() [F] Database settings are missing from the configuration file: "/data/gitea/conf/app.ini".
Ensure you are running in the correct environment or set the correct configuration file with -c.
If this is the intended configuration file complete the [database] section.
Gitea migrate might fail due to database connection...This init-container will try again in a few seconds
I tried deploying the chart in version `10.5.0` The `configure-gitea` will always fail stating that database infos aren't present even if the app.ini has them. values.yml ```yaml --- service: http: type: ClusterIP port: 3000 clusterIP: None ssh: type: ClusterIP port: 22 clusterIP: None ingress: enabled: true className: traefik-traefik-release annotations: external-dns.alpha.kubernetes.io/hostname: xxxxxxxxxxxxxx external-dns.alpha.kubernetes.io/target: xxxxxxxxxxxxxxxxxxx traefik.ingress.kubernetes.io/router.entrypoints: websecure,websecure-ext hosts: - host: xxxxxxxxxxxxxxxx paths: - path: / pathType: Prefix tls: - secretName: xxxxxxxxxxxxxx hosts: - xxxxxxxxxxxxxxx resources: limits: memory: 2048Mi requests: cpu: 768m memory: 1024Mi deployment: env: - name: USER_UID value: "1000" - name: USER_GID value: "1000" persistence: enabled: true create: true mount: true size: 50Gi accessModes: - ReadWriteOnce storageClass: csi-cinder-sc-delete gitea: admin: existingSecret: gitea-gitea-administrator metrics: enabled: true serviceMonitor: enabled: true # additionalLabels: # prometheus-release: prom1 interval: "" relabelings: [] scheme: "" scrapeTimeout: "" tlsConfig: {} # Either specify inline `key` and `secret` or refer to them via `existingSecret` ## @param gitea.oauth OAuth configuration oauth: [] # - name: 'OAuth 1' # provider: # key: # secret: # existingSecret: # autoDiscoverUrl: # useCustomUrls: # customAuthUrl: # customTokenUrl: # customProfileUrl: # customEmailUrl: config: APP_NAME: "Gitea" server: ROOT_URL: "https://xxxxxxxxxxxxxxxxx/" SSH_PORT: 5022 SSH_LISTEN_PORT: 22 openid: ENABLE_OPENID_SIGNIN: "true" ENABLE_OPENID_SIGNUP: "true" WHITELISTED_URIS: auth.xxxxxx.fr OPENID_CONNECT_SCOPES: groups,profile,email service: DISABLE_REGISTRATION: "false" ALLOW_ONLY_EXTERNAL_REGISTRATION: "true" SHOW_REGISTRATION_BUTTON: "false" REQUIRE_SIGNIN_VIEW: "false" DEFAULT_ALLOW_CREATE_ORGANIZATION: "false" DEFAULT_KEEP_EMAIL_PRIVATE: "true" migrations: ALLOWED_DOMAINS: github.com,gitlab.com actions: ENABLED: "true" DEFAULT_ACTIONS_URL: github ARTIFACT_RETENTION_DAYS: 1 repository: ANSI_CHARSET: UTF-8 webhook: ALLOWED_HOST_LIST: loopback,private,external additionalConfigSources: - secret: secretName: gitea-gitea-config-database - secret: secretName: gitea-gitea-config-session - secret: secretName: gitea-gitea-config-mailer redis-cluster: enabled: false redis: enabled: false postgresql-ha: enabled: false postgresql: enabled: false checkDeprecation: true test: enabled: true image: name: busybox tag: latest ``` the init-app-ini container seems to works just fine ❯ k logs -n gitea pod/gitea-gitea-release-76d575ff56-8qb68 init-app-ini ...Initial secrets generated Processing inlines... queue + 'CONN_STR' + 'TYPE' repository + 'ANSI_CHARSET' + 'ROOT' webhook + 'ALLOWED_HOST_LIST' metrics + 'ENABLED' cache + 'ADAPTER' + 'HOST' migrations + 'ALLOWED_DOMAINS' indexer + 'ISSUE_INDEXER_TYPE' service + 'ALLOW_ONLY_EXTERNAL_REGISTRATION' + 'DEFAULT_ALLOW_CREATE_ORGANIZATION' + 'DEFAULT_KEEP_EMAIL_PRIVATE' + 'DISABLE_REGISTRATION' + 'REQUIRE_SIGNIN_VIEW' + 'SHOW_REGISTRATION_BUTTON' security + 'INSTALL_LOCK' actions + 'ARTIFACT_RETENTION_DAYS' + 'DEFAULT_ACTIONS_URL' + 'ENABLED' session + 'PROVIDER' + 'PROVIDER_CONFIG' server + 'APP_DATA_PATH' + 'DOMAIN' + 'ENABLE_PPROF' + 'HTTP_PORT' + 'PROTOCOL' + 'ROOT_URL' + 'SSH_DOMAIN' + 'SSH_LISTEN_PORT' + 'SSH_PORT' + 'START_SSH_SERVER' [ini root] + 'APP_NAME' openid + 'ENABLE_OPENID_SIGNIN' + 'ENABLE_OPENID_SIGNUP' + 'OPENID_CONNECT_SCOPES' + 'WHITELISTED_URIS' Processing additionals... mailer + 'ENABLED' + 'PROTOCOL' + 'SMTP_ADDR' + 'SMTP_PORT' + 'USER' + 'PASSWD' + 'FROM' session + 'PROVIDER' + 'COOKIE_SECURE' + 'PROVIDER_CONFIG' database + 'TYPE' + 'HOST' + 'NAME' + 'USER' + 'PASSWD' killing gitea deployment and mounting the pvc inside a busybox pod I can get the app.ini just fine ```bash /mnt/pvc/gitea # cat conf/app.ini APP_NAME = <REDACTED> [mailer] PASSWD = <REDACTED> SUBJECT_PREFIX = <REDACTED> SMTP_ADDR = <REDACTED> SMTP_PORT = 587 PROTOCOL = smtp+starttls ENABLED = true USER = <REDACTED> FROM = <REDACTED> SUBJECT_PREFIX=[Gitea] [database] NAME = gitea TYPE = mysql HOST = gitea-mariadb-release.gitea.svc.cluster.local:3306 USER = gitea PASSWD = <REDACTED> [indexer] ISSUE_INDEXER_TYPE = db [server] LFS_JWT_SECRET = <REDACTED> ROOT_URL = https://<REDACTED>/ ENABLE_PPROF = false SSH_PORT = 5022 APP_DATA_PATH = /data SSH_LISTEN_PORT = 22 PROTOCOL = http HTTP_PORT = 3000 START_SSH_SERVER = true SSH_DOMAIN = <REDACTED> DOMAIN = <REDACTED> [service] ALLOW_ONLY_EXTERNAL_REGISTRATION = true DEFAULT_KEEP_EMAIL_PRIVATE = true REQUIRE_SIGNIN_VIEW = false SHOW_REGISTRATION_BUTTON = false DISABLE_REGISTRATION = false DEFAULT_ALLOW_CREATE_ORGANIZATION = false [session] PROVIDER = redis PROVIDER_CONFIG = redis://<REDACTED>@redis.gitea.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s COOKIE_SECURE = true [actions] ENABLED = true ARTIFACT_RETENTION_DAYS = 1 DEFAULT_ACTIONS_URL = github [openid] WHITELISTED_URIS = <REDACTED> ENABLE_OPENID_SIGNIN = true ENABLE_OPENID_SIGNUP = true OPENID_CONNECT_SCOPES = groups,profile,email [repository] ROOT = /data/git/gitea-repositories ANSI_CHARSET = UTF-8 [webhook] ALLOWED_HOST_LIST = loopback,private,external [cache] HOST = ADAPTER = memory [security] INTERNAL_TOKEN = <REDACTED> SECRET_KEY = <REDACTED> INSTALL_LOCK = true [queue] TYPE = level CONN_STR = [metrics] ENABLED = true [migrations] ALLOWED_DOMAINS = github.com,gitlab.com [oauth2] JWT_SECRET = <REDACTED> ``` passing values as environment variables either in `deployment.env` or the `additionalConfigsFromEnvs` yields the same result. ```bash ❯ k logs -n gitea pod/gitea-gitea-release-76d575ff56-vwjcw configure-gitea -f ==== BEGIN GITEA CONFIGURATION ==== 2024/10/26 13:20:41 cmd/cmd.go:66:initDB() [F] Database settings are missing from the configuration file: "/data/gitea/conf/app.ini". Ensure you are running in the correct environment or set the correct configuration file with -c. If this is the intended configuration file complete the [database] section. Gitea migrate might fail due to database connection...This init-container will try again in a few seconds ```
ednxzu commented 2024-10-26 14:41:39 +00:00 (Migrated from gitea.com)

Nevermind I am dumb and should've change TYPE by DB_TYPE under the database section.

Nevermind I am dumb and should've change `TYPE` by `DB_TYPE` under the database section.
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#720
No description provided.