helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

fix: Populate SQL_CONNECT_ATTRIBUTES in admintools and schema job

Open adigiorgi-clickup opened this issue 1 year ago • 1 comments

What was changed

When server.persistence.config.*.sql.connectAttributes is set, also populate the SQL_CONNECT_ATTRIBUTES env var in the temporal-schema job. According to https://github.com/temporalio/temporal/blob/main/tools/sql/handler.go#L157, the SQL_CONNECT_ATTRIBUTE env var must be in this format: key1=value1&key2=value.

Why?

If users want to use a different schema than public, they need to set the connectAttribute value to something like search_path: temporal. With this PR, the temporal-schema job will know about it and create tables in the right schema.

Checklist

  1. Closes #561

  2. How was this tested:

    1. helm lint charts/temporal
    2. Add connectAttributes to charts/temporal/values/values.postgresql.yaml:
    connectAttributes:
      search_path: temporal
      foo_bar: baz
    
    1. helm template my-release charts/temporal -f charts/temporal/values/values.postgresql.yaml
    2. Check the resulting yaml contains the SQL_CONNECT_ATTRIBUTES env var:
      - name: SQL_CONNECT_ATTRIBUTES
        value: "foo_bar=baz&search_path=temporal"
      
    3. Run step iii against main and against my branch, checking the resulting yamls are the same.

adigiorgi-clickup avatar Sep 27 '24 22:09 adigiorgi-clickup

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 27 '24 22:09 CLAassistant

@robholland, sorry for the ping! Anything I can do to help push this forward?

adigiorgi-clickup avatar Oct 31 '24 23:10 adigiorgi-clickup

Please merge https://github.com/temporalio/helm-charts/tree/rh-sql-connect-attributes which contains a failing test for this, and then adjust as required.

robholland avatar Nov 07 '24 15:11 robholland

You can run with go test -timeout 30s -run ^TestAdminToolsSqlConnectAttributes$ github.com/temporalio/helm-charts from the charts/temporal/tests directoy.

robholland avatar Nov 07 '24 15:11 robholland

@adigiorgi-clickup ping :)

robholland avatar Dec 04 '24 14:12 robholland

@robholland, sorry! Been super busy at work! I fixed my code and pushed it! 🙏

adigiorgi-clickup avatar Dec 05 '24 04:12 adigiorgi-clickup