|
| 1 | +/* |
| 2 | +Copyright 2025. |
| 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 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 24 | +// Important: Run "make" to regenerate code after modifying this file |
| 25 | + |
| 26 | +// SandboxClaimSpec defines the desired state of Sandbox |
| 27 | +type SandboxClaimSpec struct { |
| 28 | + // The following markers will use OpenAPI v3 schema to validate the value |
| 29 | + // More info: https://book.kubebuilder.io/reference/markers/crd-validation.html |
| 30 | + |
| 31 | + TTLSeconds *int32 `json:"ttlSeconds,omitempty" protobuf:"varint,1,opt,name=ttlSeconds"` |
| 32 | + |
| 33 | + // Template refers to the SandboxTemplate to be used for creating a Sandbox |
| 34 | + // +kubebuilder:validation:Required |
| 35 | + TemplateName string `json:"templateName,omitempty" protobuf:"bytes,3,name=templateName"` |
| 36 | + |
| 37 | + // TemplateNamespace refers to the SandboxTemplate namespace |
| 38 | + // +kubebuilder:validation:Optional |
| 39 | + TemplateNamespace string `json:"templateNamespace,omitempty" protobuf:"bytes,4,opt,name=templateNamespace"` |
| 40 | +} |
| 41 | + |
| 42 | +// SandboxClaimStatus defines the observed state of Sandbox. |
| 43 | +type SandboxClaimStatus struct { |
| 44 | + SandboxName string `json:"sandboxName,omitempty"` |
| 45 | + TemplateRevision string `json:"templateRevision,omitempty"` |
| 46 | + Hostname string `json:"hostname,omitempty"` |
| 47 | +} |
| 48 | + |
| 49 | +// +kubebuilder:object:root=true |
| 50 | +// +kubebuilder:subresource:status |
| 51 | +// +kubebuilder:resource:scope=Namespaced,shortName=sandboxclaim |
| 52 | +// SandboxClaim is the Schema for the sandbox Claim API |
| 53 | +type SandboxClaim struct { |
| 54 | + metav1.TypeMeta `json:",inline"` |
| 55 | + |
| 56 | + // metadata is a standard object metadata |
| 57 | + // +optional |
| 58 | + metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` |
| 59 | + |
| 60 | + // spec defines the desired state of Sandbox |
| 61 | + // +required |
| 62 | + Spec SandboxClaimSpec `json:"spec"` |
| 63 | + |
| 64 | + // status defines the observed state of Sandbox |
| 65 | + // +optional |
| 66 | + Status SandboxClaimStatus `json:"status,omitempty,omitzero"` |
| 67 | +} |
| 68 | + |
| 69 | +// +kubebuilder:object:root=true |
| 70 | + |
| 71 | +// SandboxList contains a list of Sandbox |
| 72 | +type SandboxClaimList struct { |
| 73 | + metav1.TypeMeta `json:",inline"` |
| 74 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 75 | + Items []SandboxClaim `json:"items"` |
| 76 | +} |
| 77 | + |
| 78 | +func init() { |
| 79 | + SchemeBuilder.Register(&SandboxClaim{}, &SandboxClaimList{}) |
| 80 | +} |
0 commit comments