-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add features needed by Replatforming.
On Kubernetes, we want to be able to refer to services by their short names (single-label domains), for example the DNS name for Content Store should be just `content-store` and the local resolver expands that to `content-store.apps.svc.cluster.local`. This simplifies GOV.UK's Helm charts by eliminating the need to construct domain names based on the environment name. We add a couple of env vars to support this usage: - When `PLEK_USE_HTTP_FOR_SINGLE_LABEL_DOMAINS=1` (or any reasonable "truthy" value), we return `http://` URLs instead of the default `https://` when there is no domain suffix to be appended, for example Plek.new.find("content-store") returns `http://content-store`. This significantly reduces configuration complexity in our Helm charts. It also paves the way for retiring Plek or at least removing most of its url-constructing logic in future. (Despite appearances, this is not a retrograde step with regard to security. The old system doesn't actually use TLS between the load balancer and the EC2 VMs anyway, so this is equivalent to what we already have. The http-only traffic stays in-region and within the VPC in both the old and new systems.) - `PLEK_UNPREFIXABLE_HOSTS` is a comma-separated list of names to be excluded from prefixing with `PLEK_HOSTNAME_PREFIX`. This simplifies the configuration of the draft stack by saving us from having to specify a bunch of overrides for every draft app. Also refactor find() to make the logic easier to follow. This change is intended to be backward compatible with all current usage in govuk-puppet and client apps. In other words it's only supposed to affect Replatforming and not the existing setup. Other minor changes: - Remove public setter methods for `parent_domain` and `external_domain`. We no longer use these privately and we definitely don't want them to be part of the public interface, because that would make it harder to retire Plek. Theoretically a back-compatibility break, but there is literally no usage of these setters in alphagov. The implementation of `unprefixable_hosts` uses a Ruby array rather than a hash set. This is asymptotically not good, but we anticipate low single-digit numbers of list entries so linear search ought to be just fine. Tested: added tests to cover the new env vars.
- Loading branch information
Showing
4 changed files
with
118 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters