Skip to content

Commit fd03c3d

Browse files
authored
Merge pull request #17 from numtide/multiorch-api-and-crd
2 parents 6e33077 + 761355b commit fd03c3d

File tree

2 files changed

+1518
-24
lines changed

2 files changed

+1518
-24
lines changed

api/v1alpha1/multiorch_types.go

Lines changed: 96 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,109 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

23-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
24+
// NOTE: json tags are required. Any new fields you add must have json tags for
25+
// the fields to be serialized.
2526

26-
// MultiOrchSpec defines the desired state of MultiOrch
27+
// MultiOrchSpec defines the desired state of MultiOrch.
2728
type MultiOrchSpec struct {
28-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29-
// Important: Run "make" to regenerate code after modifying this file
30-
// The following markers will use OpenAPI v3 schema to validate the value
31-
// More info: https://book.kubebuilder.io/reference/markers/crd-validation.html
29+
// CellName is the name of the cell this MultiOrch belongs to.
30+
// +kubebuilder:validation:MinLength=1
31+
// +optional
32+
CellName string `json:"cellName,omitempty"`
33+
34+
// Image is the container image for MultiOrch.
35+
// +kubebuilder:validation:MinLength=1
36+
// +kubebuilder:default="multigres/multiorch:latest"
37+
// +optional
38+
Image string `json:"image,omitempty"`
39+
40+
// ImagePullSecrets is an optional list of references to secrets in the same namespace
41+
// to use for pulling the image.
42+
// +optional
43+
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
44+
45+
// Replicas is the desired number of MultiOrch pods.
46+
// +kubebuilder:validation:Minimum=1
47+
// +kubebuilder:default=1
48+
// +optional
49+
Replicas *int32 `json:"replicas,omitempty"`
50+
51+
// Resources defines the resource requirements for the MultiOrch container.
52+
// +optional
53+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
54+
55+
// ServiceAccountName is the name of the ServiceAccount to use for the MultiOrch pods.
56+
// +optional
57+
ServiceAccountName string `json:"serviceAccountName,omitempty"`
58+
59+
// ServiceType determines how the MultiOrch Service is exposed.
60+
// +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer
61+
// +kubebuilder:default="ClusterIP"
62+
// +optional
63+
ServiceType corev1.ServiceType `json:"serviceType,omitempty"`
64+
65+
// HTTPPort is the port for HTTP traffic.
66+
// +kubebuilder:validation:Minimum=1
67+
// +kubebuilder:validation:Maximum=65535
68+
// +kubebuilder:default=15300
69+
// +optional
70+
HTTPPort int32 `json:"httpPort,omitempty"`
71+
72+
// GRPCPort is the port for gRPC traffic.
73+
// +kubebuilder:validation:Minimum=1
74+
// +kubebuilder:validation:Maximum=65535
75+
// +kubebuilder:default=15370
76+
// +optional
77+
GRPCPort int32 `json:"grpcPort,omitempty"`
3278

33-
// foo is an example field of MultiOrch. Edit multiorch_types.go to remove/update
79+
// ServiceAnnotations are annotations to add to the MultiOrch Service.
3480
// +optional
35-
Foo *string `json:"foo,omitempty"`
81+
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
82+
83+
// Affinity defines pod affinity and anti-affinity rules.
84+
// +optional
85+
Affinity *corev1.Affinity `json:"affinity,omitempty"`
86+
87+
// Tolerations allows pods to schedule onto nodes with matching taints.
88+
// +optional
89+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
90+
91+
// NodeSelector is a selector which must be true for the pod to fit on a node.
92+
// +optional
93+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
94+
95+
// TopologySpreadConstraints controls how pods are spread across topology domains.
96+
// +optional
97+
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
98+
99+
// PodAnnotations are annotations to add to the MultiOrch pods.
100+
// +optional
101+
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
102+
103+
// PodLabels are additional labels to add to the MultiOrch pods.
104+
// +optional
105+
PodLabels map[string]string `json:"podLabels,omitempty"`
36106
}
37107

38108
// MultiOrchStatus defines the observed state of MultiOrch.
39109
type MultiOrchStatus struct {
40-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
41-
// Important: Run "make" to regenerate code after modifying this file
42-
43-
// For Kubernetes API conventions, see:
44-
// https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
45-
46-
// conditions represent the current state of the MultiOrch resource.
47-
// Each condition has a unique type and reflects the status of a specific aspect of the resource.
48-
//
49-
// Standard condition types include:
50-
// - "Available": the resource is fully functional
51-
// - "Progressing": the resource is being created or updated
52-
// - "Degraded": the resource failed to reach or maintain its desired state
53-
//
54-
// The status of each condition is one of True, False, or Unknown.
110+
// Ready indicates whether the MultiOrch is healthy and available.
111+
Ready bool `json:"ready"`
112+
113+
// Replicas is the desired number of replicas.
114+
Replicas int32 `json:"replicas"`
115+
116+
// ReadyReplicas is the number of ready replicas.
117+
ReadyReplicas int32 `json:"readyReplicas"`
118+
119+
// ObservedGeneration reflects the generation of the most recently observed MultiOrch spec.
120+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
121+
122+
// Conditions represent the latest available observations of the MultiOrch's state.
55123
// +listType=map
56124
// +listMapKey=type
57125
// +optional
@@ -60,6 +128,10 @@ type MultiOrchStatus struct {
60128

61129
// +kubebuilder:object:root=true
62130
// +kubebuilder:subresource:status
131+
// +kubebuilder:printcolumn:name="Cell",type=string,JSONPath=`.spec.cellName`
132+
// +kubebuilder:printcolumn:name="Ready",type=boolean,JSONPath=`.status.ready`
133+
// +kubebuilder:printcolumn:name="Replicas",type=string,JSONPath=`.status.readyReplicas`
134+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
63135

64136
// MultiOrch is the Schema for the multiorches API
65137
type MultiOrch struct {

0 commit comments

Comments
 (0)