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

Adds an ingress to redirect from Hub Preview to Hub #266

Merged
merged 1 commit into from
Jul 15, 2021

Conversation

PuneetPunamiya
Copy link
Member

  • This patch adds an annotation which redirects from Hub Preview to Hub as
    nginx.ingress.kubernetes.io/permanent-redirect: https://hub.tekton.dev

Signed-off-by: Puneet Punamiya ppunamiy@redhat.com

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

@tekton-robot tekton-robot requested review from pratap0007 and sthaha May 21, 2021 11:51
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 21, 2021
@piyush-garg
Copy link
Contributor

/cc @afrittoli Will be great if you can review

@tekton-robot tekton-robot requested a review from afrittoli May 25, 2021 06:14
@tekton-robot
Copy link

@piyush-garg: GitHub didn't allow me to request PR reviews from the following users: can, review, Will, be, great, if, you.

Note that only tektoncd members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @afrittoli Will be great if you can review

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you for this!
Could you include the annotation for the DNS name too?

    dns.gardener.cloud/dnsnames: hub-preview.tekton.dev
    dns.gardener.cloud/ttl: "3600"

I guess it's ok for now to have this in the hub repo but I'd really prefer eventually to separate this out to the plumbing repo - because this is specific to the deployment to dogfooding and anyone installing hub does not really need this ingress at all.

- secretName: ui-hub-preview-tekton-dev-tls
hosts: [hub-preview.tekton.dev]
rules:
- http:
Copy link
Member

Choose a reason for hiding this comment

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

I usually include host: hub-preview.tekton.dev as key under rules too, but I'm not 100% sure if it's required:

spec:
  rules:
  - host: hub-preview.tekton.dev
     http: (...)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for late reply
Is it fine if we apply the ingress on dogfooding first and see and if that works fine then merge the pr ??

@afrittoli
Copy link
Member

I tried on the cluster but unfortunately it doesn't work, we'd have to install a separate nginx controller. Using a CNAME record works, as long as the hub ingress is updated to include hub-preview.tekton.dev in the list of hosts.
In that case however there is no HTTP redirect sent to the client, simply the hub production site is served to hub-preview as well

@PuneetPunamiya
Copy link
Member Author

dns.gardener.cloud/dnsnames: hub-preview.tekton.dev
dns.gardener.cloud/ttl: "3600"

Hey @afrittoli I have added this annotation and updated the pr

I tried on the cluster but unfortunately it doesn't work, we'd have to install a separate nginx controller. Using a CNAME record works, as long as the hub ingress is updated to include hub-preview.tekton.dev in the list of hosts.
In that case however there is no HTTP redirect sent to the client, simply the hub production site is served to hub-preview as well

Should we try this on dogfooding once ?? Is there anything more we need to do from Hub Side ??

@afrittoli
Copy link
Member

I deployed the nginx ingress controller to dogfooding to watch the tekton-hub-preview namespace only:

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install hub-preview-ingress-nginx ingress-nginx/ingress-nginx --set controller.watchNamespace=tekton-hub-preview --set controller.config.entries.default-server-return="301 https://hub.tekton.dev"

I also deployed this ingress resource, and the redirect works fine:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: redirect-to-tekton-hub
  namespace: tekton-hub-preview
  annotations:
    acme.cert-manager.io/http01-edit-in-place: 'true'
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/permanent-redirect: https://hub.tekton.dev
    nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
    dns.gardener.cloud/dnsnames: hub-preview.tekton.dev
    dns.gardener.cloud/ttl: '3600'
    kubernetes.io/ingress.class: "nginx"
spec:
  tls:
    - secretName: ui-hub-preview-tekton-dev-tls
      hosts: [hub-preview.tekton.dev]
  rules:
    - host: hub-preview.tekton.dev
      http:
        paths:
          - path: /*
            backend:
              serviceName: ui
              servicePort: 8080

Could you update this PR to match the ingress above ^^^ ?

Thank you!

  - This patch adds an annotation which redirects from Hub Preview to Hub as
    `nginx.ingress.kubernetes.io/permanent-redirect: https://hub.tekton.dev`

Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
@PuneetPunamiya
Copy link
Member Author

PuneetPunamiya commented Jul 14, 2021

@afrittoli Thanks a lot for all your help, have updated the pr, could you please take a look at it once

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you for the updtes!
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2021
@sm43
Copy link
Member

sm43 commented Jul 15, 2021

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sm43

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 15, 2021
@tekton-robot tekton-robot merged commit 60519a4 into tektoncd:main Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants