Skip to content

Commit

Permalink
Fix KubeletConfig nil error
Browse files Browse the repository at this point in the history
Add nil check for KubeletConfig to fix the nil pointer panic.

Signed-off-by: Qi Wang <qiwan@redhat.com>
  • Loading branch information
QiWang19 authored and openshift-cherrypick-robot committed Apr 19, 2022
1 parent 747de90 commit 9f1cf28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/kubelet-config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func getManagedKubeletConfigKey(pool *mcfgv1.MachineConfigPool) string {

// validates a KubeletConfig and returns an error if invalid
func validateUserKubeletConfig(cfg *mcfgv1.KubeletConfig) error {
if cfg.Spec.KubeletConfig.Raw == nil {
if cfg.Spec.KubeletConfig == nil || cfg.Spec.KubeletConfig.Raw == nil {
return nil
}
kcDecoded, err := decodeKubeletConfig(cfg.Spec.KubeletConfig.Raw)
Expand Down

0 comments on commit 9f1cf28

Please sign in to comment.