Drop v1beta1 from ingress nginx (#7156)
* Drop v1beta1 from ingress nginx Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com> * Fix intorstr logic in controller Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com> * fixing admission Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com> * more intorstr fixing * correct template rendering Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com> * Fix e2e tests for v1 api Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com> * Fix gofmt errors * This is finally working...almost there... Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com> * Re-add removed validation of AdmissionReview
This commit is contained in:
parent
a8408cdb51
commit
78afe7e389
159 changed files with 1217 additions and 1008 deletions
|
|
@ -27,6 +27,7 @@ import (
|
|||
"syscall"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
networking "k8s.io/api/networking/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/ingress-nginx/internal/ingress"
|
||||
"k8s.io/klog/v2"
|
||||
|
|
@ -47,8 +48,30 @@ func newUpstream(name string) *ingress.Backend {
|
|||
}
|
||||
|
||||
// upstreamName returns a formatted upstream name based on namespace, service, and port
|
||||
func upstreamName(namespace string, service string, port intstr.IntOrString) string {
|
||||
return fmt.Sprintf("%v-%v-%v", namespace, service, port.String())
|
||||
func upstreamName(namespace string, service *networking.IngressServiceBackend) string {
|
||||
if service != nil {
|
||||
if service.Port.Number > 0 {
|
||||
return fmt.Sprintf("%s-%s-%d", namespace, service.Name, service.Port.Number)
|
||||
}
|
||||
if service.Port.Name != "" {
|
||||
return fmt.Sprintf("%s-%s-%s", namespace, service.Name, service.Port.Name)
|
||||
}
|
||||
}
|
||||
return fmt.Sprintf("%s-INVALID", namespace)
|
||||
}
|
||||
|
||||
// upstreamServiceNameAndPort verifies if service is not nil, and then return the
|
||||
// correct serviceName and Port
|
||||
func upstreamServiceNameAndPort(service *networking.IngressServiceBackend) (string, intstr.IntOrString) {
|
||||
if service != nil {
|
||||
if service.Port.Number > 0 {
|
||||
return service.Name, intstr.FromInt(int(service.Port.Number))
|
||||
}
|
||||
if service.Port.Name != "" {
|
||||
return service.Name, intstr.FromString(service.Port.Name)
|
||||
}
|
||||
}
|
||||
return "", intstr.IntOrString{}
|
||||
}
|
||||
|
||||
// sysctlSomaxconn returns the maximum number of connections that can be queued
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue