Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose disableKubernetesDestinations setting as Helm chart value #2302

Merged
merged 2 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog/v1.3.3/helm-value-to-disable-k8s-dest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
- type: NEW_FEATURE
description: Expose the `disableKubernetesDestinations` settings field as a Helm chart value.
issueLink: https://github.com/solo-io/gloo/issues/2299
1 change: 1 addition & 0 deletions docs/content/installation/gateway/kubernetes/values.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
|settings.invalidConfigPolicy.invalidRouteResponseCode|int64|404|the response code for the direct response|
|settings.invalidConfigPolicy.invalidRouteResponseBody|string|Gloo Gateway has invalid configuration. Administrators should run `glooctl check` to find and fix config errors.|the response body for the direct response|
|settings.linkerd|bool|false|Enable automatic Linkerd integration in Gloo.|
|settings.disableKubernetesDestinations|bool|false|Gloo allows you to directly reference a Kubernetes service as a routing destination. To enable this feature, Gloo scans the cluster for Kubernetes services and creates a special type of in-memory Upstream to represent them. If the cluster contains a lot of services and you do not restrict the namespaces Gloo is watching, this can result in significant overhead. If you do not plan on using this feature, you can set this flag to true to turn it off.|
|gloo.deployment.image.tag|string|<release_version, ex: 1.2.3>|tag for the container|
|gloo.deployment.image.repository|string|gloo|image name (repository) for the container.|
|gloo.deployment.image.registry|string||image prefix/registry e.g. (quay.io/solo-io)|
Expand Down
17 changes: 9 additions & 8 deletions install/helm/gloo/generate/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ type KnativeProxy struct {
}

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" desc:"create a Settings CRD which provides bootstrap configuration to Gloo controllers"`
Extensions interface{} `json:"extensions,omitempty"`
SingleNamespace bool `json:"singleNamespace" desc:"Enable to use install namespace as WatchNamespace and WriteNamespace"`
InvalidConfigPolicy *InvalidConfigPolicy `json:"invalidConfigPolicy,omitempty" desc:"Define policies for Gloo to handle invalid configuration"`
Linkerd bool `json:"linkerd" desc:"Enable automatic Linkerd integration in Gloo."`
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" desc:"create a Settings CRD which provides bootstrap configuration to Gloo controllers"`
Extensions interface{} `json:"extensions,omitempty"`
SingleNamespace bool `json:"singleNamespace" desc:"Enable to use install namespace as WatchNamespace and WriteNamespace"`
InvalidConfigPolicy *InvalidConfigPolicy `json:"invalidConfigPolicy,omitempty" desc:"Define policies for Gloo to handle invalid configuration"`
Linkerd bool `json:"linkerd" desc:"Enable automatic Linkerd integration in Gloo."`
DisableKubernetesDestinations bool `json:"disableKubernetesDestinations" desc:"Gloo allows you to directly reference a Kubernetes service as a routing destination. To enable this feature, Gloo scans the cluster for Kubernetes services and creates a special type of in-memory Upstream to represent them. If the cluster contains a lot of services and you do not restrict the namespaces Gloo is watching, this can result in significant overhead. If you do not plan on using this feature, you can set this flag to true to turn it off."`
}

type InvalidConfigPolicy struct {
Expand Down
1 change: 1 addition & 0 deletions install/helm/gloo/templates/18-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
invalidConfigPolicy:
{{ toYaml .Values.settings.invalidConfigPolicy | indent 6}}
{{- end }}
disableKubernetesDestinations: {{ .Values.settings.disableKubernetesDestinations | default false }}

{{- if .Values.settings.writeNamespace }}
discoveryNamespace: {{ .Values.settings.writeNamespace }}
Expand Down
7 changes: 6 additions & 1 deletion install/helm/gloo/values-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ settings:
httpPort: 80
httpsPort: 443
replicas: 1
# namespaces that Gloo should watch. this includes watches set for pods, services, as well as CRD configuration objects
# Namespaces that Gloo should watch. This includes watches set for pods, services, as well as CRD configuration objects.
watchNamespaces: []
# Gloo allows you to directly reference a Kubernetes service as a routing destination. To enable this feature,
# Gloo scans the cluster for Kubernetes services and creates a special type of in-memory Upstream to represent them.
# If the cluster contains a lot of services and you do not restrict the namespaces Gloo is watching, this can result
# in significant overhead. If you do not plan on using this feature, you can set this flag to true to turn it off.
disableKubernetesDestinations: false
gloo:
deployment:
image:
Expand Down
41 changes: 41 additions & 0 deletions install/test/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ spec:
proxyValidationServerAddr: gloo:9988
gloo:
xdsBindAddr: 0.0.0.0:9977
disableKubernetesDestinations: false
invalidConfigPolicy:
invalidRouteResponseBody: Gloo Gateway has invalid configuration. Administrators should run
` + "`" + `glooctl check` + "`" + ` to find and fix config errors.
Expand All @@ -893,6 +894,46 @@ spec:
testManifest.ExpectUnstructured(settings.GetKind(), settings.GetNamespace(), settings.GetName()).To(BeEquivalentTo(settings))
})

It("correctly sets the `disableKubernetesDestinations` field in the settings", func() {
settings := makeUnstructured(`
apiVersion: gloo.solo.io/v1
kind: Settings
metadata:
labels:
app: gloo
name: default
namespace: ` + namespace + `
spec:
discovery:
fdsMode: WHITELIST
gateway:
readGatewaysFromAllNamespaces: false
validation:
alwaysAccept: true
proxyValidationServerAddr: gloo:9988
gloo:
xdsBindAddr: 0.0.0.0:9977
disableKubernetesDestinations: true
invalidConfigPolicy:
invalidRouteResponseBody: Gloo Gateway has invalid configuration. Administrators should run
` + "`" + `glooctl check` + "`" + ` to find and fix config errors.
invalidRouteResponseCode: 404

kubernetesArtifactSource: {}
kubernetesConfigSource: {}
kubernetesSecretSource: {}
refreshRate: 60s
discoveryNamespace: ` + namespace + `
`)

prepareMakefile(namespace, helmValues{
valuesArgs: []string{
"settings.disableKubernetesDestinations=true",
},
})
testManifest.ExpectUnstructured(settings.GetKind(), settings.GetNamespace(), settings.GetName()).To(BeEquivalentTo(settings))
})

It("creates the validating webhook configuration", func() {
vwc := makeUnstructured(`

Expand Down