Skip to content

[FEATURE] Support Redis and Sentinel affinity configuration #85

Open

Description

Problem Description

Cozystack PR #2665 adds Redis.spec.affinity.redis and Redis.spec.affinity.sentinel, but the Terraform provider's typed resources and data sources do not expose these fields. Users cannot configure these Kubernetes scheduling rules through the provider.

Proposed Solution

Add optional affinity support to the Redis and Sentinel resource and data source schemas, models, and expand/flatten mappings. Preserve arbitrary Kubernetes Affinity fields and omit unset rules so existing scheduling behavior remains intact. Add round-trip and omission tests, update examples, and regenerate provider documentation. For Redis and Sentinel, configured affinity replaces the operator's default soft pod anti-affinity; document that users should include podAntiAffinity unless co-location is intended.

Alternatives Considered

Manage affinity outside the typed Terraform resources. This leaves scheduling configuration outside the provider's declared resource interface.

Additional Context

Upstream change: cozystack/cozystack#2665. API source: https://github.com/kastakhov/cozystack/blob/redis-affinity/api/apps/v1alpha1/redis/types.go (branch is in the contributor fork; see the PR for the authoritative head).

This tracks downstream provider implementation separately from the upstream application change.

Environment (if relevant)

  • Provider Version: Current master; no deployed provider version is required to reproduce the missing schema fields.
  • Cozystack Version: Pending upstream PR #2665.
  • Use Case: Configure Kubernetes affinity for Redis and Sentinel pods through Terraform resources and read it through data sources.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions