-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Adding CRD validation #888
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Santosh Kaluskar <[email protected]>
api/v1beta1/bucket_types.go
Outdated
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=63 | ||
// +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ignore field can have thousands of lines with special characters and UTF8, think of file paths written in Chinese.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Should the validation be removed from this Igonore
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation pattern yes, the max length should be less than etcd entry max size (1MB).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that be 5000? (<5120)
api/v1beta1/gitrepository_types.go
Outdated
// +optional | ||
Tag string `json:"tag,omitempty"` | ||
|
||
// The Git tag semver expression, takes precedence over Tag. | ||
// +kubebuilder:validation:MaxLength=253 | ||
// +kubebuilder:validation:Pattern=`^[\-._0-9]+$` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A semver expression usually contains special characters and alpha numeric ones, see https://github.com/Masterminds/semver
api/v1beta1/helmchart_types.go
Outdated
@@ -102,6 +110,9 @@ type LocalHelmChartSourceReference struct { | |||
Kind string `json:"kind"` | |||
|
|||
// Name of the referent. | |||
// +kubebuilder:validation:MinLength=1 | |||
// +kubebuilder:validation:MaxLength=63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:validation:MaxLength=63 | |
// +kubebuilder:validation:MaxLength=253 |
Kubernetes object name max length is 253, please use this value for all fields that references a Kube object by name.
api/v1beta2/artifact_types.go
Outdated
// +required | ||
URL string `json:"url"` | ||
|
||
// Revision is a human-readable identifier traceable in the origin source | ||
// system. It can be a Git commit SHA, Git tag, a Helm chart version, etc. | ||
// +kubebuilder:validation:MaxLength=63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks Flux, we use SHA256 for OCI and for Git we append the brach name to the Git SHA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
api/v1beta1/helmchart_types.go
Outdated
@@ -92,6 +97,9 @@ const ( | |||
// the typed referenced object at namespace level. | |||
type LocalHelmChartSourceReference struct { | |||
// APIVersion of the referent. | |||
// +kubebuilder:validation:MaxLength=63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:validation:MaxLength=63 | |
// +kubebuilder:validation:MaxLength=2048 |
Please change this in all objects with APIVersion fields.
api/v1beta2/gitrepository_types.go
Outdated
@@ -153,14 +161,20 @@ type GitRepositoryRef struct { | |||
// | |||
// When GitRepositorySpec.GitImplementation is set to 'go-git', a shallow | |||
// clone of the specified branch is performed. | |||
// +kubebuilder:validation:MaxLength=63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// +kubebuilder:validation:MaxLength=63 | |
// +kubebuilder:validation:MaxLength=244 |
api/v1beta2/helmchart_types.go
Outdated
// +kubebuilder:validation:MaxLength=63 | ||
// +kubebuilder:validation:Pattern=`^[\-._0-9]+$` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version can be a semver expression as documented above
@Santosh1176 please run |
Thanks for the review and your time. I'll do as advised. |
Signed-off-by: Santosh Kaluskar <[email protected]>
Signed-off-by: Santosh Kaluskar [email protected]
This WIP is a part fix to #2993.
Request a review from @pjbgf.