Skip to content

Commit

Permalink
Make ReturnArgAction optional
Browse files Browse the repository at this point in the history
The ReturnArgAction was added to the KProbeSpec to allow actions to be
taken on the return values from hooked functions. It was specified as an
enumeration in order to constrain its use to the supported actions,
namely: Post, TrackSock and UntrackSock. This has the unintended
consequence of making it non-optional through K8S validation.

This commit makes the ReturnArgAction optional.

Signed-off-by: Kevin Sheldrake <kevin.sheldrake@isovalent.com>
  • Loading branch information
kevsecurity committed Jul 4, 2023
1 parent 5306278 commit cf8c11c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ spec:
- type
type: object
returnArgAction:
description: An action to perform on the return argument.
enum:
- Post
- TrackSock
- UntrackSock
description: 'An action to perform on the return argument. Available
actions are: Post;TrackSock;UntrackSock'
type: string
selectors:
description: Selectors to apply before producing trace output.
Expand Down Expand Up @@ -523,7 +520,6 @@ spec:
type: boolean
required:
- call
- returnArgAction
type: object
type: array
loader:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,8 @@ spec:
- type
type: object
returnArgAction:
description: An action to perform on the return argument.
enum:
- Post
- TrackSock
- UntrackSock
description: 'An action to perform on the return argument. Available
actions are: Post;TrackSock;UntrackSock'
type: string
selectors:
description: Selectors to apply before producing trace output.
Expand Down Expand Up @@ -523,7 +520,6 @@ spec:
type: boolean
required:
- call
- returnArgAction
type: object
type: array
loader:
Expand Down
3 changes: 2 additions & 1 deletion pkg/k8s/apis/cilium.io/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ type KProbeSpec struct {
// +kubebuilder:validation:Optional
// A return argument to include in the trace output.
ReturnArg KProbeArg `json:"returnArg"`
// +kubebuilder:validation:Enum=Post;TrackSock;UntrackSock
// +kubebuilder:validation:Optional
// An action to perform on the return argument.
// Available actions are: Post;TrackSock;UntrackSock
ReturnArgAction string `json:"returnArgAction"`
// +kubebuilder:validation:Optional
// Selectors to apply before producing trace output. Selectors are ORed.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf8c11c

Please sign in to comment.