Skip to content

Commit

Permalink
fixed to prevent kubelet from crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklypriyansh-2 committed Oct 5, 2023
1 parent 5c4f9a8 commit c45e8ef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,19 +362,19 @@ func (p *SaladCloudProvider) createContainerGroup(createContainerList []saladcli
for _, container := range createContainerList {
createContainerGroupRequest := *saladclient.NewCreateContainerGroup(utils.GetPodName(pod.Namespace, pod.Name, pod), container, "always", 1)
readinessProbe, err := p.getWorkloadContainerProbeFrom(pod.Spec.Containers[0].ReadinessProbe)
if err == nil {
if err == nil && readinessProbe != nil {
createContainerGroupRequest.ReadinessProbe = *readinessProbe
} else {
log.G(context.Background()).Errorf("Failed to get readinessProbe ", err)
}
livenessProbe, err := p.getWorkloadContainerProbeFrom(pod.Spec.Containers[0].LivenessProbe)
if err == nil {
if err == nil && livenessProbe != nil {
createContainerGroupRequest.LivenessProbe = *livenessProbe
} else {
log.G(context.Background()).Errorf("Failed to get livenessProbe ", err)
}
startupProbe, err := p.getWorkloadContainerProbeFrom(pod.Spec.Containers[0].StartupProbe)
if err == nil {
if err == nil && startupProbe != nil {
createContainerGroupRequest.StartupProbe = *startupProbe
} else {
log.G(context.Background()).Errorf("Failed to get startupProbe ", err)
Expand All @@ -388,7 +388,7 @@ func (p *SaladCloudProvider) createContainerGroup(createContainerList []saladcli
networking, err := p.getNetworking(pod)
if err != nil {
log.G(context.Background()).Errorf("Failed to get networking ", err)
} else {
} else if networking != nil {
createContainerGroupRequest.SetNetworking(*networking)
}
restartPolicy, err := p.getRestartPolicy(pod)
Expand Down

0 comments on commit c45e8ef

Please sign in to comment.