Fix minor typos (#11941)
Co-authored-by: Nathan Baulch <nathan.baulch@gmail.com>
This commit is contained in:
parent
889afa9abd
commit
dcfa4507ae
47 changed files with 125 additions and 125 deletions
|
|
@ -47,7 +47,7 @@ type AdmissionControllerServer struct {
|
|||
AdmissionController AdmissionController
|
||||
}
|
||||
|
||||
// NewAdmissionControllerServer instanciates an admission controller server with
|
||||
// NewAdmissionControllerServer instantiates an admission controller server with
|
||||
// a default codec
|
||||
func NewAdmissionControllerServer(ac AdmissionController) *AdmissionControllerServer {
|
||||
return &AdmissionControllerServer{
|
||||
|
|
|
|||
|
|
@ -23,22 +23,22 @@ import (
|
|||
"k8s.io/ingress-nginx/internal/ingress/resolver"
|
||||
)
|
||||
|
||||
// LB Alghorithms are defined in https://github.com/kubernetes/ingress-nginx/blob/d3e75b056f77be54e01bdb18675f1bb46caece31/rootfs/etc/nginx/lua/balancer.lua#L28
|
||||
// LB Algorithms are defined in https://github.com/kubernetes/ingress-nginx/blob/d3e75b056f77be54e01bdb18675f1bb46caece31/rootfs/etc/nginx/lua/balancer.lua#L28
|
||||
|
||||
const (
|
||||
loadBalanceAlghoritmAnnotation = "load-balance"
|
||||
loadBalanceAlgorithmAnnotation = "load-balance"
|
||||
)
|
||||
|
||||
var loadBalanceAlghoritms = []string{"round_robin", "chash", "chashsubset", "sticky_balanced", "sticky_persistent", "ewma"}
|
||||
var loadBalanceAlgorithms = []string{"round_robin", "chash", "chashsubset", "sticky_balanced", "sticky_persistent", "ewma"}
|
||||
|
||||
var loadBalanceAnnotations = parser.Annotation{
|
||||
Group: "backend",
|
||||
Annotations: parser.AnnotationFields{
|
||||
loadBalanceAlghoritmAnnotation: {
|
||||
Validator: parser.ValidateOptions(loadBalanceAlghoritms, true, true),
|
||||
loadBalanceAlgorithmAnnotation: {
|
||||
Validator: parser.ValidateOptions(loadBalanceAlgorithms, true, true),
|
||||
Scope: parser.AnnotationScopeLocation,
|
||||
Risk: parser.AnnotationRiskLow,
|
||||
Documentation: `This annotation allows setting the load balancing alghorithm that should be used. If none is specified, defaults to
|
||||
Documentation: `This annotation allows setting the load balancing algorithm that should be used. If none is specified, defaults to
|
||||
the default configured by Ingress admin, otherwise to round_robin`,
|
||||
},
|
||||
},
|
||||
|
|
@ -61,7 +61,7 @@ func NewParser(r resolver.Resolver) parser.IngressAnnotation {
|
|||
// used to indicate if the location/s contains a fragment of
|
||||
// configuration to be included inside the paths of the rules
|
||||
func (a loadbalancing) Parse(ing *networking.Ingress) (interface{}, error) {
|
||||
return parser.GetStringAnnotation(loadBalanceAlghoritmAnnotation, ing, a.annotationConfig.Annotations)
|
||||
return parser.GetStringAnnotation(loadBalanceAlgorithmAnnotation, ing, a.annotationConfig.Annotations)
|
||||
}
|
||||
|
||||
func (a loadbalancing) GetDocumentation() parser.AnnotationFields {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func TestParse(t *testing.T) {
|
|||
Target: "http://some.test.env.com:2121/$someparam=1&$someotherparam=2",
|
||||
Host: "some.test.env.com",
|
||||
}},
|
||||
{map[string]string{backendURL: "http://some.test.env.com", host: "someInvalidParm.%^&*()_=!@#'\""}, &Config{
|
||||
{map[string]string{backendURL: "http://some.test.env.com", host: "someInvalidParam.%^&*()_=!@#'\""}, &Config{
|
||||
Source: ngxURI,
|
||||
RequestBody: "on",
|
||||
Target: "http://some.test.env.com",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ var serverSnippetAnnotations = parser.Annotation{
|
|||
serverSnippetAnnotation: {
|
||||
Validator: parser.ValidateNull,
|
||||
Scope: parser.AnnotationScopeIngress,
|
||||
Risk: parser.AnnotationRiskCritical, // Critical, this annotation is not validated at all and allows arbitrary configutations
|
||||
Risk: parser.AnnotationRiskCritical, // Critical, this annotation is not validated at all and allows arbitrary configurations
|
||||
Documentation: `This annotation allows setting a custom NGINX configuration on a server block. This annotation does not contain any validation and it's usage is not recommended!`,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ var serviceUpstreamAnnotations = parser.Annotation{
|
|||
serviceUpstreamAnnotation: {
|
||||
Validator: parser.ValidateBool,
|
||||
Scope: parser.AnnotationScopeIngress,
|
||||
Risk: parser.AnnotationRiskLow, // Critical, this annotation is not validated at all and allows arbitrary configutations
|
||||
Risk: parser.AnnotationRiskLow, // Critical, this annotation is not validated at all and allows arbitrary configurations
|
||||
Documentation: `This annotation makes NGINX use Service's Cluster IP and Port instead of Endpoints as the backend endpoints`,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ var configurationSnippetAnnotations = parser.Annotation{
|
|||
configurationSnippetAnnotation: {
|
||||
Validator: parser.ValidateNull,
|
||||
Scope: parser.AnnotationScopeLocation,
|
||||
Risk: parser.AnnotationRiskCritical, // Critical, this annotation is not validated at all and allows arbitrary configutations
|
||||
Risk: parser.AnnotationRiskCritical, // Critical, this annotation is not validated at all and allows arbitrary configurations
|
||||
Documentation: `This annotation allows setting a custom NGINX configuration on a location block. This annotation does not contain any validation and it's usage is not recommended!`,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ var streamSnippetAnnotations = parser.Annotation{
|
|||
streamSnippetAnnotation: {
|
||||
Validator: parser.ValidateNull,
|
||||
Scope: parser.AnnotationScopeIngress,
|
||||
Risk: parser.AnnotationRiskCritical, // Critical, this annotation is not validated at all and allows arbitrary configutations
|
||||
Risk: parser.AnnotationRiskCritical, // Critical, this annotation is not validated at all and allows arbitrary configurations
|
||||
Documentation: `This annotation allows setting a custom NGINX configuration on a stream block. This annotation does not contain any validation and it's usage is not recommended!`,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ type Configuration struct {
|
|||
// By default this is disabled
|
||||
AllowBackendServerHeader bool `json:"allow-backend-server-header"`
|
||||
|
||||
// AccessLogParams sets additionals params for access_log
|
||||
// AccessLogParams sets additional params for access_log
|
||||
// http://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
|
||||
// By default it's empty
|
||||
AccessLogParams string `json:"access-log-params,omitempty"`
|
||||
|
|
@ -423,7 +423,7 @@ type Configuration struct {
|
|||
// Example '60s'
|
||||
ProxyProtocolHeaderTimeout time.Duration `json:"proxy-protocol-header-timeout,omitempty"`
|
||||
|
||||
// Enables or disables the directive aio_write that writes files files asynchronously
|
||||
// Enables or disables the directive aio_write that writes files asynchronously
|
||||
// https://nginx.org/en/docs/http/ngx_http_core_module.html#aio_write
|
||||
EnableAioWrite bool `json:"enable-aio-write,omitempty"`
|
||||
|
||||
|
|
@ -617,7 +617,7 @@ type Configuration struct {
|
|||
// Default: 0.01
|
||||
OtelSamplerRatio float32 `json:"otel-sampler-ratio"`
|
||||
|
||||
// OtelSamplerParentBased specifies the parent based sampler to be use for any traces created
|
||||
// OtelSamplerParentBased specifies the parent based sampler to be used for any traces created
|
||||
// Default: true
|
||||
OtelSamplerParentBased bool `json:"otel-sampler-parent-based"`
|
||||
|
||||
|
|
@ -714,7 +714,7 @@ type Configuration struct {
|
|||
DefaultSSLCertificate *ingress.SSLCert `json:"-"`
|
||||
|
||||
// ProxySSLLocationOnly controls whether the proxy-ssl parameters defined in the
|
||||
// proxy-ssl-* annotations are applied on on location level only in the nginx.conf file
|
||||
// proxy-ssl-* annotations are applied on location level only in the nginx.conf file
|
||||
// Default is that those are applied on server level, too
|
||||
ProxySSLLocationOnly bool `json:"proxy-ssl-location-only"`
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ func getEndpointsFromSlices(s *corev1.Service, port *corev1.ServicePort, proto c
|
|||
useTopologyHints = false
|
||||
if zoneForHints != emptyZone {
|
||||
useTopologyHints = true
|
||||
// check if all endpointslices has zone hints
|
||||
// check if all endpointslices have zone hints
|
||||
for _, ep := range eps.Endpoints {
|
||||
if ep.Hints == nil || len(ep.Hints.ForZones) == 0 {
|
||||
useTopologyHints = false
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ func TestCleanTempNginxCfg(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
//nolint:unparam // Ingnore `network` always receives `"tcp"` error
|
||||
//nolint:unparam // Ignore `network` always receives `"tcp"` error
|
||||
func tryListen(network, address string) (l net.Listener, err error) {
|
||||
condFunc := func() (bool, error) {
|
||||
l, err = net.Listen(network, address)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func TestEndpointSliceLister(t *testing.T) {
|
|||
}
|
||||
eps, err := el.MatchByKey(key)
|
||||
if err != nil {
|
||||
t.Errorf("unexpeted error %v", err)
|
||||
t.Errorf("unexpected error %v", err)
|
||||
}
|
||||
if err == nil && len(eps) != 1 {
|
||||
t.Errorf("expected one slice %v, error, got %d slices", endpointSlice, len(eps))
|
||||
|
|
@ -130,7 +130,7 @@ func TestEndpointSliceLister(t *testing.T) {
|
|||
}
|
||||
eps, err := el.MatchByKey(key)
|
||||
if err != nil {
|
||||
t.Errorf("unexpeted error %v", err)
|
||||
t.Errorf("unexpected error %v", err)
|
||||
}
|
||||
if len(eps) != 1 {
|
||||
t.Errorf("expected one slice %v, error, got %d slices", endpointSlice, len(eps))
|
||||
|
|
|
|||
|
|
@ -1208,13 +1208,13 @@ func TestStore(t *testing.T) {
|
|||
}
|
||||
}(updateCh)
|
||||
|
||||
namesapceSelector, err := labels.Parse("foo=bar")
|
||||
namespaceSelector, err := labels.Parse("foo=bar")
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
}
|
||||
storer := New(
|
||||
ns,
|
||||
namesapceSelector,
|
||||
namespaceSelector,
|
||||
fmt.Sprintf("%v/config", ns),
|
||||
fmt.Sprintf("%v/tcp", ns),
|
||||
fmt.Sprintf("%v/udp", ns),
|
||||
|
|
@ -1274,7 +1274,7 @@ func TestStore(t *testing.T) {
|
|||
t.Errorf("expected 0 events of type Delete but %v occurred", del)
|
||||
}
|
||||
})
|
||||
// test add ingress with secret it doesn't exists and then add secret
|
||||
// test add ingress with secret it doesn't exist and then add secret
|
||||
// check secret is generated on fs
|
||||
// check ocsp
|
||||
// check invalid secret (missing crt)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func NewNginxCommand() NginxCommand {
|
|||
return command
|
||||
}
|
||||
|
||||
// ExecCommand instanciates an exec.Cmd object to call nginx program
|
||||
// ExecCommand instantiates an exec.Cmd object to call nginx program
|
||||
func (nc NginxCommand) ExecCommand(args ...string) *exec.Cmd {
|
||||
cmdArgs := []string{}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ func (cm *Controller) IncCheckErrorCount(namespace, name string) {
|
|||
cm.checkIngressOperationErrors.MustCurryWith(cm.constLabels).With(labels).Inc()
|
||||
}
|
||||
|
||||
// IncOrphanIngress sets the the orphaned ingress gauge to one
|
||||
// IncOrphanIngress sets the orphaned ingress gauge to one
|
||||
func (cm *Controller) IncOrphanIngress(namespace, name, orphanityType string) {
|
||||
labels := prometheus.Labels{
|
||||
"namespace": namespace,
|
||||
|
|
@ -235,7 +235,7 @@ func (cm *Controller) IncOrphanIngress(namespace, name, orphanityType string) {
|
|||
cm.OrphanIngress.MustCurryWith(cm.constLabels).With(labels).Set(1.0)
|
||||
}
|
||||
|
||||
// DecOrphanIngress sets the the orphaned ingress gauge to zero (all services has their endpoints)
|
||||
// DecOrphanIngress sets the orphaned ingress gauge to zero (all services has their endpoints)
|
||||
func (cm *Controller) DecOrphanIngress(namespace, name, orphanityType string) {
|
||||
labels := prometheus.Labels{
|
||||
"namespace": namespace,
|
||||
|
|
@ -311,7 +311,7 @@ func (cm *Controller) SetSSLExpireTime(servers []*ingress.Server) {
|
|||
}
|
||||
}
|
||||
|
||||
// SetSSLInfo creates a metric with all certificates informations
|
||||
// SetSSLInfo creates a metric with all certificate information
|
||||
func (cm *Controller) SetSSLInfo(servers []*ingress.Server) {
|
||||
for _, s := range servers {
|
||||
if s.SSLCert == nil || s.SSLCert.Certificate == nil || s.SSLCert.Certificate.SerialNumber == nil {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ type Resolver interface {
|
|||
// GetSecurityConfiguration returns the configuration options from Ingress
|
||||
GetSecurityConfiguration() defaults.SecurityConfiguration
|
||||
|
||||
// GetConfigMap searches for configmap containing the namespace and name usting the character /
|
||||
// GetConfigMap searches for configmap containing the namespace and name using the character /
|
||||
GetConfigMap(string) (*apiv1.ConfigMap, error)
|
||||
|
||||
// GetSecret searches for secrets containing the namespace and name using a the character /
|
||||
// GetSecret searches for secrets containing the namespace and name using the character /
|
||||
GetSecret(string) (*apiv1.Secret, error)
|
||||
|
||||
// GetAuthCertificate resolves a given secret name into an SSL certificate and CRL.
|
||||
|
|
@ -42,7 +42,7 @@ type Resolver interface {
|
|||
// ca.crl: contains the revocation list used for authentication
|
||||
GetAuthCertificate(string) (*AuthSSLCert, error)
|
||||
|
||||
// GetService searches for services containing the namespace and name using a the character /
|
||||
// GetService searches for services containing the namespace and name using the character /
|
||||
GetService(string) (*apiv1.Service, error)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func (m Mock) GetSecurityConfiguration() defaults.SecurityConfiguration {
|
|||
}
|
||||
}
|
||||
|
||||
// GetSecret searches for secrets contenating the namespace and name using a the character /
|
||||
// GetSecret searches for secrets containing the namespace and name using the character /
|
||||
func (m Mock) GetSecret(string) (*apiv1.Secret, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
@ -60,12 +60,12 @@ func (m Mock) GetAuthCertificate(string) (*AuthSSLCert, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
// GetService searches for services contenating the namespace and name using a the character /
|
||||
// GetService searches for services containing the namespace and name using the character /
|
||||
func (m Mock) GetService(string) (*apiv1.Service, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// GetConfigMap searches for configMaps contenating the namespace and name using a the character /
|
||||
// GetConfigMap searches for configMaps containing the namespace and name using the character /
|
||||
func (m Mock) GetConfigMap(name string) (*apiv1.ConfigMap, error) {
|
||||
if v, ok := m.ConfigMaps[name]; ok {
|
||||
return v, nil
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ func getFakeHostSSLCert(host string) (cert, key []byte) {
|
|||
|
||||
// fullChainCert checks if a certificate file contains issues in the intermediate CA chain
|
||||
// Returns a new certificate with the intermediate certificates.
|
||||
// If the certificate does not contains issues with the chain it return an empty byte array
|
||||
// If the certificate does not contain issues with the chain it returns an empty byte array
|
||||
func fullChainCert(in []byte) ([]byte, error) {
|
||||
cert, err := certUtil.DecodeCertificate(in)
|
||||
if err != nil {
|
||||
|
|
@ -523,7 +523,7 @@ func (tl *TLSListener) GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, e
|
|||
return tl.certificate, tl.err
|
||||
}
|
||||
|
||||
// TLSConfig instanciates a TLS configuration, always providing an up to date certificate
|
||||
// TLSConfig instantiates a TLS configuration, always providing an up to date certificate
|
||||
func (tl *TLSListener) TLSConfig() *tls.Config {
|
||||
return &tls.Config{
|
||||
GetCertificate: tl.GetCertificate,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue