File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,6 +112,22 @@ func (r *ReconcilerBase) SetStatusWarnings(statusWarnings []StatusWarning) {
112112 r .statusWarnings = statusWarnings
113113}
114114
115+ // Adds a new status warning into the ReconcilerBase or updates one that already exists
116+ func (r * ReconcilerBase ) AddStatusWarning (newWarning StatusWarning ) {
117+ index := - 1
118+ for i , statusWarning := range r .statusWarnings {
119+ if statusWarning .Message == newWarning .Message {
120+ index = i
121+ break
122+ }
123+ }
124+ if index == - 1 {
125+ r .statusWarnings = append (r .statusWarnings , newWarning )
126+ } else if index < len (r .statusWarnings ) {
127+ r .statusWarnings [index ] = newWarning
128+ }
129+ }
130+
115131// Deletes a status warning from the ReconcilerBase if a status message matches
116132func (r * ReconcilerBase ) DeleteStatusWarning (message string ) {
117133 for {
You can’t perform that action at this time.
0 commit comments