Skip to content

Commit

Permalink
fix(deck): create empty providers.kubernetes entry if provider is ena…
Browse files Browse the repository at this point in the history
…bled (#108)

As explained in this [PR](spinnaker/deck#8381), the Kubernetes provider does not have any statically configured defaults in Deck. However, the registration of the Kubernetes cloud provider in Deck depends on the truthiness of `providers.kubernetes`.
  • Loading branch information
maggieneterval authored Jun 25, 2020
1 parent 0c7699f commit 85d1f3c
Show file tree
Hide file tree
Showing 6 changed files with 272 additions and 155 deletions.
378 changes: 223 additions & 155 deletions api/client/config/deck.pb.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions api/proto/config/deck.proto
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ message Deck {
// Tencent Cloud provider defaults.
TencentCloud tencentcloud = 9;

Kubernetes kubernetes = 10;

message Appengine {
Defaults defaults = 1;
message Defaults {
Expand Down Expand Up @@ -230,5 +232,10 @@ message Deck {
string region = 2;
}
}

// The Kubernetes provider has no statically-configured defaults,
// but Deck currently registers each cloud provider based on the existence
// of an entry in the `providers` block.
message Kubernetes {}
}
}
14 changes: 14 additions & 0 deletions docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
- [Deck.Providers.Gce.Defaults](#proto.config.Deck.Providers.Gce.Defaults)
- [Deck.Providers.HuaweiCloud](#proto.config.Deck.Providers.HuaweiCloud)
- [Deck.Providers.HuaweiCloud.Defaults](#proto.config.Deck.Providers.HuaweiCloud.Defaults)
- [Deck.Providers.Kubernetes](#proto.config.Deck.Providers.Kubernetes)
- [Deck.Providers.TencentCloud](#proto.config.Deck.Providers.TencentCloud)
- [Deck.Providers.TencentCloud.Defaults](#proto.config.Deck.Providers.TencentCloud.Defaults)

Expand Down Expand Up @@ -3450,6 +3451,7 @@ UI-specific provider default settings.
| gce | [Deck.Providers.Gce](#proto.config.Deck.Providers.Gce) | | GCE provider defaults. |
| huaweicloud | [Deck.Providers.HuaweiCloud](#proto.config.Deck.Providers.HuaweiCloud) | | Huawei Cloud provider defaults. |
| tencentcloud | [Deck.Providers.TencentCloud](#proto.config.Deck.Providers.TencentCloud) | | Tencent Cloud provider defaults. |
| kubernetes | [Deck.Providers.Kubernetes](#proto.config.Deck.Providers.Kubernetes) | | |



Expand Down Expand Up @@ -3700,6 +3702,18 @@ UI-specific provider default settings.



<a name="proto.config.Deck.Providers.Kubernetes"></a>

### Deck.Providers.Kubernetes
The Kubernetes provider has no statically-configured defaults,
but Deck currently registers each cloud provider based on the existence
of an entry in the `providers` block.






<a name="proto.config.Deck.Providers.TencentCloud"></a>

### Deck.Providers.TencentCloud
Expand Down
4 changes: 4 additions & 0 deletions internal/convert/deck.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,5 +222,9 @@ func getDeckProvidersConfig(h *config.Hal) *config.Deck_Providers {
}
}

if h.GetProviders().GetKubernetes().GetEnabled().GetValue() {
providers.Kubernetes = &config.Deck_Providers_Kubernetes{}
}

return providers
}
23 changes: 23 additions & 0 deletions internal/convert/deck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,29 @@ var deckTests = configTest{
},
},
},
{
"Enabled provider without defaults",
&config.Hal{
Providers: &cloudprovider.Providers{
Kubernetes: &cloudprovider.Kubernetes{
Enabled: wrapperspb.Bool(true),
},
},
},
&config.Deck{
GateUrl: "http://localhost:8084",
AuthEndpoint: "http://localhost:8084/auth/user",
BakeryDetailUrl: "http://localhost:8084/bakery/logs/{{context.region}}/{{context.status.resourceId}}",
Canary: &config.Deck_Canary{
FeatureDisabled: wrapperspb.Bool(true),
},
Feature: &config.Deck_Features{},
Notifications: &config.Deck_Notifications{},
Providers: &config.Deck_Providers{
Kubernetes: &config.Deck_Providers_Kubernetes{},
},
},
},
{
"Override gate URL",
&config.Hal{
Expand Down
1 change: 1 addition & 0 deletions testdata/deck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ providers:
defaults:
account: my-huawei-account
region: us-east1
kubernetes: {}
defaultTimeZone: America/Chicago
version: master-latest-unvalidated

0 comments on commit 85d1f3c

Please sign in to comment.