Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3905.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
helm: support sync-lb-services-endpoints flag for syncCatalog
```
3 changes: 3 additions & 0 deletions charts/consul/templates/sync-catalog-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ spec:
-loadBalancer-ips=true \
{{- end }}
{{- end }}
{{- if .Values.syncCatalog.syncLoadBalancerEndpoints }}
-sync-lb-services-endpoints=true \
{{- end }}
livenessProbe:
httpGet:
path: /health/ready
Expand Down
23 changes: 23 additions & 0 deletions charts/consul/test/unit/sync-catalog-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,29 @@ load _helpers
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# syncLoadBalancerEndpoints

@test "syncCatalog/Deployment: enable LB endpoints sync flag not passed when disabled" {
cd `chart_dir`
local actual=$(helm template \
-s templates/sync-catalog-deployment.yaml \
--set 'syncCatalog.enabled=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].command | any(contains("-sync-lb-services-endpoints=true"))' | tee /dev/stderr)
[ "${actual}" = "false" ]
}
@test "syncCatalog/Deployment: enable LB endpoints sync flag passed when enabled" {
cd `chart_dir`
local actual=$(helm template \
-s templates/sync-catalog-deployment.yaml \
--set 'syncCatalog.enabled=true' \
--set 'syncCatalog.syncLoadBalancerEndpoints=true' \
. | tee /dev/stderr |
yq '.spec.template.spec.containers[0].command | any(contains("-sync-lb-services-endpoints=true"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# affinity

Expand Down
4 changes: 4 additions & 0 deletions charts/consul/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,10 @@ syncCatalog:
# Set this to false to skip syncing ClusterIP services.
syncClusterIPServices: true

# If true, LoadBalancer service endpoints instead of ingress addresses will be synced to Consul.
# If false, LoadBalancer endpoints are not synced to Consul.
syncLoadBalancerEndpoints: false

ingress:
# Syncs the hostname from a Kubernetes Ingress resource to service registrations
# when a rule matched a service. Currently only supports host based routing and
Expand Down