I am creating a k8s custom controller. Basically when a custom resource is created, some additional resources will be created. These include a configmap, deployment, and service. The project was created with kubebuilder. If the controller.go includes logic to watch for configmap, the pod will be terminated as OOMKilled, error code 137. Watching other type of objects such as deployment, service and statefulset works fine. The section of code is
err = c.Watch(&source.Kind{Type: &corev1.ConfigMap{}}, &handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: <mv1beta1.Ltm{},
})
if err != nil {
log.Println(err)
return err
}
ltmv1beta1 is the CR. This is almost identical as the example code created by kubebuilder. Also have the correct access rights granted for the role
services [] [] [get list watch create update patch delete]
configmaps [] [] [get list watch create update patch delete]
secrets [] [] [get list watch create update patch delete]
mutatingwebhookconfigurations.admissionregistration.k8s.io [] [] [get list watch create update patch delete]
validatingwebhookconfigurations.admissionregistration.k8s.io [] [] [get list watch create update patch delete]
statefulsets.apps [] [] [get list watch create update patch delete]
ltms.ltm.k8s.io [] [] [get list watch create update patch delete]
deployments.apps/status [] [] [get update patch]
ltms.ltm.k8s.io/status [] [] [get update patch]
Could not figure out why this only happens to configmap. Thanks.