Skip to content

Commit c8d5c1c

Browse files
authored
Merge pull request #150 from datum-cloud/split/api-rename
2 parents b4b61ee + 1555303 commit c8d5c1c

8 files changed

Lines changed: 333 additions & 50 deletions

api/v1alpha/instance_types.go

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,10 @@ const (
404404
// InstanceReady indicates that the instance is ready
405405
InstanceReady = "Ready"
406406

407-
// InstanceRunning indicates that the instance is running
408-
InstanceRunning = "Running"
407+
// InstanceAvailable indicates that the instance is available. It is True
408+
// when the instance is serving and does not assert that a process is
409+
// actively running at this instant.
410+
InstanceAvailable = "Available"
409411

410412
// InstanceProgrammed indicates that the instance has been programmed
411413
InstanceProgrammed = "Programmed"
@@ -458,20 +460,42 @@ const (
458460
// InstanceReadyReasonSchedulingGatesPresent indicates that the instance is not ready because scheduling gates are present.
459461
InstanceReadyReasonSchedulingGatesPresent = "SchedulingGatesPresent"
460462

461-
// InstanceReadyReasonRunning indicates that the instance is running
462-
InstanceReadyReasonRunning = "Running"
463+
// InstanceReadyReasonAvailable indicates that the instance is available
464+
InstanceReadyReasonAvailable = "Available"
463465

464-
// InstanceRunningReasonStopped indicates that the instance is stopped
465-
InstanceRunningReasonStopped = "Stopped"
466+
// InstanceReadyReasonImageUnavailable indicates the provider could not pull
467+
// the instance image (bad name, missing credentials, registry unreachable).
468+
// This matches the reason written by translateWaitingReason in the unikraft
469+
// provider when the container enters an image-pull waiting state.
470+
InstanceReadyReasonImageUnavailable = "ImageUnavailable"
466471

467-
// InstanceRunningReasonStarting indicates that the instance is starting
468-
InstanceRunningReasonStarting = "Starting"
472+
// InstanceReadyReasonInstanceCrashing indicates the instance process started
473+
// but is repeatedly exiting and being restarted (CrashLoopBackOff in the
474+
// underlying runtime). This is user-actionable: the application itself is
475+
// failing, not the platform.
476+
InstanceReadyReasonInstanceCrashing = "InstanceCrashing"
469477

470-
// InstanceRunningReasonStopping indicates that the instance is stopping
471-
InstanceRunningReasonStopping = "Stopping"
478+
// InstanceReadyReasonConfigurationError indicates the runtime rejected the
479+
// instance configuration before the process could start (e.g. invalid env
480+
// variable injection, missing device). User must correct the workload spec.
481+
InstanceReadyReasonConfigurationError = "ConfigurationError"
472482

473-
// InstanceRunningReasonRunning indicates that the instance is running
474-
InstanceRunningReasonRunning = "Running"
483+
// InstanceReadyReasonProvisioning indicates the instance runtime is still
484+
// setting up the execution environment (container being created, image being
485+
// unpacked). This is a transient, non-actionable state.
486+
InstanceReadyReasonProvisioning = "Provisioning"
487+
488+
// InstanceAvailableReasonStopped indicates that the instance is stopped
489+
InstanceAvailableReasonStopped = "Stopped"
490+
491+
// InstanceAvailableReasonStarting indicates that the instance is starting
492+
InstanceAvailableReasonStarting = "Starting"
493+
494+
// InstanceAvailableReasonStopping indicates that the instance is stopping
495+
InstanceAvailableReasonStopping = "Stopping"
496+
497+
// InstanceAvailableReasonAvailable indicates that the instance is available
498+
InstanceAvailableReasonAvailable = "Available"
475499

476500
// InstanceProgrammedReasonPendingProgramming indicates that the instance has not been programmed
477501
InstanceProgrammedReasonPendingProgramming = "PendingProgramming"
@@ -515,7 +539,7 @@ type Instance struct {
515539

516540
// Status defines the current state of an Instance.
517541
//
518-
// +kubebuilder:default={conditions:{{type:"Programmed",status:"Unknown",reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type:"Running",status:"Unknown",reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type:"Ready",status:"Unknown",reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type:"QuotaGranted",status:"Unknown",reason:"PendingEvaluation",message:"Waiting for quota evaluation",lastTransitionTime:"1970-01-01T00:00:00Z"}}}
542+
// +kubebuilder:default={conditions:{{type:"Programmed",status:"Unknown",reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type:"Available",status:"Unknown",reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type:"Ready",status:"Unknown",reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"},{type:"QuotaGranted",status:"Unknown",reason:"PendingEvaluation",message:"Waiting for quota evaluation",lastTransitionTime:"1970-01-01T00:00:00Z"}}}
519543
Status InstanceStatus `json:"status,omitempty"`
520544
}
521545

api/v1alpha/workload_types.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,27 @@ type WorkloadStatus struct {
5858
// The number of instances that currently exist
5959
Replicas int32 `json:"replicas"`
6060

61-
// The number of instances which have the latest workload settings applied.
61+
// The number of instances which have the latest workload settings applied
62+
// and are programmed (a subset of UpdatedReplicas that are ready to serve).
6263
CurrentReplicas int32 `json:"currentReplicas"`
6364

65+
// The number of instances updated to the latest template revision (their
66+
// observed template hash matches the desired template), regardless of
67+
// readiness. Lags Replicas during a rolling update or restart, then catches
68+
// back up — making an in-progress roll observable.
69+
UpdatedReplicas int32 `json:"updatedReplicas"`
70+
6471
// The desired number of instances
6572
DesiredReplicas int32 `json:"desiredReplicas"`
6673

6774
// The number of instances which are ready.
6875
ReadyReplicas int32 `json:"readyReplicas"`
6976

77+
// The most recent generation observed by the workload controller.
78+
//
79+
// +kubebuilder:validation:Optional
80+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
81+
7082
// The current status of placemetns in a workload.
7183
Placements []WorkloadPlacementStatus `json:"placements,omitempty"`
7284

@@ -99,7 +111,7 @@ type WorkloadGatewayStatus struct {
99111
// +kubebuilder:printcolumn:name="Replicas",type=string,JSONPath=`.status.replicas`
100112
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.readyReplicas`
101113
// +kubebuilder:printcolumn:name="Desired",type=string,JSONPath=`.status.desiredReplicas`
102-
// +kubebuilder:printcolumn:name="Up-to-date",type=string,JSONPath=`.status.currentReplicas`
114+
// +kubebuilder:printcolumn:name="Up-to-date",type=string,JSONPath=`.status.updatedReplicas`
103115
type Workload struct {
104116
metav1.TypeMeta `json:",inline"`
105117
metav1.ObjectMeta `json:"metadata,omitempty"`
@@ -146,9 +158,14 @@ type WorkloadPlacementStatus struct {
146158
// The number of instances that currently exist
147159
Replicas int32 `json:"replicas"`
148160

149-
// The number of instances which have the latest workload settings applied.
161+
// The number of instances which have the latest workload settings applied
162+
// and are programmed (a subset of UpdatedReplicas that are ready to serve).
150163
CurrentReplicas int32 `json:"currentReplicas"`
151164

165+
// The number of instances updated to the latest template revision, regardless
166+
// of readiness. Lags Replicas during a rolling update or restart.
167+
UpdatedReplicas int32 `json:"updatedReplicas"`
168+
152169
// The desired number of instances
153170
DesiredReplicas int32 `json:"desiredReplicas"`
154171

api/v1alpha/workloaddeployment_types.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,28 @@ type WorkloadDeploymentStatus struct {
4949
// The number of instances created
5050
Replicas int32 `json:"replicas"`
5151

52-
// The number of instances which have the latest workload settings applied.
52+
// The number of instances which have the latest workload settings applied
53+
// and are programmed (a subset of UpdatedReplicas that are ready to serve).
5354
CurrentReplicas int32 `json:"currentReplicas"`
5455

56+
// The number of instances updated to the latest template revision, i.e.
57+
// whose observed template hash matches the desired template, regardless of
58+
// readiness. Lags Replicas during a rolling update or restart, then catches
59+
// back up — making an in-progress roll observable.
60+
UpdatedReplicas int32 `json:"updatedReplicas"`
61+
5562
// The desired number of instances
5663
DesiredReplicas int32 `json:"desiredReplicas"`
5764

5865
// The number of instances which are ready.
5966
ReadyReplicas int32 `json:"readyReplicas"`
67+
68+
// The most recent generation observed by the deployment controller. When
69+
// this matches metadata.generation, the controller has reconciled the
70+
// latest spec (e.g. a restart request).
71+
//
72+
// +kubebuilder:validation:Optional
73+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
6074
}
6175

6276
const (
@@ -79,7 +93,7 @@ const (
7993
// +kubebuilder:printcolumn:name="Replicas",type=string,JSONPath=`.status.replicas`
8094
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.readyReplicas`
8195
// +kubebuilder:printcolumn:name="Desired",type=string,JSONPath=`.status.desiredReplicas`
82-
// +kubebuilder:printcolumn:name="Up-to-date",type=string,JSONPath=`.status.currentReplicas`
96+
// +kubebuilder:printcolumn:name="Up-to-date",type=string,JSONPath=`.status.updatedReplicas`
8397
// +kubebuilder:printcolumn:name="Location Namespace",type=string,JSONPath=`.status.location.namespace`,priority=1
8498
// +kubebuilder:printcolumn:name="Location Name",type=string,JSONPath=`.status.location.name`,priority=1
8599
type WorkloadDeployment struct {

config/base/crd/bases/compute.datumapis.com_instances.yaml

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ spec:
3535
name: Message
3636
priority: 1
3737
type: string
38+
- jsonPath: .status.conditions[?(@.type=="QuotaGranted")].reason
39+
name: Quota
40+
priority: 1
41+
type: string
3842
name: v1alpha
3943
schema:
4044
openAPIV3Schema:
@@ -262,6 +266,28 @@ spec:
262266
description: A list of containers to run within the sandbox.
263267
items:
264268
properties:
269+
args:
270+
description: |-
271+
Arguments to the entrypoint, overriding the image's CMD. Combined with
272+
Command: when Command is also set the resulting invocation is
273+
append(Command, Args...). When only Args is set it overrides CMD while
274+
preserving the image's ENTRYPOINT.
275+
276+
If neither Command nor Args is set, the image's own ENTRYPOINT and CMD
277+
are used unchanged.
278+
items:
279+
type: string
280+
type: array
281+
command:
282+
description: |-
283+
Entrypoint array to run in the container image, overriding the image's
284+
ENTRYPOINT. Each element is a separate token, not a shell command — to run a
285+
shell command use: ["sh", "-c", "my command"].
286+
287+
If not provided, the container image's own ENTRYPOINT is used.
288+
items:
289+
type: string
290+
type: array
265291
env:
266292
description: |-
267293
List of environment variables to set in the container.
@@ -272,8 +298,9 @@ spec:
272298
present in a Container.
273299
properties:
274300
name:
275-
description: Name of the environment variable.
276-
Must be a C_IDENTIFIER.
301+
description: |-
302+
Name of the environment variable.
303+
May consist of any printable ASCII characters except '='.
277304
type: string
278305
value:
279306
description: |-
@@ -332,6 +359,43 @@ spec:
332359
- fieldPath
333360
type: object
334361
x-kubernetes-map-type: atomic
362+
fileKeyRef:
363+
description: |-
364+
FileKeyRef selects a key of the env file.
365+
Requires the EnvFiles feature gate to be enabled.
366+
properties:
367+
key:
368+
description: |-
369+
The key within the env file. An invalid key will prevent the pod from starting.
370+
The keys defined within a source may consist of any printable ASCII characters except '='.
371+
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
372+
type: string
373+
optional:
374+
default: false
375+
description: |-
376+
Specify whether the file or its key must be defined. If the file or key
377+
does not exist, then the env var is not published.
378+
If optional is set to true and the specified key does not exist,
379+
the environment variable will not be set in the Pod's containers.
380+
381+
If optional is set to false and the specified key does not exist,
382+
an error will be returned during Pod creation.
383+
type: boolean
384+
path:
385+
description: |-
386+
The path within the volume from which to select the file.
387+
Must be relative and may not contain the '..' path or start with '..'.
388+
type: string
389+
volumeName:
390+
description: The name of the volume mount
391+
containing the env file.
392+
type: string
393+
required:
394+
- key
395+
- path
396+
- volumeName
397+
type: object
398+
x-kubernetes-map-type: atomic
335399
resourceFieldRef:
336400
description: |-
337401
Selects a resource of the container: only resources limits and requests
@@ -823,12 +887,17 @@ spec:
823887
message: Waiting for controller
824888
reason: Pending
825889
status: Unknown
826-
type: Running
890+
type: Available
827891
- lastTransitionTime: "1970-01-01T00:00:00Z"
828892
message: Waiting for controller
829893
reason: Pending
830894
status: Unknown
831895
type: Ready
896+
- lastTransitionTime: "1970-01-01T00:00:00Z"
897+
message: Waiting for quota evaluation
898+
reason: PendingEvaluation
899+
status: Unknown
900+
type: QuotaGranted
832901
description: Status defines the current state of an Instance.
833902
properties:
834903
conditions:

0 commit comments

Comments
 (0)