kubeadm: fix nil pointer in Cfg() feature gate checking

This commit is contained in:
Paco Xu 2021-07-05 09:59:57 +08:00 committed by GitHub
parent 39e951a08d
commit 772344aef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,7 +92,7 @@ func runCleanupNode(c workflow.RunData) error {
}
resetConfigDir(kubeadmconstants.KubernetesDir, certsDir)
if features.Enabled(r.Cfg().FeatureGates, features.RootlessControlPlane) {
if r.Cfg() != nil && features.Enabled(r.Cfg().FeatureGates, features.RootlessControlPlane) {
klog.V(1).Infoln("[reset] Removing users and groups created for rootless control-plane")
if err := users.RemoveUsersAndGroups(); err != nil {
klog.Warningf("[reset] Failed to remove users and groups: %v\n", err)