Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

[nginx-ingress-controller] Add support for default backend in Ingress rule #1830

Merged
merged 1 commit into from
Oct 6, 2016

Conversation

aledbf
Copy link
Contributor

@aledbf aledbf commented Oct 3, 2016

replaces #1759


This change is Reviewable

@k8s-github-robot k8s-github-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 3, 2016
@aledbf aledbf force-pushed the dbackend branch 3 times, most recently from e621db8 to 6d1749b Compare October 4, 2016 02:34
@k8s-github-robot
Copy link

[CLA-PING] @aledbf

Thanks for your pull request. It looks like this may be your first contribution to a CNCF open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://identity.linuxfoundation.org/projects/cncf to sign.

Once you've signed, please reply here (e.g. "I signed it!") and we'll verify. Thanks.


@k8s-github-robot k8s-github-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 4, 2016
@aledbf
Copy link
Contributor Author

aledbf commented Oct 4, 2016

@bprashanth ready for a first review

@@ -739,19 +740,38 @@ func (lbc *loadBalancerController) getUpstreamServers(ngxCfg config.Configuratio
server = servers[defServerName]
}

if rule.HTTP == nil && host != defServerName {
glog.Info("multiple root ISSUE")

Choose a reason for hiding this comment

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

maybe send an event, and turn the message into a WARNING or ERROR? Please either extend the message itself or add a comment.

Choose a reason for hiding this comment

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

This is actually worth documenting. We just enforce that if there're multiple ingresses asking for a default backend, they must have the same backend? do we pick this backed on fcfs basis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

nginxPath := path.Path
// if there's no path defined we assume /
if nginxPath == "" {
lbc.recorder.Eventf(ing, api.EventTypeWarning, "MAPPING",
"Ingress rule '%v/%v' contains no path definition. Assuming /", ing.GetNamespace(), ing.GetName())
"Ingress rule '%v/%v' contains no path definition. Assuming /",

Choose a reason for hiding this comment

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

/ is the same as /* right? do you lose anything by just making it the latter (more explicit)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, comment added

nginxPath = rootLocation
}

// Validate that there is no another previuous
// Validate that there is no another previous

Choose a reason for hiding this comment

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

s/no another/no/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

}

if !svcExists {
return upstreams, fmt.Errorf("service %v does not exists", svcKey)

Choose a reason for hiding this comment

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

do these translate into events? (the gce controller has the same problem of not sending an event for this case, pretty confusing to debug)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no but this appears in the log of the pod

@@ -128,7 +128,10 @@ func (ngx Manager) testTemplate(cfg []byte) error {
return err
}
defer tmpfile.Close()
defer os.Remove(tmpfile.Name())
// do not remove temporal nginx.conf file if log level is >= 3
if !glog.V(3) {

Choose a reason for hiding this comment

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

hmm, why? this looks like a weird lateral dependency. are we just leaking the file to debug later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

change the behavior to remove the file only if there's no error running the check

@aledbf aledbf changed the title WIP: [nginx-ingress-controller] Add support for default backend in Ingress rule [nginx-ingress-controller] Add support for default backend in Ingress rule Oct 4, 2016
@bprashanth
Copy link

LGTM sorry for the delay

@bprashanth bprashanth added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2016
@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit f2a01e9 into kubernetes-retired:master Oct 6, 2016
@aledbf aledbf deleted the dbackend branch October 14, 2016 17:52
aledbf pushed a commit to aledbf/contrib that referenced this pull request Nov 10, 2016
Automatic merge from submit-queue

[nginx-ingress-controller] Add support for default backend in Ingress rule

replaces kubernetes-retired#1759
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants