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

Add externalServers.skipServerWatch to helm for working with load balancers #1686

Merged
merged 4 commits into from
Nov 9, 2022

Conversation

curtbushko
Copy link
Contributor

@curtbushko curtbushko commented Nov 8, 2022

Changes proposed in this PR:

  • Add helm value of externalServers.skipServerWatch
  • Add the environment variable CONSUL_SKIP_SERVER_WATCH to helm _helpers.tpl so that the environment variable will get automatically picked up by connection manager when talking to consul servers
  • Even though not directly needed there, add the check that externalServers.enabled is also set when externalServers.skipServerWatch=true in connect-inject-deployment.yaml
  • Bats tests for connect-inject-deployment to make sure that it fails the condition above and that the CONSUL_SKIP_SERVER_WATCH is set in the environment.
  • Read the env variable in flags/consul.go so that it can be passed to connection manager and down into discover.Config (used by partition-init, catalog-sync, server-acl-init, inject-connect, etc)
  • Specifically, set the flag in the webhook so that it is passed onto consul-dataplane as a -server-watch-disabled=true flag

How I've tested this PR:

  • bats tests
  • unit tests

How I expect reviewers to test this PR:
👀

Checklist:

  • Tests added
  • CHANGELOG entry added in CHANGELOG updates for 1.0 #1727

    HashiCorp engineers only, community PRs should not add a changelog entry.
    Entries should use present tense (e.g. Add support for...)

- add CONSUL_SKIP_SERVER_WATCH env variable to _helpers.tpl
- bats tests in connect-inject-deployment to validate that env variable works for skip server watch
- add externalServers.skipServerWatch to values.yaml
- read env variable in as a flag in flags/consul and unit tests.
check that server-watch-disabled is set with connect injector
@@ -8,6 +8,7 @@
{{- $serverEnabled := (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) -}}
{{- $serverExposeServiceEnabled := (or (and (ne (.Values.server.exposeService.enabled | toString) "-") .Values.server.exposeService.enabled) (and (eq (.Values.server.exposeService.enabled | toString) "-") .Values.global.adminPartitions.enabled)) -}}
{{- if and .Values.externalServers.enabled (not .Values.externalServers.hosts) }}{{ fail "externalServers.hosts must be set if externalServers.enabled is true" }}{{ end -}}
{{- if and .Values.externalServers.skipServerWatch (not .Values.externalServers.enabled) }}{{ fail "externalServers.enabled must be set if externalServers.skipServerWatch is true" }}{{ end -}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting the fail condition here so that it is obvious that it pairs with the checks in connect-inject-deployment.bats.

A similar thing is done for externalServers.hosts and _helpers.tpl. The checks are here in connect-inject-deployment.yaml.

@curtbushko curtbushko marked this pull request as ready for review November 8, 2022 20:56
Copy link
Contributor

@thisisnotashwin thisisnotashwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nicely done and so concise!!

@@ -355,6 +355,10 @@ Consul server environment variables for consul-k8s commands.
value: {{ .Values.externalServers.tlsServerName }}
{{- end }}
{{- end }}
{{- if and .Values.externalServers.enabled .Values.externalServers.skipServerWatch }}
- name: CONSUL_SKIP_SERVER_WATCH
value: "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a nit but can we unqoute the "true"

Copy link
Contributor

@ishustava ishustava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!!

charts/consul/values.yaml Outdated Show resolved Hide resolved
Co-authored-by: Iryna Shustava <ishustava@users.noreply.github.com>
@curtbushko curtbushko merged commit bf28f85 into main Nov 9, 2022
@curtbushko curtbushko deleted the curtbushko/skip-server-watch branch November 9, 2022 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants