From 616b94e58411d40f2e2a01ce28444ef548f920ac Mon Sep 17 00:00:00 2001 From: AdamDang Date: Tue, 17 Apr 2018 14:16:24 +0800 Subject: [PATCH 1/2] Correct grammar mistakes --- test/e2e/framework/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index cc32aafb83..f6272fc4c0 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -226,7 +226,7 @@ func fileInFS(file string, fs file.Filesystem) wait.ConditionFunc { } if stat == nil { - return false, fmt.Errorf("file %v does not exists", file) + return false, fmt.Errorf("file %v does not exist", file) } if stat.Size() > 0 { From 130866b51c9b825444904a3574594817b64bd3c4 Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Tue, 12 Jun 2018 15:04:26 +0200 Subject: [PATCH 2/2] Proofreading --- cmd/nginx/flags.go | 4 ++-- cmd/nginx/main.go | 2 +- docs/user-guide/cli-arguments.md | 2 +- docs/user-guide/custom-errors.md | 14 +++++++------- internal/ingress/controller/controller.go | 8 ++++---- internal/ingress/controller/nginx.go | 15 ++++++--------- test/e2e/servicebackend/service_backend.go | 6 +++++- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/cmd/nginx/flags.go b/cmd/nginx/flags.go index fe7986d864..850239ccfd 100644 --- a/cmd/nginx/flags.go +++ b/cmd/nginx/flags.go @@ -150,7 +150,7 @@ Feature backed by OpenResty Lua libraries.`) httpPort = flags.Int("http-port", 80, `Port to use for servicing HTTP traffic.`) httpsPort = flags.Int("https-port", 443, `Port to use for servicing HTTPS traffic.`) statusPort = flags.Int("status-port", 18080, `Port to use for exposing NGINX status pages.`) - sslProxyPort = flags.Int("ssl-passtrough-proxy-port", 442, `Port to use internally for SSL Passthgough.`) + sslProxyPort = flags.Int("ssl-passthrough-proxy-port", 442, `Port to use internally for SSL Passthrough.`) defServerPort = flags.Int("default-server-port", 8181, `Port to use for exposing the default server (catch-all).`) healthzPort = flags.Int("healthz-port", 10254, "Port to use for the healthz endpoint.") ) @@ -180,7 +180,7 @@ Feature backed by OpenResty Lua libraries.`) glog.Infof("Watching for Ingress class: %s", *ingressClass) if *ingressClass != class.DefaultClass { - glog.Warningf("Only Ingresses with class %q will be processed by this ingress controller", *ingressClass) + glog.Warningf("Only Ingresses with class %q will be processed by this Ingress controller", *ingressClass) } class.IngressClass = *ingressClass diff --git a/cmd/nginx/main.go b/cmd/nginx/main.go index e924b55b65..1fb9e945ca 100644 --- a/cmd/nginx/main.go +++ b/cmd/nginx/main.go @@ -167,7 +167,7 @@ func handleSigterm(ngx *controller.NGINXController, exit exiter) { // kubeConfig is the location of a kubeconfig file. If defined, the kubeconfig // file is loaded first, the URL of the API server read from the file is then // optionally overriden by the value of apiserverHost. -// If neither apiserverHost or kubeconfig are passed in, we assume the +// If neither apiserverHost nor kubeConfig are passed in, we assume the // controller runs inside Kubernetes and fallback to the in-cluster config. If // the in-cluster config is missing or fails, we fallback to the default config. func createApiserverClient(apiserverHost, kubeConfig string) (*kubernetes.Clientset, error) { diff --git a/docs/user-guide/cli-arguments.md b/docs/user-guide/cli-arguments.md index fac879b325..5e6ded15ff 100644 --- a/docs/user-guide/cli-arguments.md +++ b/docs/user-guide/cli-arguments.md @@ -33,7 +33,7 @@ They are set in the container spec of the `nginx-ingress-controller` Deployment | --publish-status-address string | Customized address to set as the load-balancer status of Ingress objects this controller satisfies. Requires the update-status parameter. | | --report-node-internal-ip-address | Set the load-balancer status of Ingress objects to internal Node addresses instead of external. Requires the update-status parameter. | | --sort-backends | Sort servers inside NGINX upstreams. | -| --ssl-passtrough-proxy-port int | Port to use internally for SSL Passthgough. (default 442) | +| --ssl-passthrough-proxy-port int | Port to use internally for SSL Passthrough. (default 442) | | --status-port int | Port to use for exposing NGINX status pages. (default 18080) | | --stderrthreshold severity | logs at or above this threshold go to stderr (default 2) | | --sync-period duration | Period at which the controller forces the repopulation of its local object stores. (default 10m0s) | diff --git a/docs/user-guide/custom-errors.md b/docs/user-guide/custom-errors.md index 03e550bd1d..1f47db7b98 100644 --- a/docs/user-guide/custom-errors.md +++ b/docs/user-guide/custom-errors.md @@ -5,13 +5,13 @@ that it passes several HTTP headers down to its `default-backend` in case of err | Header | Value | | ---------------- | ------------------------------------------------ | -| `X-Code` | HTTP status code retuned by the request | -| `X-Format` | Value of the `Accept` header sent by the client | -| `X-Original-URI` | URI that caused the error | -| `X-Namespace` | Namespace where the backend Service is located | -| `X-Ingress-Name` | Name of the Ingress where the backend is defined | -| `X-Service-Name` | Name of the Service backing the backend | -| `X-Service-Port` | Port number of the Service backing the backend | +| `X-Code` | HTTP status code retuned by the request | +| `X-Format` | Value of the `Accept` header sent by the client | +| `X-Original-URI` | URI that caused the error | +| `X-Namespace` | Namespace where the backend Service is located | +| `X-Ingress-Name` | Name of the Ingress where the backend is defined | +| `X-Service-Name` | Name of the Service backing the backend | +| `X-Service-Port` | Port number of the Service backing the backend | A custom error backend can use this information to return the best possible representation of an error page. For example, if the value of the `Accept` header send by the client was `application/json`, a carefully crafted backend diff --git a/internal/ingress/controller/controller.go b/internal/ingress/controller/controller.go index 92786af9a2..8619e46446 100644 --- a/internal/ingress/controller/controller.go +++ b/internal/ingress/controller/controller.go @@ -206,10 +206,10 @@ func (n *NGINXController) syncIngress(interface{}) error { } func (n *NGINXController) getStreamServices(configmapName string, proto apiv1.Protocol) []ingress.L4Service { - glog.V(3).Infof("Obtaining information about %v stream services from ConfigMap %q", proto, configmapName) if configmapName == "" { return []ingress.L4Service{} } + glog.V(3).Infof("Obtaining information about %v stream services from ConfigMap %q", proto, configmapName) _, _, err := k8s.ParseNameNS(configmapName) if err != nil { @@ -1019,7 +1019,7 @@ func (n *NGINXController) createServers(data []*extensions.Ingress, err = cert.Certificate.VerifyHostname(host) if err != nil { glog.Warningf("Unexpected error validating SSL certificate %q for server %q: %v", key, host, err) - glog.Warningf("Validating certificate against DNS names. This will be deprecated in a future version.") + glog.Warning("Validating certificate against DNS names. This will be deprecated in a future version.") // check the Common Name field // https://github.com/golang/go/issues/22922 err := verifyHostname(host, cert.Certificate) @@ -1032,14 +1032,14 @@ func (n *NGINXController) createServers(data []*extensions.Ingress, servers[host].SSLCert = *cert if cert.ExpireTime.Before(time.Now().Add(240 * time.Hour)) { - glog.Warningf("SSL certificate for server %q is about to expire (%v)", cert.ExpireTime) + glog.Warningf("SSL certificate for server %q is about to expire (%v)", host, cert.ExpireTime) } } } for alias, host := range aliases { if _, ok := servers[alias]; ok { - glog.Warningf("Conflicting hostname (%v) and alias (%v) in server %q. Removing alias to avoid conflicts.", alias, host) + glog.Warningf("Conflicting hostname (%v) and alias (%v). Removing alias to avoid conflicts.", host, alias) servers[host].Alias = "" } } diff --git a/internal/ingress/controller/nginx.go b/internal/ingress/controller/nginx.go index 28148f67f6..10d6454367 100644 --- a/internal/ingress/controller/nginx.go +++ b/internal/ingress/controller/nginx.go @@ -61,8 +61,6 @@ import ( "k8s.io/ingress-nginx/internal/watch" ) -type statusModule string - const ( ngxHealthPath = "/healthz" ) @@ -236,7 +234,6 @@ type NGINXController struct { resolver []net.IP - // returns true if IPV6 is enabled in the pod isIPV6Enabled bool isShuttingDown bool @@ -342,8 +339,8 @@ func (n *NGINXController) Stop() error { n.syncStatus.Shutdown() } - // Send stop signal to Nginx - glog.Info("stopping NGINX process...") + // send stop signal to NGINX + glog.Info("Stopping NGINX process") cmd := nginxExecCommand("-s", "quit") cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr @@ -464,10 +461,10 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error { n.Proxy.ServerList = servers } - // NGINX cannot resize the hash tables used to store server names. - // For this reason we check if the defined size defined is correct - // for the FQDN defined in the ingress rules adjusting the value - // if is required. + // NGINX cannot resize the hash tables used to store server names. For + // this reason we check if the current size is correct for the host + // names defined in the Ingress rules and adjust the value if + // necessary. // https://trac.nginx.org/nginx/ticket/352 // https://trac.nginx.org/nginx/ticket/631 var longestName int diff --git a/test/e2e/servicebackend/service_backend.go b/test/e2e/servicebackend/service_backend.go index 09968975c7..e603190849 100644 --- a/test/e2e/servicebackend/service_backend.go +++ b/test/e2e/servicebackend/service_backend.go @@ -17,15 +17,19 @@ limitations under the License. package servicebackend import ( + "strings" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/parnurzeal/gorequest" + corev1 "k8s.io/api/core/v1" "k8s.io/api/extensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/ingress-nginx/test/e2e/framework" - "strings" ) var _ = framework.IngressNginxDescribe("Service backend - 503", func() {