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

Update service defaults #502

Merged
merged 4 commits into from
Apr 28, 2021
Merged

Update service defaults #502

merged 4 commits into from
Apr 28, 2021

Conversation

thisisnotashwin
Copy link
Contributor

@thisisnotashwin thisisnotashwin commented Apr 22, 2021

Changes proposed in this PR:

  • Add support for Mode and UpstreamConfigs to Service Defaults.

  • Error out in validation if Mode is set as we expect users to use annotations for the same

How I've tested this PR:

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)

kschoche and others added 3 commits April 22, 2021 15:01
…th checks (#472)

remove health checks controller and use endpoints controller for health checks.
- Update the spec of ServiceDefaults and ProxyDefaults to support
  transparent proxy changes that are introduced as a part of Consul 1.10
@thisisnotashwin thisisnotashwin marked this pull request as ready for review April 22, 2021 19:05
@thisisnotashwin thisisnotashwin requested review from ishustava, a team and kschoche and removed request for a team April 22, 2021 20:59
@thisisnotashwin thisisnotashwin added type/enhancement New feature or request theme/tproxy Items related to transparent proxy labels Apr 26, 2021
@thisisnotashwin thisisnotashwin force-pushed the update-service-defaults branch 2 times, most recently from 329fc0f to a73c9b0 Compare April 26, 2021 17:22
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.

👍🏽

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 good, Ashwin! The only thing is that I'm not sure that it works because we don't convert UpstreamConfig in the ToConsul function. Maybe having a test that sets all possible values of the service default and checks that it was written to Consul would be good as a validation since acceptance tests also don't set these values?

// will be ignored if a discovery chain is active.
EnvoyClusterJSON string `json:"envoyClusterJSON,omitempty"`
// Protocol describes the upstream's service protocol. Valid values are "tcp",
// "http" and "grpc". Anything else is treated as tcp. The enables protocol
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
// "http" and "grpc". Anything else is treated as tcp. The enables protocol
// "http" and "grpc". Anything else is treated as tcp. This enables protocol

// PassiveHealthCheck configuration determines how upstream proxy instances will
// be monitored for removal from the load balancing pool.
PassiveHealthCheck *PassiveHealthCheck `json:"passiveHealthCheck,omitempty"`
// MeshGatewayConfig controls how Mesh Gateways are configured and used
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
// MeshGatewayConfig controls how Mesh Gateways are configured and used
// MeshGatewayConfig controls how Mesh Gateways are configured and used.

@@ -153,12 +240,20 @@ func (in *ServiceDefaults) Validate(namespacesEnabled bool) error {
var allErrs field.ErrorList
Copy link
Contributor

Choose a reason for hiding this comment

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

should ToConsul function convert UpstreamConfig?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should also add a test that sets all possible values set for service defaults and verifies that it gets written to consul.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah..this was definitely a massive oversight by me

api/v1alpha1/servicedefaults_types.go Show resolved Hide resolved
@@ -80,16 +80,133 @@ spec:
description: Mode is the mode that should be used for the upstream connection. One of none, local, or remote.
type: string
type: object
mode:
description: 'Mode can be one of "direct" or "transparent". "transparent" represents that inbound and outbound application traffic is being captured and redirected through the proxy. This mode does not enable the traffic redirection itself. Instead it signals Consul to configure Envoy as if traffic is already being redirected. "direct" represents that the proxy''s listeners must be dialed directly by the local application and other proxies. Note: This cannot be set using the CRD and should be set using annotations on the services that are part of the mesh.'
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 weird that it added another single quote here to the proxy's and now it's proxy''s Don't know if there's a way to escape that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah..i poked around and couldnt really find a way to prevent that

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, oh well. Thanks for looking!

@thisisnotashwin
Copy link
Contributor Author

@ishustava I completely forgot about to Consul 😞 . The last few changes were all to ensure that things dont get set it Consul that it just slipped my mind. Will fix that up right away!!

@thisisnotashwin thisisnotashwin force-pushed the update-service-defaults branch 2 times, most recently from 170ff02 to 9747805 Compare April 27, 2021 15:06
@thisisnotashwin
Copy link
Contributor Author

I updated the acceptance test fixture locally with some upstream configs and verified that they got set

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.

🎉

@@ -80,16 +80,133 @@ spec:
description: Mode is the mode that should be used for the upstream connection. One of none, local, or remote.
type: string
type: object
mode:
description: 'Mode can be one of "direct" or "transparent". "transparent" represents that inbound and outbound application traffic is being captured and redirected through the proxy. This mode does not enable the traffic redirection itself. Instead it signals Consul to configure Envoy as if traffic is already being redirected. "direct" represents that the proxy''s listeners must be dialed directly by the local application and other proxies. Note: This cannot be set using the CRD and should be set using annotations on the services that are part of the mesh.'
Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, oh well. Thanks for looking!

@thisisnotashwin thisisnotashwin merged commit ecff4b8 into master Apr 28, 2021
@thisisnotashwin thisisnotashwin deleted the update-service-defaults branch April 28, 2021 13:31
ndhanushkodi pushed a commit to ndhanushkodi/consul-k8s that referenced this pull request Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/tproxy Items related to transparent proxy type/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants