Skip to content

Commit

Permalink
Merge pull request hashicorp#54 from hashicorp/bugfix/28
Browse files Browse the repository at this point in the history
Pipe through the default flag for catalog sync
  • Loading branch information
Rebecca Zanzig authored Oct 31, 2018
2 parents ff23e56 + 6c29f29 commit c37b045
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions templates/sync-catalog-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec:
- |
consul-k8s sync-catalog \
-http-addr=${HOST_IP}:8500 \
-k8s-default-sync={{ .Values.syncCatalog.default }} \
{{- if (not .Values.syncCatalog.toConsul) }}
-to-consul=false \
{{- end }}
Expand Down
24 changes: 24 additions & 0 deletions test/unit/sync-catalog-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,30 @@ load _helpers
[ "${actual}" = "bar" ]
}

#--------------------------------------------------------------------
# default sync

@test "syncCatalog/Deployment: default sync is true by default" {
cd `chart_dir`
local actual=$(helm template \
-x templates/sync-catalog-deployment.yaml \
--set 'syncCatalog.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].command | any(contains("-k8s-default-sync=true"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "syncCatalog/Deployment: default sync can be turned off" {
cd `chart_dir`
local actual=$(helm template \
-x templates/sync-catalog-deployment.yaml \
--set 'syncCatalog.enabled=true' \
--set 'syncCatalog.default=false' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].command | any(contains("-k8s-default-sync=false"))' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# toConsul and toK8S

Expand Down
1 change: 1 addition & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ syncCatalog:
# True if you want to enable the catalog sync. "-" for default.
enabled: false
image: null
default: true # true will sync by default, otherwise requires annotation

# Enabling rbac will create cluster roles and cluster role bindings to
# allow the syncCatalog service to communicate with the kubernetes api
Expand Down

0 comments on commit c37b045

Please sign in to comment.