feat(tenant): support gateway/class (#1463)

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

Co-authored-by: Oliver Bähler <oliverbaehler@hotmail.com>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

* feat(tenant): support gateway/class

Signed-off-by: Hristo Hristov <me@hhristov.info>

---------

Signed-off-by: Hristo Hristov <me@hhristov.info>
Co-authored-by: Oliver Bähler <oliverbaehler@hotmail.com>
This commit is contained in:
Hristo Hristov
2025-05-20 19:53:42 +03:00
committed by GitHub
parent 7d0a4c58fd
commit a60ebfac5e
25 changed files with 895 additions and 293 deletions

View File

@@ -37,3 +37,14 @@ func DefaultAllowedValuesErrorMessage(allowed api.DefaultAllowedListSpec, err st
return err
}
func SelectionListWithDefaultErrorMessage(allowed api.SelectionListWithDefaultSpec, err string) string {
var extra []string
if len(allowed.MatchLabels) > 0 || len(allowed.MatchExpressions) > 0 {
extra = append(extra, "matching the label selector defined in the Tenant")
}
err += strings.Join(extra, " or ")
return err
}

View File

@@ -5,6 +5,7 @@ package utils
import (
"context"
"reflect"
networkingv1 "k8s.io/api/networking/v1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
@@ -13,6 +14,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/version"
"sigs.k8s.io/controller-runtime/pkg/client"
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
)
const TRUE string = "true"
@@ -63,6 +65,18 @@ func GetIngressClassByName(ctx context.Context, version *version.Version, c clie
return obj, nil
}
// Get GatewayClassClass by name (Does not return error if not found).
func GetGatewayClassClassByObjectName(ctx context.Context, c client.Client, gatewayClassName gatewayv1.ObjectName) (*gatewayv1.GatewayClass, error) {
objName := reflect.ValueOf(gatewayClassName).String()
gatewayClass := &gatewayv1.GatewayClass{}
if err := c.Get(ctx, types.NamespacedName{Name: objName}, gatewayClass); err != nil {
return nil, err
}
return gatewayClass, nil
}
// IsDefaultPriorityClass checks if the given PriorityClass is cluster default.
func IsDefaultPriorityClass(class *schedulev1.PriorityClass) bool {
if class != nil {