forked from openkruise/kruise
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add condition and event info for not upgradable pods when update side…
…carset (openkruise#1272) (openkruise#1309) * add condition for pods and event for sidecarset when detecting not upgradable pod (openkruise#1272) * add e2e test for sidecarset upgrade out of image fields(openkruise#1272) * only update condition to true when all sidecarset upgradable (openkruise#1272) ---------
- Loading branch information
Showing
6 changed files
with
332 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package util | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
v1 "k8s.io/api/core/v1" | ||
) | ||
|
||
// using pod condition message to get key-value pairs | ||
func GetMessageKvFromCondition(condition *v1.PodCondition) (map[string]interface{}, error) { | ||
messageKv := make(map[string]interface{}) | ||
if condition != nil && condition.Message != "" { | ||
if err := json.Unmarshal([]byte(condition.Message), &messageKv); err != nil { | ||
return nil, err | ||
} | ||
} | ||
return messageKv, nil | ||
} | ||
|
||
// using pod condition message to save key-value pairs | ||
func UpdateMessageKvCondition(kv map[string]interface{}, condition *v1.PodCondition) { | ||
message, _ := json.Marshal(kv) | ||
condition.Message = string(message) | ||
} |
Oops, something went wrong.