Skip to content

Conversation

@ignaciogonzalezsomoza
Copy link
Contributor

Summary

This PR adds support for secondaryVisibilityStore configuration to enable the dual visibility feature in Temporal server. This allows writing to two visibility stores simultaneously, which is useful for migration scenarios (e.g., migrating from Cassandra to Elasticsearch for visibility).

Changes

  • _helpers.tpl:
    • Added secondaryVisibilityStore support in temporal.persistence.filterConfig function
    • Updated temporal.persistence.eachStore to include secondary visibility store in iteration
  • server-deployment.yaml:
    • Added TEMPORAL_SECONDARY_VISIBILITY_STORE_PASSWORD environment variable to server pods
    • Added conditional logic to inject the env var only when secondaryVisibilityStore is configured
  • Tests:
    • Added unit tests for ConfigMap generation with secondary visibility store
    • Added unit tests for environment variable injection

Implementation Details

This implementation leverages the V1 chart architecture's centralized helper functions, avoiding the code duplication present in PR #803 (which targeted v0.x). The key improvements:

  1. Single source of truth: All persistence configuration flows through temporal.persistence.filterConfig
  2. Automatic propagation: Schema jobs and deployments automatically process the secondary store via temporal.persistence.eachStore
  3. Backward compatible: Charts without secondaryVisibilityStore configured continue to work as before

Testing

Tested in a development cluster with:

  • Primary visibility store: Elasticsearch v8 (temporal_visibility_v1_dev)
  • Secondary visibility store: Elasticsearch v8 (temporal_visibility_v1_dev_readonly)

Verified that:

  • ConfigMap contains both visibility stores
  • Environment variables are injected correctly
  • Pods start successfully
  • Workflows are written to both indices simultaneously
  • Schema jobs process secondary visibility store
  • Unit tests pass

Related

Closes #803

This PR adapts the changes from #803 to the V1 chart structure, making them compatible with the refactored architecture introduced in the V1 release.

Documentation

Example configuration:

server:
  config:
    persistence:
      defaultStore: default
      visibilityStore: visibility
      secondaryVisibilityStore: secondary-visibility  # New
      datastores:
        default:
          sql: ...
        visibility:
          elasticsearch: ...
        secondary-visibility:  # New secondary store
          elasticsearch:
            version: v8
            indices:
              visibility: temporal_visibility_readonly
            # ... other ES config

@ignaciogonzalezsomoza ignaciogonzalezsomoza requested a review from a team as a code owner January 22, 2026 10:43
@CLAassistant
Copy link

CLAassistant commented Jan 22, 2026

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Add support for secondaryVisibilityStore configuration to enable dual
visibility feature in Temporal server. This allows writing to two
visibility stores simultaneously for migration scenarios.

Changes:
- Add secondaryVisibilityStore support in temporal.persistence.filterConfig
- Include secondaryVisibility in temporal.persistence.eachStore iteration
- Add TEMPORAL_SECONDARY_VISIBILITY_STORE_PASSWORD env var to server pods
- Automatically process secondary visibility store in schema jobs

This implementation adapts PR temporalio#803 to the V1 chart architecture,
leveraging the centralized helper functions introduced in V1 to avoid
code duplication.

Resolves: temporalio#803
Add helm-unittest tests to verify:
- ConfigMap contains secondaryVisibilityStore configuration
- Secondary visibility password uses correct env var placeholder
- Environment variable is injected when secondaryVisibilityStore is configured
- Environment variable is not injected when secondaryVisibilityStore is absent
Remove redundant check for  in the conditional.
When  is empty, eq comparison will be false,
making the extra 'and' check unnecessary.
Make getStoreByType return an empty dict when the store isn't configured,
removing the need for special-case logic in eachStore. This treats
secondaryVisibility consistently with other stores.

This change:
- Adds a check in getStoreByType to return empty dict if storeName is nil
- Simplifies eachStore to use getStoreByType for all stores including secondary
- Makes secondary visibility less of an exceptional case
@ignaciogonzalezsomoza ignaciogonzalezsomoza force-pushed the feat/add-secondary-visibility-store-support branch from 1c6bb3f to b222fc9 Compare January 23, 2026 08:53
Remove unresolved conflict markers
@robholland robholland added the needs revision Team has requested some changes label Jan 27, 2026
…ment

Use getStoreByType for secondaryVisibility to be consistent with
default and visibility stores. This removes special-case logic and
makes the code cleaner by:

- Using getStoreByType which returns empty dict when not configured
- Checking $secondaryVisibilityStore variable instead of .Values path
@robholland
Copy link
Contributor

Looks good, please resolve conflicts and then I can get this merged.

@robholland
Copy link
Contributor

Hey @ignaciogonzalezsomoza, please could you merge main, then I can get your PR merged :)

Keep both tests:
- Secondary visibility store for dual visibility (from this PR)
- Metrics config (from upstream)
The secret name should include 'temporal-' prefix to match
the template output.
@ignaciogonzalezsomoza
Copy link
Contributor Author

chore
Fixed the failing test in commit 046312f. The secret name was missing the temporal- prefix.
Ready to merge once CI passes.

@robholland robholland merged commit 77e0802 into temporalio:main Feb 4, 2026
4 checks passed
@robholland
Copy link
Contributor

🎉

@robholland robholland removed needs revision Team has requested some changes labels Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants