Skip to content

Commit c9a232d

Browse files
authored
Merge pull request #417 from msherif1234/apis-review-r2
2nd round of APIs reviews
2 parents 575c689 + 60e15b8 commit c9a232d

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

apis/v1alpha1/shared_types.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// +kubebuilder:validation:Required
1817
package v1alpha1
1918

2019
import (
@@ -187,21 +186,27 @@ const (
187186
// ByteCodeSelector defines the various ways to reference bpf bytecode objects.
188187
type ByteCodeSelector struct {
189188
// image used to specify a bytecode container image.
189+
// +optional
190190
Image *ByteCodeImage `json:"image,omitempty"`
191191

192192
// path is used to specify a bytecode object via filepath.
193+
// +kubebuilder:validation:Pattern=`^(/[^/\0]+)+/?$`
194+
// +optional
193195
Path *string `json:"path,omitempty"`
194196
}
195197

196198
// ByteCodeImage defines how to specify a bytecode container image.
197199
type ByteCodeImage struct {
198200
// url is a valid container image URL used to reference a remote bytecode image.
201+
// +kubebuilder:validation:Required
202+
// +kubebuilder:validation:MaxLength:=525
203+
// +kubebuilder:validation:Pattern=`[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}`
199204
Url string `json:"url"`
200205

201206
// pullPolicy describes a policy for if/when to pull a bytecode image. Defaults to IfNotPresent.
202207
// +kubebuilder:default:=IfNotPresent
203208
// +optional
204-
ImagePullPolicy PullPolicy `json:"imagePullPolicy"`
209+
ImagePullPolicy PullPolicy `json:"imagePullPolicy,omitempty"`
205210

206211
// imagePullSecret is the name of the secret bpfman should use to get remote image
207212
// repository secrets.

bundle/manifests/bpfman.io_bpfapplications.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ spec:
8686
url:
8787
description: url is a valid container image URL used to reference
8888
a remote bytecode image.
89+
maxLength: 525
90+
pattern: '[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}'
8991
type: string
9092
required:
9193
- url
9294
type: object
9395
path:
9496
description: path is used to specify a bytecode object via filepath.
97+
pattern: ^(/[^/\0]+)+/?$
9598
type: string
9699
type: object
97100
globalData:

bundle/manifests/bpfman.io_clusterbpfapplications.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ spec:
8686
url:
8787
description: url is a valid container image URL used to reference
8888
a remote bytecode image.
89+
maxLength: 525
90+
pattern: '[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}'
8991
type: string
9092
required:
9193
- url
9294
type: object
9395
path:
9496
description: path is used to specify a bytecode object via filepath.
97+
pattern: ^(/[^/\0]+)+/?$
9598
type: string
9699
type: object
97100
globalData:

config/crd/bases/bpfman.io_bpfapplications.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ spec:
8686
url:
8787
description: url is a valid container image URL used to reference
8888
a remote bytecode image.
89+
maxLength: 525
90+
pattern: '[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}'
8991
type: string
9092
required:
9193
- url
9294
type: object
9395
path:
9496
description: path is used to specify a bytecode object via filepath.
97+
pattern: ^(/[^/\0]+)+/?$
9598
type: string
9699
type: object
97100
globalData:

config/crd/bases/bpfman.io_clusterbpfapplications.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,15 @@ spec:
8686
url:
8787
description: url is a valid container image URL used to reference
8888
a remote bytecode image.
89+
maxLength: 525
90+
pattern: '[a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}'
8991
type: string
9092
required:
9193
- url
9294
type: object
9395
path:
9496
description: path is used to specify a bytecode object via filepath.
97+
pattern: ^(/[^/\0]+)+/?$
9598
type: string
9699
type: object
97100
globalData:

0 commit comments

Comments
 (0)