@@ -36,94 +36,39 @@ type AppWrapperSpec struct {
3636
3737 // Wrapped resources
3838 Resources AppWrapperResources `json:"resources"`
39-
40- // Dispatcher status
41- DispatcherStatus AppWrapperDispatcherStatus `json:"dispatcherStatus,omitempty"`
42-
43- // Sustainable specification
44- Sustainable SustainableSpec `json:"sustainable,omitempty"`
45-
46- // Dispatching gates
47- DispatchingGates []DispatchingGate `json:"dispatchingGates,omitempty"`
4839}
4940
50- // Dispatching gate
51- type DispatchingGate string
52-
5341type SchedulingSpec struct {
54- // Minimum number of pods that need to run and succeed
55- // These pods have to be labeled with the AppWrapper name to be accounted for and monitored by mcad:
56- // workload.codeflare.dev: <appWrapper-name>
42+ // Minimum number of pods
5743 MinAvailable int32 `json:"minAvailable,omitempty"`
5844
5945 // Requeuing specification
6046 Requeuing RequeuingSpec `json:"requeuing,omitempty"`
61-
62- // Cluster specification
63- ClusterScheduling * ClusterSchedulingSpec `json:"clusterScheduling,omitempty"`
6447}
6548
6649type RequeuingSpec struct {
6750 // Max requeuings permitted
6851 MaxNumRequeuings int32 `json:"maxNumRequeuings,omitempty"`
6952}
7053
71- // Where to run
72- type ClusterSchedulingSpec struct {
73- PolicyResult ClusterDecision `json:"policyResult,omitempty"`
74- }
75-
76- type ClusterDecision struct {
77- TargetCluster ClusterReference `json:"targetCluster,omitempty"`
78- }
79-
80- type ClusterReference struct {
81- Name string `json:"name"`
82- }
83-
84- type SustainableSpec struct {
85- // TODO
86- }
87-
88- // Status from the dispatcher perspective
89- type AppWrapperDispatcherStatus struct {
54+ // AppWrapperStatus defines the observed state of AppWrapper
55+ type AppWrapperStatus struct {
9056 // Phase
9157 Phase AppWrapperPhase `json:"phase,omitempty"`
9258
9359 // When last dispatched
9460 LastDispatchingTime metav1.Time `json:"lastDispatchingTime,omitempty"`
9561
96- // How many times requeued
97- Requeued int32 `json:"requeued,omitempty"`
98-
99- // Transition log
100- Transitions []AppWrapperTransition `json:"transitions,omitempty"`
101-
102- // Total time dispatched in seconds (excluding current leg)
103- TimeDispatched int64 `json:"timeDispatched,omitempty"`
104- }
105-
106- // Status from the runner perspective
107- type AppWrapperRunnerStatus struct {
108- // Phase
109- Phase AppWrapperPhase `json:"phase,omitempty"`
110-
111- // When last running
112- LastRunningTime metav1.Time `json:"lastRunningTime,omitempty"`
113-
11462 // When last requeued
11563 LastRequeuingTime metav1.Time `json:"lastRequeuingTime,omitempty"`
11664
65+ // How many times restarted
66+ Restarts int32 `json:"restarts"`
67+
11768 // Transition log
11869 Transitions []AppWrapperTransition `json:"transitions,omitempty"`
11970}
12071
121- // Status
122- type AppWrapperStatus struct {
123- // Runner status
124- RunnerStatus AppWrapperRunnerStatus `json:"runnerStatus,omitempty"`
125- }
126-
12772// AppWrapperPhase is the label for the AppWrapper status
12873type AppWrapperPhase string
12974
@@ -132,36 +77,35 @@ const (
13277 Empty AppWrapperPhase = ""
13378
13479 // no resource reservation
135- Queued AppWrapperPhase = "Queued" // dispatcher-only phase
80+ Queued AppWrapperPhase = "Queued"
13681
13782 // resources are reserved
13883 Dispatching AppWrapperPhase = "Dispatching"
13984
14085 // resources are reserved
14186 Running AppWrapperPhase = "Running"
14287
143- // no resource reservation even if pods may still exist in completed state
88+ // no resource reservation
14489 Succeeded AppWrapperPhase = "Succeeded"
14590
146- // resources are reserved as failures may be partial
147- // AppWrapper may not be requeued
91+ // resources are reserved (some pods may still be running)
14892 Failed AppWrapperPhase = "Failed"
14993
150- // resources are reserved
94+ // resources are reserved (some pods may still be running)
15195 Requeuing AppWrapperPhase = "Requeuing"
15296)
15397
154- // AppWrapperResource
98+ // AppWrapper resources
15599type AppWrapperResources struct {
156- // GenericItems
100+ // Array of GenericItems
157101 GenericItems []GenericItem `json:"GenericItems"`
158102}
159103
160- // GenericItems is the schema for the wrapped resources
104+ // AppWrapper resource
161105type GenericItem struct {
162106 DoNotUseReplicas int32 `json:"replicas,omitempty"`
163107
164- // Replica count and resource requests
108+ // Array of resource requests
165109 CustomPodResources []CustomPodResource `json:"custompodresources,omitempty"`
166110
167111 // A comma-separated list of keywords to match against condition types
@@ -171,7 +115,7 @@ type GenericItem struct {
171115 GenericTemplate runtime.RawExtension `json:"generictemplate"`
172116}
173117
174- // Replica count and resource requests
118+ // Resource requests
175119type CustomPodResource struct {
176120 // Replica count
177121 Replicas int32 `json:"replicas"`
@@ -191,23 +135,22 @@ type AppWrapperTransition struct {
191135 // Reason
192136 Reason string `json:"reason,omitempty"`
193137
194- // Phase
138+ // Phase entered
195139 Phase AppWrapperPhase `json:"phase"`
196140}
197141
198142//+kubebuilder:object:root=true
199143//+kubebuilder:subresource:status
200- //+kubebuilder:printcolumn:name="DISPATCHER",type="string",JSONPath=`.spec.dispatcherStatus.phase`
201- //+kubebuilder:printcolumn:name="RUNNER",type="string",JSONPath=`.status.runnerStatus.phase`
144+ //+kubebuilder:printcolumn:name="Status",type="string",JSONPath=`.status.phase`
145+ //+kubebuilder:printcolumn:name="Restarts",type="integer",JSONPath=`.status.restarts`
146+ //+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
202147
203- // AppWrapper object
148+ // AppWrapper is the Schema for the appwrappers API
204149type AppWrapper struct {
205150 metav1.TypeMeta `json:",inline"`
206151 metav1.ObjectMeta `json:"metadata,omitempty"`
207152
208- Spec AppWrapperSpec `json:"spec"`
209-
210- // AppWrapper status
153+ Spec AppWrapperSpec `json:"spec,omitempty"`
211154 Status AppWrapperStatus `json:"status,omitempty"`
212155}
213156
0 commit comments