Skip to content

Commit cf8a64a

Browse files
authored
Merge pull request #642 from shengnuo/revert-httproutes
Revert HTTPRoutes
2 parents f9c67b9 + 1c1b7ad commit cf8a64a

File tree

120 files changed

+1823
-15535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1823
-15535
lines changed

api/apps/v1alpha1/common_types.go

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
corev1 "k8s.io/api/core/v1"
2323
networkingv1 "k8s.io/api/networking/v1"
2424
"k8s.io/utils/ptr"
25-
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
2625
)
2726

2827
const (
@@ -38,9 +37,8 @@ const (
3837

3938
// Expose defines attributes to expose the service.
4039
type Expose struct {
41-
Service Service `json:"service,omitempty"`
42-
Ingress Ingress `json:"ingress,omitempty"`
43-
HTTPRoute HTTPRoute `json:"httpRoute,omitempty"`
40+
Service Service `json:"service,omitempty"`
41+
Ingress Ingress `json:"ingress,omitempty"`
4442
}
4543

4644
// Service defines attributes to create a service.
@@ -71,9 +69,8 @@ type Service struct {
7169

7270
// ExposeV1 defines attributes to expose the service.
7371
type ExposeV1 struct {
74-
Service Service `json:"service,omitempty"`
75-
Ingress IngressV1 `json:"ingress,omitempty"`
76-
HTTPRoute HTTPRoute `json:"httpRoute,omitempty"`
72+
Service Service `json:"service,omitempty"`
73+
Ingress IngressV1 `json:"ingress,omitempty"`
7774
}
7875

7976
// Metrics defines attributes to setup metrics collection.
@@ -122,32 +119,6 @@ type Ingress struct {
122119
Spec networkingv1.IngressSpec `json:"spec,omitempty"`
123120
}
124121

125-
// HTTPRoute defines attributes to HTTPRoute in Gateway API.
126-
type HTTPRoute struct {
127-
Enabled *bool `json:"enabled,omitempty"`
128-
Annotations map[string]string `json:"annotations,omitempty"`
129-
Spec *HTTPRouteSpec `json:"spec,omitempty"`
130-
}
131-
132-
type HTTPRouteSpec struct {
133-
gatewayv1.CommonRouteSpec `json:",inline"`
134-
Host gatewayv1.Hostname `json:"host,omitempty"`
135-
Paths []HTTPPathMatch `json:"paths,omitempty"`
136-
}
137-
138-
type HTTPPathMatch struct {
139-
// Type specifies how to match against the path Value.
140-
// +optional
141-
// +kubebuilder:default=PathPrefix
142-
Type *gatewayv1.PathMatchType `json:"type,omitempty"`
143-
144-
// Value of the HTTP path to match against.
145-
// +optional
146-
// +kubebuilder:default="/"
147-
// +kubebuilder:validation:MaxLength=1024
148-
Value *string `json:"value,omitempty"`
149-
}
150-
151122
// IngressV1 defines attributes for ingress
152123
//
153124
// +kubebuilder:validation:XValidation:rule="(has(self.spec) && has(self.enabled) && self.enabled) || !has(self.enabled) || !self.enabled", message="spec cannot be nil when ingress is enabled"
@@ -171,43 +142,6 @@ type ResourceRequirements struct {
171142
Requests corev1.ResourceList `json:"requests,omitempty" protobuf:"bytes,2,rep,name=requests,casttype=ResourceList,castkey=ResourceName"`
172143
}
173144

174-
func (i *HTTPRoute) GenerateGatewayHTTPRouteSpec(name string) gatewayv1.HTTPRouteSpec {
175-
if i.Spec == nil {
176-
return gatewayv1.HTTPRouteSpec{}
177-
}
178-
179-
port := gatewayv1.PortNumber(DefaultAPIPort)
180-
httpRouteMatches := []gatewayv1.HTTPRouteMatch{}
181-
for _, path := range i.Spec.Paths {
182-
httpRouteMatches = append(httpRouteMatches, gatewayv1.HTTPRouteMatch{
183-
Path: &gatewayv1.HTTPPathMatch{
184-
Type: path.Type,
185-
Value: path.Value,
186-
},
187-
})
188-
}
189-
190-
return gatewayv1.HTTPRouteSpec{
191-
CommonRouteSpec: i.Spec.CommonRouteSpec,
192-
Hostnames: []gatewayv1.Hostname{i.Spec.Host},
193-
Rules: []gatewayv1.HTTPRouteRule{
194-
{
195-
BackendRefs: []gatewayv1.HTTPBackendRef{
196-
{
197-
BackendRef: gatewayv1.BackendRef{
198-
BackendObjectReference: gatewayv1.BackendObjectReference{
199-
Name: gatewayv1.ObjectName(name),
200-
Port: &port,
201-
},
202-
},
203-
},
204-
},
205-
Matches: httpRouteMatches,
206-
},
207-
},
208-
}
209-
}
210-
211145
func (i *IngressV1) GenerateNetworkingV1IngressSpec(name string) networkingv1.IngressSpec {
212146
if i.Spec == nil {
213147
return networkingv1.IngressSpec{}

api/apps/v1alpha1/nemo_customizer_types.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import (
3333
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3434
"k8s.io/apimachinery/pkg/util/intstr"
3535
"k8s.io/utils/ptr"
36-
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
3736

3837
rendertypes "github.com/NVIDIA/k8s-nim-operator/internal/render/types"
3938
utils "github.com/NVIDIA/k8s-nim-operator/internal/utils"
@@ -644,14 +643,6 @@ func (n *NemoCustomizer) GetIngressSpec() networkingv1.IngressSpec {
644643
return n.Spec.Expose.Ingress.GenerateNetworkingV1IngressSpec(n.GetName())
645644
}
646645

647-
func (n *NemoCustomizer) IsHTTPRouteEnabled() bool {
648-
return n.Spec.Expose.HTTPRoute.Enabled != nil && *n.Spec.Expose.HTTPRoute.Enabled
649-
}
650-
651-
func (n *NemoCustomizer) GetHTTPRouteSpec() gatewayv1.HTTPRouteSpec {
652-
return n.Spec.Expose.HTTPRoute.GenerateGatewayHTTPRouteSpec(n.GetName())
653-
}
654-
655646
// IsServiceMonitorEnabled returns true if servicemonitor is enabled for NemoCustomizer deployment.
656647
func (n *NemoCustomizer) IsServiceMonitorEnabled() bool {
657648
return n.Spec.Metrics.Enabled != nil && *n.Spec.Metrics.Enabled
@@ -848,20 +839,6 @@ func (n *NemoCustomizer) GetIngressParams() *rendertypes.IngressParams {
848839
return params
849840
}
850841

851-
// GetHTTPRouteParams returns params to render HTTPRoute from templates.
852-
func (n *NemoCustomizer) GetHTTPRouteParams() *rendertypes.HTTPRouteParams {
853-
params := &rendertypes.HTTPRouteParams{}
854-
params.Enabled = n.IsHTTPRouteEnabled()
855-
856-
// Set metadata
857-
params.Name = n.GetName()
858-
params.Namespace = n.GetNamespace()
859-
params.Labels = n.GetServiceLabels()
860-
params.Annotations = n.GetHTTPRouteAnnotations()
861-
params.Spec = n.GetHTTPRouteSpec()
862-
return params
863-
}
864-
865842
// GetRoleParams returns params to render Role from templates.
866843
func (n *NemoCustomizer) GetRoleParams() *rendertypes.RoleParams {
867844
params := &rendertypes.RoleParams{}
@@ -1046,15 +1023,6 @@ func (n *NemoCustomizer) GetIngressAnnotations() map[string]string {
10461023
return NemoCustomizerAnnotations
10471024
}
10481025

1049-
func (n *NemoCustomizer) GetHTTPRouteAnnotations() map[string]string {
1050-
annotations := n.GetNemoCustomizerAnnotations()
1051-
1052-
if n.Spec.Expose.HTTPRoute.Annotations != nil {
1053-
return utils.MergeMaps(annotations, n.Spec.Expose.HTTPRoute.Annotations)
1054-
}
1055-
return annotations
1056-
}
1057-
10581026
// GetServiceAnnotations return standard and customized service annotations.
10591027
func (n *NemoCustomizer) GetServiceAnnotations() map[string]string {
10601028
NemoCustomizerAnnotations := n.GetNemoCustomizerAnnotations()

api/apps/v1alpha1/nemo_datastore_types.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
"k8s.io/apimachinery/pkg/util/intstr"
3232
"k8s.io/utils/ptr"
33-
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
3433

3534
rendertypes "github.com/NVIDIA/k8s-nim-operator/internal/render/types"
3635
utils "github.com/NVIDIA/k8s-nim-operator/internal/utils"
@@ -768,19 +767,11 @@ func (n *NemoDatastore) IsIngressEnabled() bool {
768767
return n.Spec.Expose.Ingress.Enabled != nil && *n.Spec.Expose.Ingress.Enabled
769768
}
770769

771-
func (n *NemoDatastore) IsHTTPRouteEnabled() bool {
772-
return n.Spec.Expose.HTTPRoute.Enabled != nil && *n.Spec.Expose.HTTPRoute.Enabled
773-
}
774-
775770
// GetIngressSpec returns the Ingress spec NemoDatastore deployment.
776771
func (n *NemoDatastore) GetIngressSpec() networkingv1.IngressSpec {
777772
return n.Spec.Expose.Ingress.GenerateNetworkingV1IngressSpec(n.GetName())
778773
}
779774

780-
func (n *NemoDatastore) GetHTTPRouteSpec() gatewayv1.HTTPRouteSpec {
781-
return n.Spec.Expose.HTTPRoute.GenerateGatewayHTTPRouteSpec(n.GetName())
782-
}
783-
784775
// IsServiceMonitorEnabled returns true if servicemonitor is enabled for NemoDatastore deployment.
785776
func (n *NemoDatastore) IsServiceMonitorEnabled() bool {
786777
return n.Spec.Metrics.Enabled != nil && *n.Spec.Metrics.Enabled
@@ -976,20 +967,6 @@ func (n *NemoDatastore) GetIngressParams() *rendertypes.IngressParams {
976967
return params
977968
}
978969

979-
// GetHTTPRouteParams returns params to render HTTPRoute from templates.
980-
func (n *NemoDatastore) GetHTTPRouteParams() *rendertypes.HTTPRouteParams {
981-
params := &rendertypes.HTTPRouteParams{}
982-
params.Enabled = n.IsHTTPRouteEnabled()
983-
984-
// Set metadata
985-
params.Name = n.GetName()
986-
params.Namespace = n.GetNamespace()
987-
params.Labels = n.GetServiceLabels()
988-
params.Annotations = n.GetHTTPRouteAnnotations()
989-
params.Spec = n.GetHTTPRouteSpec()
990-
return params
991-
}
992-
993970
// GetRoleParams returns params to render Role from templates.
994971
func (n *NemoDatastore) GetRoleParams() *rendertypes.RoleParams {
995972
params := &rendertypes.RoleParams{}
@@ -1100,15 +1077,6 @@ func (n *NemoDatastore) GetIngressAnnotations() map[string]string {
11001077
return NemoDatastoreAnnotations
11011078
}
11021079

1103-
func (n *NemoDatastore) GetHTTPRouteAnnotations() map[string]string {
1104-
annotations := n.GetNemoDatastoreAnnotations()
1105-
1106-
if n.Spec.Expose.HTTPRoute.Annotations != nil {
1107-
return utils.MergeMaps(annotations, n.Spec.Expose.HTTPRoute.Annotations)
1108-
}
1109-
return annotations
1110-
}
1111-
11121080
func (n *NemoDatastore) GetServiceAnnotations() map[string]string {
11131081
NemoDatastoreAnnotations := n.GetNemoDatastoreAnnotations()
11141082

api/apps/v1alpha1/nemo_entitystore_types.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3232
"k8s.io/apimachinery/pkg/util/intstr"
3333
"k8s.io/utils/ptr"
34-
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
3534

3635
rendertypes "github.com/NVIDIA/k8s-nim-operator/internal/render/types"
3736
utils "github.com/NVIDIA/k8s-nim-operator/internal/utils"
@@ -400,14 +399,6 @@ func (n *NemoEntitystore) GetIngressSpec() networkingv1.IngressSpec {
400399
return n.Spec.Expose.Ingress.GenerateNetworkingV1IngressSpec(n.GetName())
401400
}
402401

403-
func (n *NemoEntitystore) IsHTTPRouteEnabled() bool {
404-
return n.Spec.Expose.HTTPRoute.Enabled != nil && *n.Spec.Expose.HTTPRoute.Enabled
405-
}
406-
407-
func (n *NemoEntitystore) GetHTTPRouteSpec() gatewayv1.HTTPRouteSpec {
408-
return n.Spec.Expose.HTTPRoute.GenerateGatewayHTTPRouteSpec(n.GetName())
409-
}
410-
411402
// IsServiceMonitorEnabled returns true if servicemonitor is enabled for NemoEntitystore deployment.
412403
func (n *NemoEntitystore) IsServiceMonitorEnabled() bool {
413404
return n.Spec.Metrics.Enabled != nil && *n.Spec.Metrics.Enabled
@@ -610,20 +601,6 @@ func (n *NemoEntitystore) GetIngressParams() *rendertypes.IngressParams {
610601
return params
611602
}
612603

613-
// GetHTTPRouteParams returns params to render HTTPRoute from templates.
614-
func (n *NemoEntitystore) GetHTTPRouteParams() *rendertypes.HTTPRouteParams {
615-
params := &rendertypes.HTTPRouteParams{}
616-
params.Enabled = n.IsHTTPRouteEnabled()
617-
618-
// Set metadata
619-
params.Name = n.GetName()
620-
params.Namespace = n.GetNamespace()
621-
params.Labels = n.GetServiceLabels()
622-
params.Annotations = n.GetHTTPRouteAnnotations()
623-
params.Spec = n.GetHTTPRouteSpec()
624-
return params
625-
}
626-
627604
// GetRoleParams returns params to render Role from templates.
628605
func (n *NemoEntitystore) GetRoleParams() *rendertypes.RoleParams {
629606
params := &rendertypes.RoleParams{}
@@ -734,15 +711,6 @@ func (n *NemoEntitystore) GetIngressAnnotations() map[string]string {
734711
return NemoEntitystoreAnnotations
735712
}
736713

737-
func (n *NemoEntitystore) GetHTTPRouteAnnotations() map[string]string {
738-
annotations := n.GetNemoEntitystoreAnnotations()
739-
740-
if n.Spec.Expose.HTTPRoute.Annotations != nil {
741-
return utils.MergeMaps(annotations, n.Spec.Expose.HTTPRoute.Annotations)
742-
}
743-
return annotations
744-
}
745-
746714
func (n *NemoEntitystore) GetServiceAnnotations() map[string]string {
747715
NemoEntitystoreAnnotations := n.GetNemoEntitystoreAnnotations()
748716

api/apps/v1alpha1/nemo_evaluator_types.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import (
3232
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333
"k8s.io/apimachinery/pkg/util/intstr"
3434
"k8s.io/utils/ptr"
35-
gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
3635

3736
rendertypes "github.com/NVIDIA/k8s-nim-operator/internal/render/types"
3837
utils "github.com/NVIDIA/k8s-nim-operator/internal/utils"
@@ -585,19 +584,11 @@ func (n *NemoEvaluator) IsIngressEnabled() bool {
585584
return n.Spec.Expose.Ingress.Enabled != nil && *n.Spec.Expose.Ingress.Enabled
586585
}
587586

588-
func (n *NemoEvaluator) IsHTTPRouteEnabled() bool {
589-
return n.Spec.Expose.HTTPRoute.Enabled != nil && *n.Spec.Expose.HTTPRoute.Enabled
590-
}
591-
592587
// GetIngressSpec returns the Ingress spec NemoEvaluator deployment.
593588
func (n *NemoEvaluator) GetIngressSpec() networkingv1.IngressSpec {
594589
return n.Spec.Expose.Ingress.GenerateNetworkingV1IngressSpec(n.GetName())
595590
}
596591

597-
func (n *NemoEvaluator) GetHTTPRouteSpec() gatewayv1.HTTPRouteSpec {
598-
return n.Spec.Expose.HTTPRoute.GenerateGatewayHTTPRouteSpec(n.GetName())
599-
}
600-
601592
// IsServiceMonitorEnabled returns true if servicemonitor is enabled for NemoEvaluator deployment.
602593
func (n *NemoEvaluator) IsServiceMonitorEnabled() bool {
603594
return n.Spec.Metrics.Enabled != nil && *n.Spec.Metrics.Enabled
@@ -793,20 +784,6 @@ func (n *NemoEvaluator) GetIngressParams() *rendertypes.IngressParams {
793784
return params
794785
}
795786

796-
// GetHTTPRouteParams returns params to render HTTPRoute from templates.
797-
func (n *NemoEvaluator) GetHTTPRouteParams() *rendertypes.HTTPRouteParams {
798-
params := &rendertypes.HTTPRouteParams{}
799-
params.Enabled = n.IsHTTPRouteEnabled()
800-
801-
// Set metadata
802-
params.Name = n.GetName()
803-
params.Namespace = n.GetNamespace()
804-
params.Labels = n.GetServiceLabels()
805-
params.Annotations = n.GetHTTPRouteAnnotations()
806-
params.Spec = n.GetHTTPRouteSpec()
807-
return params
808-
}
809-
810787
// GetRoleParams returns params to render Role from templates.
811788
func (n *NemoEvaluator) GetRoleParams() *rendertypes.RoleParams {
812789
params := &rendertypes.RoleParams{}
@@ -922,15 +899,6 @@ func (n *NemoEvaluator) GetIngressAnnotations() map[string]string {
922899
return NemoEvaluatorAnnotations
923900
}
924901

925-
func (n *NemoEvaluator) GetHTTPRouteAnnotations() map[string]string {
926-
annotations := n.GetNemoEvaluatorAnnotations()
927-
928-
if n.Spec.Expose.HTTPRoute.Annotations != nil {
929-
return utils.MergeMaps(annotations, n.Spec.Expose.HTTPRoute.Annotations)
930-
}
931-
return annotations
932-
}
933-
934902
func (n *NemoEvaluator) GetServiceAnnotations() map[string]string {
935903
NemoEvaluatorAnnotations := n.GetNemoEvaluatorAnnotations()
936904

0 commit comments

Comments
 (0)