fix: replace client-go informer with REST loader, drop k8s deps
Informer cache sync timed out due to transient 429 from API server. REST loader does one GET + retry, polls every 30s. Zero new deps. go.mod back to 1.25.4, CI back to golang:1.25-bookworm.
This commit is contained in:
@@ -1,29 +1,13 @@
|
||||
/*
|
||||
Copyright 2026.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1 contains API Schema definitions for the gateway v1 API group
|
||||
// Package v1 contains API Schema definitions for the gateway v1 API group.
|
||||
// These types document the CRD shape; the gateway itself uses the dynamic
|
||||
// REST loader (no typed client, no scheme registration).
|
||||
//
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=gateway.riotpiao.com
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects.
|
||||
GroupVersion = schema.GroupVersion{Group: "gateway.riotpiao.com", Version: "v1"}
|
||||
// GroupVersion constants for the CRD.
|
||||
const (
|
||||
Group = "gateway.riotpiao.com"
|
||||
Version = "v1"
|
||||
)
|
||||
|
||||
@@ -1,160 +1,58 @@
|
||||
/*
|
||||
Copyright 2026.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1 documents the ServiceAdapter CRD shape.
|
||||
// These structs mirror the CRD schema in k8s/crd-serviceadapter.yaml.
|
||||
// The gateway reads CRs via plain REST+JSON — no typed client needed.
|
||||
package v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// ServiceAdapterUpstream defines the upstream target for this adapter.
|
||||
type ServiceAdapterUpstream struct {
|
||||
// URL is the upstream service endpoint.
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
URL string `json:"url"`
|
||||
|
||||
// TimeoutSeconds is the request timeout in seconds.
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=3600
|
||||
TimeoutSeconds int32 `json:"timeoutSeconds"`
|
||||
URL string `json:"url"`
|
||||
TimeoutSeconds int32 `json:"timeoutSeconds"`
|
||||
}
|
||||
|
||||
// ServiceAdapterAuth defines authentication requirements.
|
||||
type ServiceAdapterAuth struct {
|
||||
// Required indicates if authentication is needed.
|
||||
// +kubebuilder:validation:Required
|
||||
Required bool `json:"required"`
|
||||
|
||||
// Capability is the required capability name (e.g., "reasoning", "embedding").
|
||||
// Empty if auth is not required.
|
||||
// +kubebuilder:validation:Optional
|
||||
Required bool `json:"required"`
|
||||
Capability string `json:"capability,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAdapterMethod defines a single method endpoint.
|
||||
type ServiceAdapterMethod struct {
|
||||
// Verb is the HTTP method (GET, POST, etc.).
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:Enum=GET;POST;PUT;DELETE;PATCH;HEAD;OPTIONS
|
||||
Verb string `json:"verb"`
|
||||
|
||||
// UpstreamPath is the path to forward to on the upstream.
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
UpstreamPath string `json:"upstreamPath"`
|
||||
|
||||
// RequestSchema is the flat KV+type validation schema for requests (optional).
|
||||
// +kubebuilder:validation:Optional
|
||||
RequestSchema string `json:"requestSchema,omitempty"`
|
||||
|
||||
// ResponseSchema is the flat KV+type validation schema for responses (optional).
|
||||
// +kubebuilder:validation:Optional
|
||||
ResponseSchema string `json:"responseSchema,omitempty"`
|
||||
|
||||
// Auth overrides the resource-level auth for this method (optional).
|
||||
// +kubebuilder:validation:Optional
|
||||
Auth *ServiceAdapterAuth `json:"auth,omitempty"`
|
||||
Verb string `json:"verb"`
|
||||
UpstreamPath string `json:"upstreamPath"`
|
||||
RequestSchema string `json:"requestSchema,omitempty"`
|
||||
ResponseSchema string `json:"responseSchema,omitempty"`
|
||||
Auth *ServiceAdapterAuth `json:"auth,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAdapterResource defines a resource exposed by this adapter.
|
||||
type ServiceAdapterResource struct {
|
||||
// Name is the resource identifier.
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Name string `json:"name"`
|
||||
|
||||
// Methods are the HTTP methods available for this resource.
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MinItems=1
|
||||
Name string `json:"name"`
|
||||
Methods []ServiceAdapterMethod `json:"methods"`
|
||||
|
||||
// Auth applies to all methods in this resource unless overridden.
|
||||
// +kubebuilder:validation:Optional
|
||||
Auth *ServiceAdapterAuth `json:"auth,omitempty"`
|
||||
Auth *ServiceAdapterAuth `json:"auth,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceAdapterSpec defines the desired state of ServiceAdapter.
|
||||
type ServiceAdapterSpec struct {
|
||||
// ServiceName is the unique identifier for this service.
|
||||
// +kubebuilder:validation:Required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
// +kubebuilder:validation:MaxLength=63
|
||||
ServiceName string `json:"serviceName"`
|
||||
|
||||
// Upstream defines where to forward requests.
|
||||
// +kubebuilder:validation:Required
|
||||
Upstream ServiceAdapterUpstream `json:"upstream"`
|
||||
|
||||
// Auth defines default authentication for this adapter.
|
||||
// +kubebuilder:validation:Required
|
||||
Auth ServiceAdapterAuth `json:"auth"`
|
||||
|
||||
// Retryable indicates if requests can be retried on 5xx.
|
||||
// +kubebuilder:validation:Optional
|
||||
// +kubebuilder:validation:Default=false
|
||||
Retryable bool `json:"retryable,omitempty"`
|
||||
|
||||
// Resources are the endpoints exposed by this adapter.
|
||||
// +kubebuilder:validation:Required
|
||||
Resources []ServiceAdapterResource `json:"resources"`
|
||||
ServiceName string `json:"serviceName"`
|
||||
Upstream ServiceAdapterUpstream `json:"upstream"`
|
||||
Auth ServiceAdapterAuth `json:"auth"`
|
||||
Retryable bool `json:"retryable,omitempty"`
|
||||
Resources []ServiceAdapterResource `json:"resources"`
|
||||
}
|
||||
|
||||
// ServiceAdapterStatus defines the observed state of ServiceAdapter.
|
||||
type ServiceAdapterStatus struct {
|
||||
// Ready indicates if the adapter is loaded and healthy.
|
||||
// +kubebuilder:validation:Optional
|
||||
Ready bool `json:"ready,omitempty"`
|
||||
|
||||
// Error message if the adapter failed to load.
|
||||
// +kubebuilder:validation:Optional
|
||||
Ready bool `json:"ready,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
|
||||
// LastSyncTime is when the adapter was last synced.
|
||||
// +kubebuilder:validation:Optional
|
||||
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:scope=Namespaced
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="Service",type=string,JSONPath=`.spec.serviceName`
|
||||
// +kubebuilder:printcolumn:name="Ready",type=boolean,JSONPath=`.status.ready`
|
||||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
|
||||
|
||||
// ServiceAdapter describes a service exposed through the gateway.
|
||||
type ServiceAdapter struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ServiceAdapterSpec `json:"spec,omitempty"`
|
||||
Status ServiceAdapterStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ServiceAdapterList contains a list of ServiceAdapter.
|
||||
type ServiceAdapterList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ServiceAdapter `json:"items"`
|
||||
Items []ServiceAdapter `json:"items"`
|
||||
}
|
||||
|
||||
// Note: DeepCopyObject is not generated. The gateway uses the dynamic
|
||||
// (unstructured) k8s client, so typed scheme registration is unnecessary.
|
||||
// If a typed client is needed later, run controller-gen to generate
|
||||
// the DeepCopy methods and re-enable SchemeBuilder.Register here.
|
||||
|
||||
Reference in New Issue
Block a user