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

Can't use Kubernetes with deployment name 'pact-broker', conflicts with PACT_BROKER_PORT #7

Closed
4 tasks done
maelvls opened this issue Aug 1, 2019 · 3 comments
Closed
4 tasks done

Comments

@maelvls
Copy link

maelvls commented Aug 1, 2019

I have already (please mark the applicable with an `x`):
  • Confirmed this is the right place to raise the issue - only issues related to the Dockerization of the Pact Broker should be raised here. Issues related to the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the CHANGELOG to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker gem version: 2.34.0
  • pact-broker docker version: 2.34.0-1
  • OS: macOS 10.14.5 (18F132)
  • using Docker for Mac 2.1.0.0 (Docker Engine 19.03.1 + docker-desktop Kubernetes v1.14.3)

Description of the issue

When creating a Deployment, kubernetes injects environment variables such as PACT_BROKER_PORT (this issue only appears when the deployment name is pact-broker)

% kubectl exec -n pact pact-6755d8cb98-jbdlm
[...]
PACT_BROKER_PORT=tcp://10.103.77.49:80
KUBERNETES_SERVICE_HOST=10.96.0.1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
PACT_BROKER_SERVICE_HOST=10.103.77.49
PACT_BROKER_PORT_80_TCP_PROTO=tcp
PACT_BROKER_PORT_80_TCP_PORT=80
PACT_BROKER_PORT_80_TCP_ADDR=10.103.77.49
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
PACT_BROKER_SERVICE_PORT=80
PACT_BROKER_PORT_80_TCP=tcp://10.103.77.49:80
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_SERVICE_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
PACT_BROKER_SERVICE_PORT_80=80

Some of these conflict with what pact-broker expects: Kubernetes sets PACT_BROKER_PORT to tcp://10.103.77.49:80 but pact-broker expects 80 which gives the error:

Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 0, max threads: 16
* Environment: production
URI::InvalidURIError: bad URI(is not URI?): "tcp://0.0.0.0:tcp://10.103.77.49:9292"

What is your thought on that?

Workaround

Change the deployment name from pact-broker to pact-broker2 for example.

Steps to reproduce

git clone https://github.com/maelvls/pact-broker-kubernetes --branch=pact-broker-docker-issue-7
cd pact-broker-kubernetes/kubernetes
ls *.yaml | xargs -L1 kubectl apply -f
@maelvls maelvls changed the title Can't use Kubernetes with current env var names Can't use Kubernetes with deployment name 'pact-broker', conflicts with PACT_BROKER_PORT Aug 1, 2019
maelvls added a commit to maelvls/pact-broker-kubernetes that referenced this issue Aug 1, 2019
@bethesque
Copy link
Member

I'm not sure if there's anything that we can do about it. We can't change the name without breaking backwards compatibility. The only thing I can think of is to maintain your own dockerfile.

@dimapasko
Copy link

I've got the same issue.
Thanks for the clear description and suggested fix.
Fixed by renaming to pact-broker-prod

@bethesque
Copy link
Member

I'm closing this issue as there isn't a code change that we can make to fix this - it has to be done on the kube side. If someone would like to add some documentation to help future Kubernetes users, that would be great.

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

No branches or pull requests

3 participants