Skip to content

[DPE-9751] add K8s services for primary and replica endpoints#46

Merged
reneradoi merged 9 commits into9/edgefrom
add-k8s-services
Apr 23, 2026
Merged

[DPE-9751] add K8s services for primary and replica endpoints#46
reneradoi merged 9 commits into9/edgefrom
add-k8s-services

Conversation

@reneradoi
Copy link
Copy Markdown
Contributor

@reneradoi reneradoi commented Apr 17, 2026

This PR adds Kubernetes services for primary and replica endpoints, which can be used by clients to connect to Valkey.

Design:

  • add new class K8sClient, that provides methods for creating/updating K8s services and for adding labels to pods
  • add new method reconcile_k8s_services() to the Sentinel manager class that calls the K8s client methods, based on the current deployment and primary/replica setup
  • the services are owned by the stateful set of the application, meaning they will be removed on application removal
  • trigger the reconcile_k8s_services() on the leader unit on any peer relation change, to update the ports if required
  • publish the K8s services instead of unit endpoints to client relation data on K8s

Other changes:

  • add the services to DNS SANs for the TLS certificate requests
  • update rust to 1.94.0 to allow building lightkube

Integration testing is covered by the existing tests for client relations. The requirer-charms will now connect via the services in the tests on K8s.

@reneradoi reneradoi marked this pull request as ready for review April 17, 2026 12:32
Copy link
Copy Markdown
Contributor

@Mehdi-Bendriss Mehdi-Bendriss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks René! Really clean, only 1 comment from my side

Comment thread src/common/k8s_client.py Outdated
Comment thread src/managers/tls.py
Copy link
Copy Markdown
Contributor

@skourta skourta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comments. Thank you @reneradoi

Comment thread src/managers/sentinel.py
Comment thread src/common/k8s_client.py
Comment thread src/common/k8s_client.py
Comment thread src/events/external_clients.py
Comment thread src/events/external_clients.py Outdated
Comment thread src/managers/sentinel.py
@reneradoi reneradoi requested a review from skourta April 23, 2026 12:27
Copy link
Copy Markdown
Contributor

@Mehdi-Bendriss Mehdi-Bendriss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks René! approved, merge pending CI pass

Copy link
Copy Markdown
Contributor

@skourta skourta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @reneradoi

@reneradoi reneradoi merged commit bfc3a4d into 9/edge Apr 23, 2026
161 of 165 checks passed
@reneradoi reneradoi deleted the add-k8s-services branch April 23, 2026 16:11
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