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

configure -tls-server-name when global.cloud.enabled=true so that it matches the server certificate minted from HCP #1591

Merged
merged 4 commits into from Oct 6, 2022

Conversation

jmurret
Copy link
Contributor

@jmurret jmurret commented Oct 6, 2022

Changes proposed in this PR:

  • configure -tls-server-name for consul-k8s components that use connection manager when global.cloud.enabled = true so that it matches the server certificate minted from HCP

How I've tested this PR:

  • bats tests
  • manual integration testing with HCP

How I expect reviewers to test this PR:
👀

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...)

@jmurret jmurret marked this pull request as ready for review October 6, 2022 03:55
Copy link
Contributor

@ndhanushkodi ndhanushkodi left a comment

Choose a reason for hiding this comment

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

Maybe at some point we could standardize the flag name to either -tls-server-name or -consul-tls-server-name across all the commands but that's definitely not blocking for this fix!

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.

As Nitya suggested, it is a little unclear where we use consul-tls-server-name and tls-server-name and we should put something in the backlog to clear that up.

@@ -213,6 +213,8 @@ spec:
{{- end }}
{{- if and .Values.externalServers.enabled .Values.externalServers.tlsServerName }}
-tls-server-name={{.Values.externalServers.tlsServerName }} \
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be consul-tls-server-name as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be -tls-server-name for consul-dataplane and -consul-tls-server-name for other commands.
We should probably clear this up though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just updated this to use tls-server-name everywhere. I think differentiating for dataplane vs other components is more of an implementation detail, where this setting in every case is meant to set the TLSConfig.

@@ -268,7 +268,9 @@ spec:
-ca-certs=/consul/tls/ca/tls.crt \
{{- end }}
{{- if and $root.Values.externalServers.enabled $root.Values.externalServers.tlsServerName }}
-tls-server-name={{$root.Values.externalServers.tlsServerName }} \
-consul-tls-server-name={{ $root.Values.externalServers.tlsServerName }} \
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. thank you!

Copy link
Contributor

@kschoche kschoche left a comment

Choose a reason for hiding this comment

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

I'm not sure the flags are all being passed correctly, happy to pair and take a look with you, but feel free to ignore if I'm actually wrong :)

One other thing, non-blocking, since this is repeated verbatim in so many places, should we move it into a template in _helpers.tpl?

                {{- if and $root.Values.externalServers.enabled $root.Values.externalServers.tlsServerName }}
                -tls-server-name={{$root.Values.externalServers.tlsServerName }} \
                {{- else if $root.Values.global.cloud.enabled }}
                -consul-tls-server-name=server.{{ $root.Values.global.datacenter}}.{{ $root.Values.global.domain}} \

@jmurret jmurret requested a review from kschoche October 6, 2022 15:47
Copy link
Contributor

@kschoche kschoche 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!!

@jmurret jmurret changed the base branch from release/1.0.0-beta1 to main October 6, 2022 16:00
@jmurret jmurret merged commit 14528e1 into main Oct 6, 2022
@jmurret jmurret deleted the jm/gnm-agentless branch October 6, 2022 16:18
@@ -19,7 +19,7 @@ var (
// A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release
// such as "dev" (in development), "beta", "rc1", etc.
VersionPrerelease = "dev"
VersionPrerelease = "beta1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this correct? I think this should still be dev?

@@ -19,7 +19,7 @@ var (
// A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release
// such as "dev" (in development), "beta", "rc1", etc.
VersionPrerelease = "dev"
VersionPrerelease = "beta1"
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be dev too

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.

None yet

5 participants