Skip to content

Commit

Permalink
Merge pull request #587 from application-stacks/kirby-topology-annota…
Browse files Browse the repository at this point in the history
…tions

Add service annotations for topology aware routing
  • Loading branch information
kabicin authored Oct 30, 2023
2 parents 66e9415 + 4d6cb32 commit 96eb9e6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func ErrorIsNoMatchesForKind(err error, kind string, version string) bool {
func CustomizeService(svc *corev1.Service, ba common.BaseComponent) {
obj := ba.(metav1.Object)
svc.Labels = ba.GetLabels()
CustomizeServiceAnnotations(svc)
svc.Annotations = MergeMaps(svc.Annotations, ba.GetAnnotations())

if len(svc.Spec.Ports) == 0 {
Expand Down Expand Up @@ -268,6 +269,14 @@ func CustomizeService(svc *corev1.Service, ba common.BaseComponent) {
}
}

func CustomizeServiceAnnotations(svc *corev1.Service) {
// Enable topology aware hints/routing
serviceAnnotations := make(map[string]string)
serviceAnnotations["service.kubernetes.io/topology-aware-hints"] = "Auto" // Topology Aware Hints (< k8s version 1.27)
serviceAnnotations["service.kubernetes.io/topology-mode"] = "Auto" // Topology Aware Routing (>= k8s version 1.27)
svc.Annotations = MergeMaps(svc.Annotations, serviceAnnotations)
}

func CustomizeProbes(container *corev1.Container, ba common.BaseComponent) {
probesConfig := ba.GetProbes()

Expand Down

0 comments on commit 96eb9e6

Please sign in to comment.