Skip to content

Commit

Permalink
Fix JSON tags on boolean Helm value struct fields (#1359)
Browse files Browse the repository at this point in the history
* Fix JSON tag on settings.create Helm value struct field
* Change just settings.create
* Update changelog/v0.20.5/fix-helm-values-struct-json-tag.yaml

Co-Authored-By: Kevin Dorosh <kcdorosh@gmail.com>
* Fix other fields as well
* Fix helm test
  • Loading branch information
marcogschmidt authored and soloio-bulldozer[bot] committed Oct 9, 2019
1 parent 60a312f commit afad52b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions changelog/v0.20.5/fix-helm-values-struct-json-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changelog:
- type: FIX
description: >
Some boolean fields on Helm value structs have an `omitempty` json tag. This causes the JSON encoder to
considered the whole struct empty in cases where we only the boolean field is set to false and might lead to
unexpected behavior.
issueLink: https://github.com/solo-io/gloo/issues/1360
10 changes: 5 additions & 5 deletions install/helm/gloo/generate/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ type Settings struct {
WatchNamespaces []string `json:"watchNamespaces,omitempty" desc:"whitelist of namespaces for gloo to watch for services and CRDs. Empty list means all namespaces"`
WriteNamespace string `json:"writeNamespace,omitempty" desc:"namespace where intermediary CRDs will be written to, e.g. Upstreams written by Gloo Discovery."`
Integrations *Integrations `json:"integrations,omitempty"`
Create bool `json:"create,omitempty" desc:"create a Settings CRD which provides bootstrap configuration to Gloo controllers"`
Create bool `json:"create" desc:"create a Settings CRD which provides bootstrap configuration to Gloo controllers"`
Extensions interface{} `json:"extensions,omitempty"`
SingleNamespace bool `json:"singleNamespace,omitempty" desc:"Enable to use install namespace as WatchNamespace and WriteNamespace"`
SingleNamespace bool `json:"singleNamespace" desc:"Enable to use install namespace as WatchNamespace and WriteNamespace"`
}

type Gloo struct {
Expand Down Expand Up @@ -176,7 +176,7 @@ type GatewayProxy struct {

type GatewayProxyGatewaySettings struct {
DisableGeneratedGateways bool `json:"disableGeneratedGateways" desc:"set to true to disable the gateway generation for a gateway proxy"`
UseProxyProto bool `json:"useProxyProto,omitempty" desc:"use proxy protocol"`
UseProxyProto bool `json:"useProxyProto" desc:"use proxy protocol"`
CustomHttpGateway string `json:"customHttpGateway,omitempty" desc:"custom yaml to use for http gateway settings"`
CustomHttpsGateway string `json:"customHttpsGateway,omitempty" desc:"custom yaml to use for https gateway settings"`
}
Expand Down Expand Up @@ -229,7 +229,7 @@ type AccessLogger struct {
Image *Image `json:"image,omitempty"`
Port uint `json:"port,omitempty"`
ServiceName string `json:"serviceName,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Enabled bool `json:"enableds"`
*DeploymentSpec
}

Expand All @@ -240,7 +240,7 @@ type GatewayProxyConfigMap struct {
type Ingress struct {
Enabled *bool `json:"enabled"`
Deployment *IngressDeployment `json:"deployment,omitempty"`
RequireIngressClass *bool `json:"requireIngressClass,omitempty" desc:"only serve traffic for Ingress objects with the annotation 'kubernetes.io/ingress.class: gloo''"`
RequireIngressClass *bool `json:"requireIngressClass" desc:"only serve traffic for Ingress objects with the annotation 'kubernetes.io/ingress.class: gloo''"`
}

type IngressDeployment struct {
Expand Down
4 changes: 2 additions & 2 deletions install/test/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ var _ = Describe("Helm Test", func() {
Expect(gateway1.Ssl).To(BeFalse())
Expect(gateway1.BindPort).To(Equal(uint32(8080)))
Expect(gateway1.ProxyNames).To(Equal(proxyNames))
Expect(gateway1.UseProxyProto).To(BeNil())
Expect(gateway1.UseProxyProto).To(Equal(&types.BoolValue{Value: false}))
Expect(gateway1.BindAddress).To(Equal(defaults.GatewayBindAddress))
gatewayUns = testManifest.ExpectCustomResource("Gateway", namespace, defaults.GatewayProxyName+"-ssl")
ConvertKubeResource(gatewayUns, &gateway1)
Expect(gateway1.Ssl).To(BeTrue())
Expect(gateway1.BindPort).To(Equal(uint32(8443)))
Expect(gateway1.ProxyNames).To(Equal(proxyNames))
Expect(gateway1.UseProxyProto).To(BeNil())
Expect(gateway1.UseProxyProto).To(Equal(&types.BoolValue{Value: false}))
Expect(gateway1.BindAddress).To(Equal(defaults.GatewayBindAddress))
})

Expand Down

0 comments on commit afad52b

Please sign in to comment.