Skip to content

Commit

Permalink
Initialize empty labels in the example
Browse files Browse the repository at this point in the history
  • Loading branch information
yaocw2020 committed Mar 24, 2022
1 parent 36f0864 commit 8423a34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/admitter/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func (v *poolMutator) Create(request *types.Request, newObj runtime.Object) (typ
pod := newObj.(*corev1.Pod)

labels := pod.GetLabels()
if labels == nil {
labels = make(map[string]string)
}

labels["example"] = "example"

Expand Down

0 comments on commit 8423a34

Please sign in to comment.