Skip to content

Commit

Permalink
Backport of Helm: support sync-lb-services-endpoints for sync catalog…
Browse files Browse the repository at this point in the history
… into release/1.3.x (#3912)

* backport of commit dd794d3

* backport of commit eddf330

* backport of commit 7273684

---------

Co-authored-by: jukie <[email protected]>
Co-authored-by: Michael Zalimeni <[email protected]>
  • Loading branch information
3 people committed Apr 16, 2024
1 parent b7c7706 commit ebddf11
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
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 @@ -192,6 +192,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 @@ -2182,6 +2182,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

0 comments on commit ebddf11

Please sign in to comment.