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

Add support for services of type ExternalName #629

Merged
merged 1 commit into from Apr 20, 2017

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Apr 20, 2017

fixes #621

kind: Service
apiVersion: v1
metadata:
  name: proxy-google-cl
spec:
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
  type: ExternalName
  externalName: www.google.cl

---

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: proxy-to-google
  annotations:
    ingress.kubernetes.io/configuration-snippet: |
      # we cannot pass Host header
      set $best_http_host "";
      proxy_set_header Host                   $best_http_host;

spec:
  rules:
  - host: foo.bar
    http:
      paths:
      - path: /
        backend:
          serviceName: proxy-google-cl
          servicePort: 80
$ kubectl exec -n kube-system nginx-ingress-controller-605381865-1zqg3 -- curl http://localhost -H 'Host: foo.bar' -v
* Rebuilt URL to: http://localhost/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: foo.bar
> User-Agent: curl/7.47.0
> Accept: */*
>
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.cl/?gfe_rd=cr&amp;ei=9hz4WJB_haHGBIqjj-AM">here</A>.
</BODY></HTML>
< HTTP/1.1 302 Found
< Server: nginx/1.11.12
< Date: Thu, 20 Apr 2017 02:29:10 GMT
< Content-Type: text/html; charset=UTF-8
< Content-Length: 256
< Connection: keep-alive
< Cache-Control: private
< Referrer-Policy: no-referrer
< Location: http://www.google.cl/?gfe_rd=cr&ei=9hz4WJB_haHGBIqjj-AM
<
{ [256 bytes data]
100   256  100   256    0     0   4241      0 --:--:-- --:--:-- --:--:--  4266
* Connection #0 to host localhost left intact

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 20, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@aledbf aledbf added this to In Progress in nginx 0.9-beta.4 Apr 20, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 47.263% when pulling c71fe9f on aledbf:externalname-feature into dcc0efc on kubernetes:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

[nginx] add support for Services with ExternalNames
4 participants