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

support added for ingress.kubernetes.io/force-ssl-redirect #146

Closed
wants to merge 3 commits into from

Conversation

poonai
Copy link

@poonai poonai commented Jan 13, 2018

close #63
ingress.kubernetes.io/force-ssl-redirect annotation added for redirecting http to https.
Signed-off-by: பாலாஜி rbalajis25@gmail.com

@poonai poonai force-pushed the force_ssl branch 2 times, most recently from 764dd8b to 95012e0 Compare January 13, 2018 07:46
@davecheney
Copy link
Contributor

Thank you for this PR. This will need some tests before I can review it. Thank you.

Copy link
Contributor

@davecheney davecheney 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 PR.

What I would like to see is the following.

  1. Please talk about your approach before you start coding. This should be on the issue Support ingress.kubernetes.io/force-ssl-redirect #63. You will find more details in the CONTRIBUTING document
  2. Add a fixes Support ingress.kubernetes.io/force-ssl-redirect #63 to the PR description so github will close the issue when this PR is merged.
  3. All changes must have tests.

@@ -194,6 +194,19 @@ func (lc *ListenerCache) httpsAddress() string {
return DEFAULT_HTTPS_LISTENER_ADDRESS
}

func (lc *listenerCache) HostHasTls(host string) bool {
for _, listener := range lc.Values() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't use lc.Values for this. Any information that you get out of lc.Values will be present in the other caches maintained by the listenerCache.

@@ -145,3 +150,10 @@ func clusteraction(cluster string) *v2.Route_Route {
},
}
}

func sslRedirect(i *v1beta1.Ingress) bool {
if i.Annotations["kubenetes.io/ingress.ssl-redirect"] == "false" {
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be simplified to

return i.Annotations["kubenetes.io/ingress.ssl-redirect"] == "true"

Signed-off-by: பாலாஜி <rbalajis25@gmail.com>
Signed-off-by: பாலாஜி <rbalajis25@gmail.com>
Signed-off-by: பாலாஜி <rbalajis25@gmail.com>
@poonai
Copy link
Author

poonai commented Jan 13, 2018

@davecheney I have made changes. please review 👍

@@ -194,6 +194,19 @@ func (lc *ListenerCache) httpsAddress() string {
return DEFAULT_HTTPS_LISTENER_ADDRESS
}

func (lc *listenerCache) HostHasTls(host string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot use values here without taking the lock.

Please discuss your design before sending code, this is the second time I have asked.

Copy link
Contributor

@davecheney davecheney 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, the tests look fine but I am not happy with the implementation. Please discuss your design on issue #63 before sending further changes to this PR.

Copy link
Contributor

@davecheney davecheney 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 your PR. It needs some changes which I will take care of before merging.

I'm grateful for your contribution and will welcome more from you but please discuss your changes before sending any more code as we must agree on a design before you start to code.

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestSslRedirect(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good test, but does not test the right thing. Then name of the annotation is
ingress.kubernetes.io/force-ssl-redirect

davecheney added a commit to davecheney/contour that referenced this pull request Jan 15, 2018
Fixes projectcontour#63
Closes projectcontour#146

Add support for the ingress.kubernetes.io/force-ssl-redirect: "true"
annotation

Signed-off-by: Dave Cheney <dave@cheney.net>
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

Successfully merging this pull request may close these issues.

Support ingress.kubernetes.io/force-ssl-redirect
2 participants