Skip to content

Commit

Permalink
allow spaces for AZURE_SERVICEDISCOVERY_SUBSCRIPTION_ID
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Blaschke <[email protected]>
  • Loading branch information
mblaschke committed Sep 4, 2023
1 parent 1b446ed commit 501ff6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion azuresdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| Variable name | Default | Description |
|----------------------------------------------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `AZURE_SERVICEDISCOVERY_CACHE_TTL` | `60m` (time.Duration) | ServiceDiscovery cache (eg. subscription, resourceGroup list,...) |
| `AZURE_SERVICEDISCOVERY_SUBSCRIPTION_ID` | | Subscription IDs separated by commas (whitespaces are trimmed) |
| `AZURE_SERVICEDISCOVERY_SUBSCRIPTION_ID` | | Subscription IDs separated by commas or spaces (whitespaces are trimmed) |
| `AZURE_SERVICEDISCOVERY_SUBSCRIPTION_TAG_SELECTOR` | | Tag selector `tagName=tagValue,tagName2=tagValue2` to filter subscriptions for ServiceDiscovery (uses [kubernetes label selector library](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors)) |

### Authentication
Expand Down
3 changes: 3 additions & 0 deletions azuresdk/armclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ func (azureClient *ArmClient) initServiceDiscovery() {
// use fixed list of subscription ids
if val := os.Getenv(EnvVarServiceDiscoverySubscriptionId); val != "" {
azureClient.serviceDiscovery.subscriptionIds = []string{}
// replace spaces with commas,
// we should be able to use both for easier usage in yaml files
val = strings.ReplaceAll(val, " ", ",")
for _, subscriptionId := range strings.Split(val, ",") {
subscriptionId = strings.TrimSpace(subscriptionId)
if subscriptionId != "" {
Expand Down

0 comments on commit 501ff6f

Please sign in to comment.