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

Helm namespace mirroring #1601

Merged
merged 7 commits into from
Oct 10, 2022
Merged

Helm namespace mirroring #1601

merged 7 commits into from
Oct 10, 2022

Conversation

t-eckert
Copy link
Contributor

@t-eckert t-eckert commented Oct 7, 2022

Changes proposed in this PR:

  • syncCatalog.consulNamespaces.mirroringK8S now defaults to true
  • connectInject.consulNamespaces.mirroringK8S now defaults to true
  • Instead of failing when connectInject.consulNamespaces.mirrorK8S=true and global.enableConsulNamespaces=false, the connect-inject-deployment.yaml template instead checks for both to be true in order to pass the -enable-k8s-namespace-mirroring=true flag. That means, connectInject.consulNamespaces.mirrorK8S=true and global.enableConsulNamespaces=false is now a valid deployment configuration that will simply not tell Consul to perform mirroring given that Consul namespaces is not true.
  • Modified BATS tests to accommodate this change

How I've tested this PR:

  • Modified BATS tests
  • Run Acceptance tests

How I expect reviewers to test this PR:

  • BATS and acceptance

Checklist:

  • Tests added
  • CHANGELOG entry added

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

@@ -1,6 +1,5 @@
{{- if and .Values.global.peering.enabled (not .Values.connectInject.enabled) }}{{ fail "setting global.peering.enabled to true requires connectInject.enabled to be true" }}{{ end }}
{{- if (or (and (ne (.Values.connectInject.enabled | toString) "-") .Values.connectInject.enabled) (and (eq (.Values.connectInject.enabled | toString) "-") .Values.global.enabled)) }}
{{- if and .Values.connectInject.consulNamespaces.mirroringK8S (not .Values.global.enableConsulNamespaces) }}{{ fail "global.enableConsulNamespaces must be true if mirroringK8S=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.

Instead of failing here, I have the enable mirroring flag check for both conditions to be true in order to be passed to inject-connect.


local actual=$(echo $object |
yq 'any(contains("k8s-namespace-mirroring-prefix"))' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "connectInject/Deployment: mirroring options set with .connectInject.consulNamespaces.mirroringK8S=true" {
@test "connectInject/Deployment: mirroring options omitted with .connectInject.consulNamespaces.mirroringK8S=false" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The condition this checked is now covered by the test on line 681. I changed it to check the opposite case as it is no longer the default behavior.

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.

LGTM!! nicely done!

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 good!

@t-eckert t-eckert merged commit d4a48c6 into main Oct 10, 2022
@t-eckert t-eckert deleted the helm-namespace-mirroring branch October 10, 2022 19:49
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