Skip to content

Commit dc35b5a

Browse files
committed
OCPBUGS-36483: Fix new added node issue
/etc/kubernetes/static-pod-resource is being created after a new node is being added, this cause the link count change in the aide checks and resulting a failures. The PR added a init pod to check for that before running aide daemonset.
1 parent 79a2163 commit dc35b5a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pkg/controller/fileintegrity/fileintegrity_controller.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,31 @@ func aideDaemonset(dsName string, fi *v1alpha1.FileIntegrity, operatorImage stri
856856
NodeSelector: fi.Spec.NodeSelector,
857857
Tolerations: fi.Spec.Tolerations,
858858
ServiceAccountName: common.DaemonServiceAccountName,
859+
InitContainers: []corev1.Container{
860+
{
861+
Name: "check-folder",
862+
Image: common.GetComponentImage(operatorImage, common.OPERATOR),
863+
Command: []string{
864+
"sh",
865+
"-c",
866+
`if [ ! -d "/host/etc/kubernetes/static-pod-resource" ]; then
867+
echo "Directory /etc/kubernetes/static-pod-resource does not exist, exiting.";
868+
exit 1;
869+
fi`,
870+
},
871+
SecurityContext: &corev1.SecurityContext{
872+
Privileged: &priv,
873+
RunAsUser: &runAs,
874+
},
875+
VolumeMounts: []corev1.VolumeMount{
876+
{
877+
Name: "hostroot",
878+
MountPath: "/host",
879+
MountPropagation: &hostToContainer,
880+
},
881+
},
882+
},
883+
},
859884
Containers: []corev1.Container{
860885
{
861886
SecurityContext: &corev1.SecurityContext{

0 commit comments

Comments
 (0)