Skip to content

Commit c641412

Browse files
committed
Integrate ConditionsAPI to machine resource
1 parent 8e5ead5 commit c641412

File tree

22 files changed

+5380
-2412
lines changed

22 files changed

+5380
-2412
lines changed

api/compute/v1alpha1/machine_types.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,31 @@ const (
186186
VolumeStateAttached VolumeState = "Attached"
187187
)
188188

189+
// MachineConditionType is a type a MachineCondition can have.
190+
type MachineConditionType string
191+
192+
// MachineCondition is one of the conditions of a machine.
193+
type MachineCondition struct {
194+
// Type is the type of the condition.
195+
Type MachineConditionType `json:"type"`
196+
// Status is the status of the condition.
197+
Status corev1.ConditionStatus `json:"status"`
198+
// Reason is a machine-readable indication of why the condition is in a certain state.
199+
Reason string `json:"reason"`
200+
// Message is a human-readable explanation of why the condition has a certain reason / state.
201+
Message string `json:"message"`
202+
// LastTransitionTime is the last time the status of a condition has transitioned from one state to another.
203+
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
204+
}
205+
189206
// MachineStatus defines the observed state of Machine
190207
type MachineStatus struct {
191208
// MachineID is the provider specific machine ID in the format 'TYPE://MACHINE_ID'.
192209
MachineID string `json:"machineID,omitempty"`
193210
// ObservedGeneration is the last generation the MachinePool observed of the Machine.
194211
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
212+
// Conditions are the conditions of a machine.
213+
Conditions []MachineCondition `json:"conditions,omitempty"`
195214
// State is the infrastructure state of the machine.
196215
State MachineState `json:"state,omitempty"`
197216
// NetworkInterfaces is the list of network interface states for the machine.

api/compute/v1alpha1/machinepool_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ type MachinePoolAddress struct {
8585
// MachinePoolConditionType is a type a MachinePoolCondition can have.
8686
type MachinePoolConditionType string
8787

88-
// MachinePoolCondition is one of the conditions of a volume.
88+
// MachinePoolCondition is one of the conditions of a MachinePool.
8989
type MachinePoolCondition struct {
9090
// Type is the type of the condition.
9191
Type MachinePoolConditionType `json:"type"`

api/compute/v1alpha1/zz_generated.deepcopy.go

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

broker/machinebroker/server/machine.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,23 @@ func (s *Server) convertAggregateIronCoreMachine(aggIronCoreMachine *AggregateIr
251251
return nil, err
252252
}
253253

254+
// Convert machine conditions
255+
// machineConditions := make([]*iri.Conditions, 0, len(aggIronCoreMachine.Machine.Status.Conditions))
256+
// for _, c := range aggIronCoreMachine.Machine.Status.Conditions {
257+
// var lastTransition int64
258+
// if !c.LastTransitionTime.IsZero() {
259+
// lastTransition = c.LastTransitionTime.Time.UnixNano()
260+
// }
261+
262+
// machineConditions = append(machineConditions, &iri.Conditions{
263+
// Type: string(c.Type),
264+
// Status: string(c.Status),
265+
// Reason: c.Reason,
266+
// Message: c.Message,
267+
// LastTransitionTime: lastTransition,
268+
// })
269+
// }
270+
254271
return &iri.Machine{
255272
Metadata: metadata,
256273
Spec: &iri.MachineSpec{
@@ -266,6 +283,7 @@ func (s *Server) convertAggregateIronCoreMachine(aggIronCoreMachine *AggregateIr
266283
ImageRef: "", // TODO: Fill
267284
Volumes: volumeAttachmentStates,
268285
NetworkInterfaces: networkInterfaceAttachmentStates,
286+
// MachineConditions: machineConditions,
269287
},
270288
}, nil
271289
}

client-go/applyconfigurations/compute/v1alpha1/machinecondition.go

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfigurations/compute/v1alpha1/machinestatus.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfigurations/internal/internal.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfigurations/utils.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/openapi/api_violations.report

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compu
66
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineSpec,NetworkInterfaces
77
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineSpec,Tolerations
88
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineSpec,Volumes
9+
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineStatus,Conditions
910
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineStatus,NetworkInterfaces
1011
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/compute/v1alpha1,MachineStatus,Volumes
1112
API rule violation: list_type_missing,github.com/ironcore-dev/ironcore/api/core/v1alpha1,ResourceScopeSelector,MatchExpressions

client-go/openapi/zz_generated.openapi.go

Lines changed: 71 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)