tektoncd/operator

TektonResult DB_HOST and DB_NAME are ignored

maxhov opened this issue · 2 comments

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
  1. 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

  • Kubernetes version:
    Client Version: v1.28.2
    Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
    Server Version: v1.27.2

  • Tekton Pipeline version:
    v0.50.3

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?

/assign @khrm