@@ -25,6 +25,7 @@ package v1
2525import (
2626 "github.com/arangodb/kube-arangodb/pkg/util"
2727 "github.com/dchest/uniuri"
28+ "k8s.io/apimachinery/pkg/api/equality"
2829 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930)
3031
@@ -66,6 +67,8 @@ const (
6667 ActionTypePVCResize ActionType = "PVCResize"
6768 // ActionTypePVCResized waits for PVC to resize for defined time
6869 ActionTypePVCResized ActionType = "PVCResized"
70+ // UpToDateUpdateResized define up to date annotation in spec
71+ UpToDateUpdate ActionType = "UpToDateUpdate"
6972)
7073
7174const (
@@ -92,6 +95,8 @@ type Action struct {
9295 Reason string `json:"reason,omitempty"`
9396 // Image used in can of a SetCurrentImage action.
9497 Image string `json:"image,omitempty"`
98+ // Params additional parameters used for action
99+ Params map [string ]interface {} `json:"params,omitempty"`
95100}
96101
97102// Equal compares two Actions
@@ -103,7 +108,30 @@ func (a Action) Equal(other Action) bool {
103108 util .TimeCompareEqual (a .CreationTime , other .CreationTime ) &&
104109 util .TimeCompareEqualPointer (a .StartTime , other .StartTime ) &&
105110 a .Reason == other .Reason &&
106- a .Image == other .Image
111+ a .Image == other .Image &&
112+ equality .Semantic .DeepEqual (a .Params , other .Params )
113+ }
114+
115+ // AddParam returns copy of action with set parameter
116+ func (a Action ) AddParam (key string , value interface {}) Action {
117+ if a .Params == nil {
118+ a .Params = map [string ]interface {}{}
119+ }
120+
121+ a .Params [key ] = value
122+
123+ return a
124+ }
125+
126+ // GetParam returns action parameter
127+ func (a Action ) GetParam (key string ) (interface {}, bool ) {
128+ if a .Params == nil {
129+ return nil , false
130+ }
131+
132+ i , ok := a .Params [key ]
133+
134+ return i , ok
107135}
108136
109137// NewAction instantiates a new Action.
0 commit comments