|
| 1 | +/* |
| 2 | +Copyright 2025 Agentic Layer. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha1 |
| 18 | + |
| 19 | +import ( |
| 20 | + corev1 "k8s.io/api/core/v1" |
| 21 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | +) |
| 23 | + |
| 24 | +// ToolGatewaySpec defines the desired state of ToolGateway |
| 25 | +type ToolGatewaySpec struct { |
| 26 | + // ToolGatewayClassName specifies which ToolGatewayClass to use for this gateway instance. |
| 27 | + // This is only needed if multiple gateway classes are defined in the cluster. |
| 28 | + ToolGatewayClassName string `json:"toolGatewayClassName,omitempty"` |
| 29 | + |
| 30 | + // Environment variables to pass to the ToolGateway container. |
| 31 | + // These can include configuration values, credentials, or feature flags. |
| 32 | + // +optional |
| 33 | + Env []corev1.EnvVar `json:"env,omitempty"` |
| 34 | + |
| 35 | + // List of sources to populate environment variables in the ToolGateway container. |
| 36 | + // This allows loading variables from ConfigMaps and Secrets. |
| 37 | + // +optional |
| 38 | + EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"` |
| 39 | +} |
| 40 | + |
| 41 | +// ToolGatewayStatus defines the observed state of ToolGateway |
| 42 | +type ToolGatewayStatus struct { |
| 43 | + // Conditions represent the latest available observations of the gateway's state |
| 44 | + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` |
| 45 | +} |
| 46 | + |
| 47 | +// +kubebuilder:object:root=true |
| 48 | +// +kubebuilder:subresource:status |
| 49 | + |
| 50 | +// ToolGateway is the Schema for the toolgateways API |
| 51 | +type ToolGateway struct { |
| 52 | + metav1.TypeMeta `json:",inline"` |
| 53 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 54 | + |
| 55 | + Spec ToolGatewaySpec `json:"spec,omitempty"` |
| 56 | + Status ToolGatewayStatus `json:"status,omitempty"` |
| 57 | +} |
| 58 | + |
| 59 | +// +kubebuilder:object:root=true |
| 60 | + |
| 61 | +// ToolGatewayList contains a list of ToolGateway |
| 62 | +type ToolGatewayList struct { |
| 63 | + metav1.TypeMeta `json:",inline"` |
| 64 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 65 | + Items []ToolGateway `json:"items"` |
| 66 | +} |
| 67 | + |
| 68 | +// ToolGatewayClassSpec defines the desired state of ToolGatewayClass |
| 69 | +type ToolGatewayClassSpec struct { |
| 70 | + // Controller is the name of the controller that should handle this gateway class |
| 71 | + // +kubebuilder:validation:Required |
| 72 | + Controller string `json:"controller"` |
| 73 | +} |
| 74 | + |
| 75 | +// ToolGatewayClassStatus defines the observed state of ToolGatewayClass |
| 76 | +type ToolGatewayClassStatus struct { |
| 77 | + // Conditions represent the latest available observations of the gateway class's state |
| 78 | + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` |
| 79 | +} |
| 80 | + |
| 81 | +// +kubebuilder:object:root=true |
| 82 | +// +kubebuilder:subresource:status |
| 83 | +// +kubebuilder:resource:scope=Cluster |
| 84 | +// +kubebuilder:printcolumn:name="Controller",type="string",JSONPath=".spec.controller" |
| 85 | +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" |
| 86 | + |
| 87 | +// ToolGatewayClass is the Schema for the toolgatewayclasses API |
| 88 | +type ToolGatewayClass struct { |
| 89 | + metav1.TypeMeta `json:",inline"` |
| 90 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 91 | + |
| 92 | + Spec ToolGatewayClassSpec `json:"spec,omitempty"` |
| 93 | + Status ToolGatewayClassStatus `json:"status,omitempty"` |
| 94 | +} |
| 95 | + |
| 96 | +// +kubebuilder:object:root=true |
| 97 | + |
| 98 | +// ToolGatewayClassList contains a list of ToolGatewayClass |
| 99 | +type ToolGatewayClassList struct { |
| 100 | + metav1.TypeMeta `json:",inline"` |
| 101 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 102 | + Items []ToolGatewayClass `json:"items"` |
| 103 | +} |
| 104 | + |
| 105 | +func init() { |
| 106 | + SchemeBuilder.Register(&ToolGateway{}, &ToolGatewayList{}, &ToolGatewayClass{}, &ToolGatewayClassList{}) |
| 107 | +} |
0 commit comments