@@ -18,6 +18,7 @@ const (
18
18
MissingImageStreamErr = "MissingImageStream"
19
19
MissingImageStreamTagWarning = "MissingImageStreamTag"
20
20
MissingReadinessProbeWarning = "MissingReadinessProbe"
21
+ MissingLivenessProbeWarning = "MissingLivenessProbe"
21
22
)
22
23
23
24
// FindDeploymentConfigTriggerErrors checks for possible failures in deployment config
@@ -124,3 +125,33 @@ Node:
124
125
125
126
return markers
126
127
}
128
+
129
+ // FindDeploymentConfigLivenessWarnings inspects deploymentconfigs and reports those that
130
+ // don't have liveness probes set up.
131
+ func FindDeploymentConfigLivenessWarnings (g osgraph.Graph , f osgraph.Namer , setProbeCommand string ) []osgraph.Marker {
132
+ markers := []osgraph.Marker {}
133
+
134
+ Node:
135
+ for _ , uncastDcNode := range g .NodesByKind (deploygraph .DeploymentConfigNodeKind ) {
136
+ dcNode := uncastDcNode .(* deploygraph.DeploymentConfigNode )
137
+ if t := dcNode .DeploymentConfig .Spec .Template ; t != nil && len (t .Spec .Containers ) > 0 {
138
+ for _ , container := range t .Spec .Containers {
139
+ if container .LivenessProbe != nil {
140
+ continue Node
141
+ }
142
+ }
143
+ // All of the containers in the deployment config lack a readiness probe
144
+ markers = append (markers , osgraph.Marker {
145
+ Node : uncastDcNode ,
146
+ Severity : osgraph .WarningSeverity ,
147
+ Key : MissingLivenessProbeWarning ,
148
+ Message : fmt .Sprintf ("%s has no liveness probe to verify pods are still running." ,
149
+ f .ResourceName (dcNode )),
150
+ Suggestion : osgraph .Suggestion (fmt .Sprintf ("%s %s --liveness ..." , setProbeCommand , f .ResourceName (dcNode ))),
151
+ })
152
+ continue Node
153
+ }
154
+ }
155
+
156
+ return markers
157
+ }
0 commit comments