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

Backport of connect: ingress gateway validation for http hosts and wildcards into release/1.2.x #15756

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #15749 to be assessed for backporting due to the inclusion of the label backport/1.2.x.

The below text is copied from the body of the original PR.


This makes code match the documentation, and reality 😋

Applies to all non-"tcp" protocols: http, http2, and grpc, which support "hosts" and tests now cover all of them as well. I could maybe be convinced to remove the extra test coverage if it seems superfluous, but it's intended to guard against potential future regressions.

per https://developer.hashicorp.com/nomad/docs/job-specification/gateway#service-parameters,

service Parameters

  • hosts (array<string>: nil) - A list of hosts that specify what requests will match this service. This cannot be used with a tcp listener, and cannot be specified alongside a wildcard (*) service name. If not specified, the default domain <service-name>.ingress.* will be used to match services.
e.g. this will now work:
listener {
  port     = 8080
  protocol = "http"
  service {
    name  = "uuid-api"
    # hosts = no longer required
  }
}

and this will no longer work (by "work" I mean pass to consul, which errors less-specifically):

listener {
  port     = 8080
  protocol = "http"
  service {
    name  = "*"
    hosts = ["anything"]
  }
}

error before:

Error submitting job: Unexpected response code: 500 (Unexpected response code: 500 (Associating hosts to a wildcard service is not supported (listener on port 8080)))

error after:

Error submitting job: Unexpected response code: 500 (1 error occurred:
* Task group ingress-group validation failed: 1 error occurred:
* Task group service validation failed: 1 error occurred:
* Service[0] my-ingress-service validation failed: 1 error occurred:
* Consul Ingress Service with a wildcard "*" service name can not also specify hosts)

Closes #10955

Note: to use these non-"tcp" protocols, users will still need to manually write a service-defaults config entry as described in #8647 (comment)

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/gulducat/consul-ingress-http-no-hosts/usually-definite-skunk branch from 37489fe to 53ddae5 Compare January 11, 2023 17:52
@hc-github-team-nomad-core hc-github-team-nomad-core merged commit 83ef6b7 into release/1.2.x Jan 11, 2023
@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/gulducat/consul-ingress-http-no-hosts/usually-definite-skunk branch from e444cec to 36fbbda Compare January 11, 2023 17:52
@hc-github-team-nomad-core hc-github-team-nomad-core deleted the backport/gulducat/consul-ingress-http-no-hosts/usually-definite-skunk branch January 11, 2023 17:52
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants