Change log level in executor for better log reading/troubleshooting (#1163)
This commit is contained in:
+4
-4
@@ -122,14 +122,14 @@ func AddSaToRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Cli
|
|||||||
for i := 0; i < MaxRetries; i++ {
|
for i := 0; i < MaxRetries; i++ {
|
||||||
_, err = k8sClient.RbacV1beta1().RoleBindings(roleBindingNs).Patch(roleBinding, types.JSONPatchType, patchJson)
|
_, err = k8sClient.RbacV1beta1().RoleBindings(roleBindingNs).Patch(roleBinding, types.JSONPatchType, patchJson)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
logger.Info("patched rolebinding",
|
logger.Debug("patched rolebinding",
|
||||||
zap.String("role_binding", roleBinding),
|
zap.String("role_binding", roleBinding),
|
||||||
zap.String("role_binding_namespace", roleBindingNs))
|
zap.String("role_binding_namespace", roleBindingNs))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if k8serrors.IsNotFound(err) {
|
if k8serrors.IsNotFound(err) {
|
||||||
logger.Info("rolebinding not found - will try to create it",
|
logger.Error("rolebinding not found - will try to create it",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("role_binding", roleBinding),
|
zap.String("role_binding", roleBinding),
|
||||||
zap.String("role_binding_namespace", roleBindingNs))
|
zap.String("role_binding_namespace", roleBindingNs))
|
||||||
@@ -145,7 +145,7 @@ func AddSaToRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Cli
|
|||||||
}
|
}
|
||||||
|
|
||||||
if k8serrors.IsAlreadyExists(err) {
|
if k8serrors.IsAlreadyExists(err) {
|
||||||
logger.Info("rolebinding object already exists, retrying patch",
|
logger.Error("rolebinding object already exists, retrying patch",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.String("role_binding", roleBinding),
|
zap.String("role_binding", roleBinding),
|
||||||
zap.String("role_binding_namespace", roleBindingNs))
|
zap.String("role_binding_namespace", roleBindingNs))
|
||||||
@@ -161,7 +161,7 @@ func AddSaToRoleBindingWithRetries(logger *zap.Logger, k8sClient *kubernetes.Cli
|
|||||||
// but one CI run did show patch errored out on conflict : https://api.travis-ci.org/v3/job/373161490/log.txt, look for :
|
// but one CI run did show patch errored out on conflict : https://api.travis-ci.org/v3/job/373161490/log.txt, look for :
|
||||||
// Error returned by rolebinding patch : <some more text> there is a meaningful conflict (firstResourceVersion: "35482724", currentResourceVersion: "35482849")
|
// Error returned by rolebinding patch : <some more text> there is a meaningful conflict (firstResourceVersion: "35482724", currentResourceVersion: "35482849")
|
||||||
// so, m guessing retrying patch should help. will watch out for any such conflicts and fix the issue if any
|
// so, m guessing retrying patch should help. will watch out for any such conflicts and fix the issue if any
|
||||||
logger.Info("conflict reported on patch of rolebinding - retrying patch operation",
|
logger.Error("conflict reported on patch of rolebinding - retrying patch operation",
|
||||||
zap.String("role_binding", roleBinding),
|
zap.String("role_binding", roleBinding),
|
||||||
zap.String("role_binding_namespace", roleBindingNs))
|
zap.String("role_binding_namespace", roleBindingNs))
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func MakeNewDeploy(
|
|||||||
if len(os.Getenv("ENABLE_ISTIO")) > 0 {
|
if len(os.Getenv("ENABLE_ISTIO")) > 0 {
|
||||||
istio, err := strconv.ParseBool(os.Getenv("ENABLE_ISTIO"))
|
istio, err := strconv.ParseBool(os.Getenv("ENABLE_ISTIO"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Info("failed to parse 'ENABLE_ISTIO'")
|
logger.Error("failed to parse 'ENABLE_ISTIO', set to false", zap.Error(err))
|
||||||
}
|
}
|
||||||
enableIstio = istio
|
enableIstio = istio
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func (gpm *GenericPoolManager) makePkgController(fissionClient *crd.FissionClien
|
|||||||
k8sCache.ResourceEventHandlerFuncs{
|
k8sCache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(obj interface{}) {
|
||||||
pkg := obj.(*crd.Package)
|
pkg := obj.(*crd.Package)
|
||||||
gpm.logger.Info("list watch for package reported a new package addition",
|
gpm.logger.Debug("list watch for package reported a new package addition",
|
||||||
zap.String("package_name", pkg.Metadata.Name),
|
zap.String("package_name", pkg.Metadata.Name),
|
||||||
zap.String("package_namepsace", pkg.Metadata.Namespace))
|
zap.String("package_namepsace", pkg.Metadata.Namespace))
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ func (gpm *GenericPoolManager) makePkgController(fissionClient *crd.FissionClien
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gpm.logger.Info("successfully set up rolebinding for fetcher service account",
|
gpm.logger.Debug("successfully set up rolebinding for fetcher service account",
|
||||||
zap.String("service_account", fission.FissionFetcherSA),
|
zap.String("service_account", fission.FissionFetcherSA),
|
||||||
zap.String("service_account_namespace", envNs),
|
zap.String("service_account_namespace", envNs),
|
||||||
zap.String("package_name", pkg.Metadata.Name),
|
zap.String("package_name", pkg.Metadata.Name),
|
||||||
@@ -97,7 +97,7 @@ func (gpm *GenericPoolManager) makePkgController(fissionClient *crd.FissionClien
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gpm.logger.Info("successfully updated rolebinding for fetcher service account",
|
gpm.logger.Debug("successfully updated rolebinding for fetcher service account",
|
||||||
zap.String("service_account", fission.FissionFetcherSA),
|
zap.String("service_account", fission.FissionFetcherSA),
|
||||||
zap.String("service_account_namespace", envNs),
|
zap.String("service_account_namespace", envNs),
|
||||||
zap.String("package_name", newPkg.Metadata.Name),
|
zap.String("package_name", newPkg.Metadata.Name),
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ func CleanupRoleBindings(logger *zap.Logger, client *kubernetes.Clientset, fissi
|
|||||||
// finally, make a call to RemoveSAFromRoleBindingWithRetries for all the service accounts that need to be removed
|
// finally, make a call to RemoveSAFromRoleBindingWithRetries for all the service accounts that need to be removed
|
||||||
// for the role-binding in this iteration
|
// for the role-binding in this iteration
|
||||||
if len(saToRemove) != 0 {
|
if len(saToRemove) != 0 {
|
||||||
logger.Info("removing service accounts from role binding",
|
logger.Debug("removing service accounts from role binding",
|
||||||
zap.Any("service_accounts", saToRemove),
|
zap.Any("service_accounts", saToRemove),
|
||||||
zap.String("role_binding_name", roleBinding.Name),
|
zap.String("role_binding_name", roleBinding.Name),
|
||||||
zap.String("role_binding_namespace", roleBinding.Namespace))
|
zap.String("role_binding_namespace", roleBinding.Namespace))
|
||||||
@@ -355,7 +355,7 @@ func CleanupRoleBindings(logger *zap.Logger, client *kubernetes.Clientset, fissi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// if there's an error, we just log it and proceed with the next role-binding, hoping that this role-binding
|
// if there's an error, we just log it and proceed with the next role-binding, hoping that this role-binding
|
||||||
// will be processed in next iteration.
|
// will be processed in next iteration.
|
||||||
logger.Info("error removing service account from role binding",
|
logger.Debug("error removing service account from role binding",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
zap.Any("service_accounts", saToRemove),
|
zap.Any("service_accounts", saToRemove),
|
||||||
zap.String("role_binding_name", roleBinding.Name),
|
zap.String("role_binding_name", roleBinding.Name),
|
||||||
|
|||||||
Reference in New Issue
Block a user