Skip to content

Commit

Permalink
Merge pull request #2 from xuezhichao/feature/optimize
Browse files Browse the repository at this point in the history
agentVersion requeue
  • Loading branch information
chenzhiguo authored Nov 26, 2024
2 parents f018146 + c48a406 commit 5ae6cee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/config/av_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (w *AgentVersionWatcher) processAgentVersion() bool {
item, exists, err := w.agentVersionInformer.GetIndexer().GetByKey(key.(string))
if err != nil {
log.Error("get agentVersion by key error", zap.String("key", key.(string)), zap.Error(err))
w.cmQueue.AddRateLimited(item)
return true
}
if !exists {
Expand All @@ -152,7 +153,6 @@ func (w *AgentVersionWatcher) processAgentVersion() bool {
if agentVersion, ok := item.(*v1.AgentVersion); ok {
if err := w.cacheAgentVersion(agentVersion); err != nil {
log.Error("cache this agentVersion error", zap.String("key", key.(string)), zap.Error(err))
w.cmQueue.AddRateLimited(item)
return true
}
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/mutation/mutation_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
jsoniter "github.com/json-iterator/go"
"go.uber.org/zap"
admissionv1 "k8s.io/api/admission/v1"
apiv1 "k8s.io/api/admission/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand All @@ -31,7 +32,7 @@ func injectionDeploy(request *admissionv1.AdmissionRequest) (*admissionv1.Admiss
switch request.Kind.Kind {
case "Deployment":
log.Debugf("[mutation] ----- /injection-deploy: received request: %v,the operition is %s ", request.Resource, request.Operation)
if request.Operation == "DELETE" {
if request.Operation == apiv1.Operation("DELETE") {
log.Debugf("[mutation] /injection-deploy: received delete request name is : %s, namespace is %s ", request.Name, request.Namespace)
err := deleteConfigMap(request.Name, request.Namespace)
if err != nil {
Expand Down

0 comments on commit 5ae6cee

Please sign in to comment.