API: Add currentImage field to Volume, Engine and Replica
Now engineImage field will be set to spec.EngineImage, currentImage field will
be set to status.CurrentImage.
@@ -25,6 +25,7 @@ type Volume struct {
StaleReplicaTimeout int `json:"staleReplicaTimeout"`
State string `json:"state"`
EngineImage string `json:"engineImage"`
+ CurrentImage string `json:"currentImage"`
Endpoint string `json:"endpoint,omitemtpy"`
Created string `json:"created,omitemtpy"`
@@ -69,6 +70,7 @@ type Instance struct {
Address string `json:"address"`
Running bool `json:"running"`
EngineImage string `json:"engineImage"`
+ CurrentImage string `json:"currentImage"`
}
type Controller struct {
@@ -352,7 +354,8 @@ func toVolumeResource(v *longhorn.Volume, ve *longhorn.Engine, vrs map[string]*l
Running: r.Status.CurrentState == types.InstanceStateRunning,
Address: r.Status.IP,
NodeID: r.Spec.NodeID,
- EngineImage: r.Status.CurrentImage,
+ EngineImage: r.Spec.EngineImage,
+ CurrentImage: r.Status.CurrentImage,
},
Mode: mode,
FailedAt: r.Spec.FailedAt,
@@ -366,7 +369,8 @@ func toVolumeResource(v *longhorn.Volume, ve *longhorn.Engine, vrs map[string]*l
Running: ve.Status.CurrentState == types.InstanceStateRunning,
NodeID: ve.Spec.NodeID,
Address: ve.Status.IP,
- EngineImage: ve.Status.CurrentImage,
+ EngineImage: ve.Spec.EngineImage,
+ CurrentImage: ve.Status.CurrentImage,
}}
}
@@ -408,7 +412,8 @@ func toVolumeResource(v *longhorn.Volume, ve *longhorn.Engine, vrs map[string]*l
StaleReplicaTimeout: v.Spec.StaleReplicaTimeout,
Endpoint: endpoint,
Created: v.ObjectMeta.CreationTimestamp.String(),
- EngineImage: v.Status.CurrentImage,
+ EngineImage: v.Spec.EngineImage,
+ CurrentImage: v.Status.CurrentImage,
Controller: controller,
Replicas: replicas,
