Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalog: Use EndpointSlice and propagate Kubernetes Topology information to synced consul service #3693

Merged
merged 18 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3693.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
catalog: Topology zone and region information is now read from the Kubernetes endpoints and associated node and added to registered consul services under Metadata.
```
16 changes: 14 additions & 2 deletions charts/consul/templates/sync-catalog-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,19 @@ rules:
- apiGroups: [ "" ]
resources:
- services
- endpoints
verbs:
- get
- list
- watch
{{- if .Values.syncCatalog.toK8S }}
- update
- patch
- delete
- create
{{- end }}
- apiGroups: ["discovery.k8s.io"]
resources:
- endpointslices
verbs:
- get
- list
Expand Down Expand Up @@ -45,4 +57,4 @@ rules:
- get
- list
- watch
{{- end }}
{{- end }}
10 changes: 9 additions & 1 deletion charts/consul/test/unit/sync-catalog-clusterrole.bats
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ load _helpers
--set 'syncCatalog.enabled=true' \
--set 'global.enablePodSecurityPolicies=true' \
. | tee /dev/stderr |
yq -r '.rules[2].resources[0]' | tee /dev/stderr)
yq -r '.rules[3].resources[0]' | tee /dev/stderr)
[ "${actual}" = "podsecuritypolicies" ]
}

Expand All @@ -83,4 +83,12 @@ load _helpers
. | tee /dev/stderr |
yq -c '.rules[0].verbs' | tee /dev/stderr)
[ "${actual}" = '["get","list","watch","update","patch","delete","create"]' ]

actual=$(helm template \
-s templates/sync-catalog-clusterrole.yaml \
--set 'syncCatalog.enabled=true' \
--set 'syncCatalog.toK8S=true' \
. | tee /dev/stderr |
yq -c '.rules[0].verbs' | tee /dev/stderr)
[ "${actual}" = '["get","list","watch","update","patch","delete","create"]' ]
}