Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Support terminating gateways #503

Merged
merged 8 commits into from
Jun 18, 2020
Merged

Support terminating gateways #503

merged 8 commits into from
Jun 18, 2020

Conversation

adilyse
Copy link
Contributor

@adilyse adilyse commented Jun 18, 2020

Following up from #491 after a tragic git accident.

This creates all of the necessary templates to support terminating
gateways in the helm chart. Using terminatingGateways.defaults and
terminatingGateways.gateways, it's possible to define multiple
gateways. Names must be provided for each and they must be unique.

Any gateway-specific values will override the default value with the
exception of annotations. Annotations will apply both the defaults
and gateway-specific annotations.

Note: This is ready for a static code review, but has not been tested
yet because of a bug in the gateway implementation. It's also targeting
the ingress gateway branch for now to make it easier for settings and
tests that overlap between gateway implementations.

Replaces and builds on #452

adilyse added 6 commits June 17, 2020 16:57
This creates all of the necessary templates to support terminating
gateways in the helm chart. Using `terminatingGateways.defaults` and
`terminatingGateways.gateways`, it's possible to define multiple
gateways. Names must be provided for each and they must be unique.

Any gateway-specific values will override the default value with the
exception of annotations. Annotations will apply both the defaults
and gateway-specific annotations.
With the addition of an id in the service registration, this is
necessary to correctly associate the gateway pod with the specific
service instance.
@adilyse adilyse changed the base branch from master to release/0.22.0 June 18, 2020 00:23
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.

This looks awesome!!! Awesome work on everything 🎉

In my testing, I almost didn't find any issues at all, everything worked great! There was a small issue when running with namespaces and ACLs, which I've reported in hashicorp/consul-k8s#279.

I have also left a couple of comments about some missing test cases and made a couple suggestions for the values docs.

#--------------------------------------------------------------------
# global.tls.enabled

@test "terminatingGateways/Deployment: sets TLS flags when global.tls.enabled" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@test "terminatingGateways/Deployment: sets TLS flags when global.tls.enabled" {
@test "terminatingGateways/Deployment: sets TLS env variables when global.tls.enabled" {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in all the gateways.


local actual=$(echo $env | jq -r '. | select(.name == "CONSUL_CACERT") | .value' | tee /dev/stderr)
[ "${actual}" = "/consul/tls/ca/tls.crt" ]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also add a test that the correct volumes and volumeMounts are present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a series of tests under the extraVolumes test heading below (starting L248 before any changes were made to this file).

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes those tests are great. I was referring to the TLS volumes for the Consul client, e.g. consul-ca-cert. Sorry, that wasn't clear, but I meant it in the context of global.tls.enabled.

values.yaml Outdated
# include both the default annotations and any additional ones defined
# for a specific gateway.
# Requirements: consul >= 1.8.0 and consul-k8s >= 0.16.0 if using
# global.acls.manageSystemACLs.
Copy link
Contributor

Choose a reason for hiding this comment

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

For the lifecycle-sidecar command

Suggested change
# global.acls.manageSystemACLs.
# global.acls.manageSystemACLs and >= 0.10.0 if not using global.acls.manageSystemACLs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

values.yaml Outdated
# Requirements: consul >= 1.8.0 and consul-k8s >= 0.16.0 if using
# global.acls.manageSystemACLs.
terminatingGateways:
# Enable terminating gateway deployment. Requires `connectInject.enabled=true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we inlcude client.enabled and client.grpc as a requirement as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added client.enabled, but client.rpc is enabled by default so leaving it off.

values.yaml Outdated

# Defaults sets default values for all gateway fields. With the exception
# of annotations, defining any of these values in the `gateways` list
# will override the default values provided here.
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it's worth repeating the same thing as you said in the comment for terminatingGateways here for clarity.

Suggested change
# will override the default values provided here.
# will override the default values provided here. Annotations will
# include both the default annotations and any additional ones defined
# for a specific gateway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

values.yaml Outdated

# By default, we set an anti affinity so that two of the same gateway pods
# won't be on the same node. NOTE: Gateways require that Consul client agents are
# also running on the nodes alongside each gateway Pod.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# also running on the nodes alongside each gateway Pod.
# also running on the nodes alongside each gateway pod.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed on all 3 gateways.

values.yaml Outdated
memory: "100Mi"
cpu: "100m"

# By default, we set an anti affinity so that two of the same gateway pods
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# By default, we set an anti affinity so that two of the same gateway pods
# By default, we set an anti-affinity so that two of the same gateway pods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed on all 3 gateways.

@ishustava ishustava added area/gateways Related to gateway components enhancement New feature or request labels Jun 18, 2020
Copy link
Contributor Author

@adilyse adilyse left a comment

Choose a reason for hiding this comment

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

Many of these comments apply to things that are present (or lacking) in other components as well. How aggressive do we expect folks to be about fixing things like this across other, unchanged components?

#--------------------------------------------------------------------
# global.tls.enabled

@test "terminatingGateways/Deployment: sets TLS flags when global.tls.enabled" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in all the gateways.


local actual=$(echo $env | jq -r '. | select(.name == "CONSUL_CACERT") | .value' | tee /dev/stderr)
[ "${actual}" = "/consul/tls/ca/tls.crt" ]
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a series of tests under the extraVolumes test heading below (starting L248 before any changes were made to this file).

values.yaml Outdated
# include both the default annotations and any additional ones defined
# for a specific gateway.
# Requirements: consul >= 1.8.0 and consul-k8s >= 0.16.0 if using
# global.acls.manageSystemACLs.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

values.yaml Outdated
# Requirements: consul >= 1.8.0 and consul-k8s >= 0.16.0 if using
# global.acls.manageSystemACLs.
terminatingGateways:
# Enable terminating gateway deployment. Requires `connectInject.enabled=true`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added client.enabled, but client.rpc is enabled by default so leaving it off.

values.yaml Outdated

# Defaults sets default values for all gateway fields. With the exception
# of annotations, defining any of these values in the `gateways` list
# will override the default values provided here.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

values.yaml Outdated
memory: "100Mi"
cpu: "100m"

# By default, we set an anti affinity so that two of the same gateway pods
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed on all 3 gateways.

values.yaml Outdated

# By default, we set an anti affinity so that two of the same gateway pods
# won't be on the same node. NOTE: Gateways require that Consul client agents are
# also running on the nodes alongside each gateway Pod.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed on all 3 gateways.

@adilyse adilyse requested a review from ishustava June 18, 2020 17:56
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! Thanks so much for adding tests 🙏

I've left a comment about a test for the TLS volumes/volumeMounts (not the extraVolumes for the gateway, but the volumes for the gateway to talk to the client over TLS). I won't block the approval on that though.


local actual=$(echo $env | jq -r '. | select(.name == "CONSUL_CACERT") | .value' | tee /dev/stderr)
[ "${actual}" = "/consul/tls/ca/tls.crt" ]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes those tests are great. I was referring to the TLS volumes for the Consul client, e.g. consul-ca-cert. Sorry, that wasn't clear, but I meant it in the context of global.tls.enabled.

@adilyse adilyse merged commit 139ffef into release/0.22.0 Jun 18, 2020
@adilyse adilyse deleted the gateways-terminating branch June 18, 2020 18:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/gateways Related to gateway components enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants