File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ 1.2.1] - 2023-04-27
8+ ### Fixed
9+ - Container resource specs showing wrong values [ #26 ] ( https://github.com/airwallex/k8s-pod-restart-info-collector/issues/26 )
10+
11+ ### Improved
12+ - Add backticks to format slack message nicely [ #25 ] ( https://github.com/airwallex/k8s-pod-restart-info-collector/issues/25 )
713
814## [ 1.2.0] - 2023-01-03
915### Added
Original file line number Diff line number Diff line change 11#! /bin/bash
2- TAG=" v1.2.0 "
2+ TAG=" v1.2.1 "
33docker buildx build --platform linux/amd64 -t devopsairwallex/k8s-pod-restart-info-collector:${TAG} .
44docker push devopsairwallex/k8s-pod-restart-info-collector:${TAG}
55
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ func (c *Controller) handlePod(pod *v1.Pod) error {
213213 }
214214
215215 // check and collect restarted container info
216- for i , status := range pod .Status .ContainerStatuses {
216+ for _ , status := range pod .Status .ContainerStatuses {
217217 if status .RestartCount == 0 {
218218 continue
219219 }
@@ -232,7 +232,13 @@ func (c *Controller) handlePod(pod *v1.Pod) error {
232232
233233 restartReason := printContainerLastStateReason (status )
234234
235- containerSpec := pod .Spec .Containers [i ]
235+ var containerSpec v1.Container
236+ for _ , container := range pod .Spec .Containers {
237+ if status .Name == container .Name {
238+ containerSpec = container
239+ break
240+ }
241+ }
236242 containerResource , err := getContainerResource (containerSpec )
237243 if err != nil {
238244 return err
You can’t perform that action at this time.
0 commit comments