tektoncd / operator

Kubernetes operator to manage installation, updation and uninstallation of tektoncd projects (pipeline, …)
Apache License 2.0
442 stars 191 forks source link

TektonResult DB_HOST and DB_NAME are ignored #1871

Open maxhov opened 10 months ago

maxhov commented 10 months ago

Expected Behavior

When using an external DB and setting the db_host and db_name parameters in TektonResult, I would expect that these setting are used.

Actual Behavior

The db_host and db_name settings are ignored and the defaults for db_host (tekton-results-postgres-service.tekton-pipelines.svc.cluster.local) and db_name (tekton-results) are used, regardless of the parameters set in the TektonResult.

Steps to Reproduce the Problem

  1. Deploy Tekton operator (latest)

  2. Follow the deployment steps to deploy an external database described here: https://tekton.dev/docs/operator/tektonresult/#external-db

  3. Define a TektonResult config as follows:

    apiVersion: operator.tekton.dev/v1alpha1
    kind: TektonResult
    metadata:
    name: result
    spec:
    targetNamespace: tekton-pipelines
    db_host: localhost
    db_port: 5432
    is_external_db: true
  4. Observe that the deployed results api service is not using the provided db_host and db_name. It should be shown in the logs.

Additional Info

Possible cause

The DB_HOST and DB_NAME environment variables seem to be statically set in the Deployment of the api server. My best guess is that the environment variables override the provided settings here: https://github.com/tektoncd/results/blob/11ea190c693471a8171c24de4a6507f792c5efd9/pkg/api/server/config/config.go#L52 and thus the provided config is ignored. Is it intended that the DB_HOST and DB_NAME are set in the deployment?

vdemeester commented 10 months ago

cc @khrm

khrm commented 10 months ago

/assign @khrm