nfs: fix null pointer deref in generateSssdSidecarResources()

0a151e913 results in a bug which causes null pointer dereference when
Kerberos is not setup. This causes a failure in Unit test
TestReconcileCephNFS_addSecurityConfigsToPod

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
(cherry picked from commit 6cf4627ccd)
This commit is contained in:
Sachin Prabhu authored and Mergify committed 2023-07-28 13:57:55 +00:00
1 parent fe35e61aed
commit 22b4e5d7ea
1 file changed
+9 -8
+9 -8
View File
@@ -164,15 +164,16 @@ func generateSssdSidecarResources(nfs *cephv1.CephNFS, sidecarCfg *cephv1.SSSDSi
SubPath: "krb5.conf",
}
sssdMounts = append(sssdMounts, krb5ConfD, krbConfMount)
}
if nfs.Spec.Security.Kerberos.KeytabFile.VolumeSource != nil {
volName := "krb5-keytab"
keytabMount := v1.VolumeMount{
Name: volName,
MountPath: "/etc/krb5.keytab",
SubPath: "krb5.keytab",
if nfs.Spec.Security.Kerberos.KeytabFile.VolumeSource != nil {
volName := "krb5-keytab"
keytabMount := v1.VolumeMount{
Name: volName,
MountPath: "/etc/krb5.keytab",
SubPath: "krb5.keytab",
}
sssdMounts = append(sssdMounts, keytabMount)
}
sssdMounts = append(sssdMounts, keytabMount)
}
// the init container is needed to copy the starting content from the /var/lib/sss/pipes