Skip to content

Commit

Permalink
improve conds
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Oct 30, 2024
1 parent 7efe3d9 commit 39145ac
Show file tree
Hide file tree
Showing 25 changed files with 407 additions and 134 deletions.
2 changes: 2 additions & 0 deletions api/core/v1alpha2/cvicondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type (
)

const (
DatasourceReadyReasonUnknown DatasourceReadyReason = "Unknown"
// DatasourceReady indicates that the datasource is ready for use, allowing the import process to start.
DatasourceReady DatasourceReadyReason = "DatasourceReady"
// ContainerRegistrySecretNotFound indicates that the container registry secret was not found, which prevents the import process from starting.
Expand All @@ -45,6 +46,7 @@ const (
// VirtualDiskNotReady indicates that the `VirtualDisk` datasource is not ready, which prevents the import process from starting.
VirtualDiskNotReady DatasourceReadyReason = "VirtualDiskNotReady"

ReadyReasonUnknown ReadyReason = "Unknown"
// WaitForUserUpload indicates that the `ClusterVirtualImage` is waiting for the user to upload a datasource for the import process to continue.
WaitForUserUpload ReadyReason = "WaitForUserUpload"
// Provisioning indicates that the provisioning process is currently in progress.
Expand Down
4 changes: 4 additions & 0 deletions api/core/v1alpha2/vdcondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type (
)

const (
DatasourceReadyReasonUnknown DatasourceReadyReason = "Unknown"
// DatasourceReady indicates that the datasource is ready for use, allowing the import process to start.
DatasourceReady DatasourceReadyReason = "DatasourceReady"
// ContainerRegistrySecretNotFound indicates that the container registry secret was not found, which prevents the import process from starting.
Expand All @@ -53,6 +54,7 @@ const (
// VirtualDiskSnapshotNotReady indicates that the `VirtualDiskSnapshot` datasource is not ready, which prevents the import process from starting.
VirtualDiskSnapshotNotReady DatasourceReadyReason = "VirtualDiskSnapshot"

ReadyReasonUnknown ReadyReason = "Unknown"
// WaitForUserUpload indicates that the `VirtualDisk` is waiting for the user to upload a datasource for the import process to continue.
WaitForUserUpload ReadyReason = "WaitForUserUpload"
// Provisioning indicates that the provisioning process is currently in progress.
Expand All @@ -68,6 +70,7 @@ const (
// Lost indicates that the underlying PersistentVolumeClaim has been lost and the `VirtualDisk` can no longer be used.
Lost ReadyReason = "PVCLost"

ResizedReasonUnknown ResizedReason = "Unknown"
// ResizingNotRequested indicates that the resize operation has not been requested yet.
ResizingNotRequested ResizedReason = "NotRequested"
// InProgress indicates that the resize request has been detected and the operation is currently in progress.
Expand All @@ -77,6 +80,7 @@ const (
// ResizingNotAvailable indicates that the resize operation is not available for now.
ResizingNotAvailable SnapshottingReason = "NotAvailable"

SnapshottingReasonUnknown SnapshottingReason = "Unknown"
// SnapshottingNotRequested indicates that the snapshotting operation has been successfully started and is in progress now.
SnapshottingNotRequested SnapshottingReason = "NotRequested"
// Snapshotting indicates that the snapshotting operation has been successfully started and is in progress now.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha2/vdscondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ type (
)

const (
VirtualDiskReadyReasonUnknown VirtualDiskReadyReason = "Unknown"
// VirtualDiskReady signifies that the source virtual disk is ready for snapshotting, allowing the snapshot process to begin.
VirtualDiskReady VirtualDiskReadyReason = "VirtualDiskReady"
// VirtualDiskNotReadyForSnapshotting signifies that the source virtual disk is not ready for snapshotting, preventing the snapshot process from starting.
VirtualDiskNotReadyForSnapshotting VirtualDiskReadyReason = "VirtualDiskNotReadyForSnapshotting"

VirtualDiskSnapshotReadyReasonUnknown VirtualDiskSnapshotReadyReason = "Unknown"
// WaitingForTheVirtualDisk signifies that the snapshot process is waiting for the virtual disk to become ready for snapshotting.
WaitingForTheVirtualDisk VirtualDiskSnapshotReadyReason = "WaitingForTheVirtualDisk"
// PotentiallyInconsistent signifies that the snapshotting process cannot begin because creating a snapshot of virtual disk attached to the running virtual machine might result in an inconsistent snapshot.
Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha2/vicondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type (
)

const (
DatasourceReadyReasonUnknown DatasourceReadyReason = "Unknown"
// DatasourceReady indicates that the datasource is ready for use, allowing the import process to start.
DatasourceReady DatasourceReadyReason = "DatasourceReady"
// ContainerRegistrySecretNotFound indicates that the container registry secret was not found, which prevents the import process from starting.
Expand All @@ -45,6 +46,7 @@ const (
// VirtualDiskNotReady indicates that the `VirtualDisk` datasource is not ready, which prevents the import process from starting.
VirtualDiskNotReady DatasourceReadyReason = "VirtualDiskNotReady"

ReadyReasonUnknown ReadyReason = "Unknown"
// WaitForUserUpload indicates that the `VirtualImage` is waiting for the user to upload a datasource for the import process to continue.
WaitForUserUpload ReadyReason = "WaitForUserUpload"
// Provisioning indicates that the provisioning process is currently in progress.
Expand Down
4 changes: 4 additions & 0 deletions api/core/v1alpha2/vmipcondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func (r AttachedReason) String() string {
}

const (
BoundReasonUnknown BoundReason = "Unknown"

// VirtualMachineIPAddressIsOutOfTheValidRange is a BoundReason indicating when specified IP address is out of the range in controller settings.
VirtualMachineIPAddressIsOutOfTheValidRange BoundReason = "VirtualMachineIPAddressIsOutOfTheValidRange"

Expand All @@ -65,6 +67,8 @@ const (
// Bound is a BoundReason indicating the IP address lease is successfully bound.
Bound BoundReason = "Bound"

AttachedReasonUnknown AttachedReason = "Unknown"

// VirtualMachineNotFound is an AttachedReason indicating the Virtual Machine was not found.
VirtualMachineNotFound AttachedReason = "VirtualMachineNotFound"

Expand Down
2 changes: 2 additions & 0 deletions api/core/v1alpha2/vmiplcondition/condition.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ func (r BoundReason) String() string {
}

const (
BoundReasonUnknown BoundReason = "Unknown"

// Released is a BoundReason indicating the IP address lease has been released.
Released BoundReason = "Released"

Expand Down
70 changes: 56 additions & 14 deletions crds/clustervirtualimages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,36 +193,78 @@ spec:
type: object
properties:
conditions:
description: |
The latest available observations of an object's current state.
type: array
description:
The latest detailed observations of the VirtualMachineOperation
resource.
items:
type: object
description:
"Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
properties:
lastProbeTime:
description: Last time the condition was checked.
format: date-time
type: string
lastTransitionTime:
description: Last time the condition transit from one status to another.
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: Human readable message indicating details about last transition.
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: (brief) reason for the condition's last transition.
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: Status of the condition, one of True, False, Unknown.
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
enum: ["True", "False", "Unknown"]
type:
description: Type of condition.
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
downloadSpeed:
type: object
description: |
Expand Down
70 changes: 56 additions & 14 deletions crds/virtualdisks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,36 +215,78 @@ spec:
type: object
properties:
conditions:
description: |
The latest available observations of an object's current state.
type: array
description:
The latest detailed observations of the VirtualMachineOperation
resource.
items:
type: object
description:
"Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
properties:
lastProbeTime:
description: Last time the condition was checked.
format: date-time
type: string
lastTransitionTime:
description: Last time the condition transit from one status to another.
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: Human readable message indicating details about last transition.
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: (brief) reason for the condition's last transition.
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: Status of the condition, one of True, False, Unknown.
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
enum: ["True", "False", "Unknown"]
type:
description: Type of condition.
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
downloadSpeed:
type: object
description: |
Expand Down
Loading

0 comments on commit 39145ac

Please sign in to comment.