Skip to content

Commit

Permalink
fix, mutating when pod status chaged (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaofan-hs committed Aug 28, 2023
1 parent 49126be commit 43d35c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/webhook/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ webhooks:
- DELETE
resources:
- pods
- pods/status
scope: '*'
objectSelector:
matchExpressions:
Expand Down
5 changes: 4 additions & 1 deletion pkg/webhook/server/generic/generic_webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ var MutatingTypeHandlerMap = map[string]webhookdmission.DispatchHandler{}
var ValidatingTypeHandlerMap = map[string]webhookdmission.DispatchHandler{}

func init() {
MutatingTypeHandlerMap["Pod"] = pod.NewMutatingHandler()
podMutatingHandler := pod.NewMutatingHandler()
MutatingTypeHandlerMap["Pod"] = podMutatingHandler
MutatingTypeHandlerMap["Pod/status"] = podMutatingHandler

ValidatingTypeHandlerMap["Pod"] = pod.NewValidatingHandler()

MutatingTypeHandlerMap["RuleSet"] = ruleset.NewMutatingHandler()
Expand Down
2 changes: 1 addition & 1 deletion pkg/webhook/server/generic/pod/opslifecycle/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func New() *OpsLifecycle {
readyToUpgrade: hasNoBlockingFinalizer,
isPodReady: controllerutils.IsPodReady,
timeLabelValue: func() string {
return strconv.FormatInt(time.Now().Unix(), 10)
return strconv.FormatInt(time.Now().UnixNano(), 10)
},
}
}
Expand Down

0 comments on commit 43d35c0

Please sign in to comment.