@@ -214,6 +214,7 @@ type ControlPlaneClassNamingStrategy struct {
214
214
// * `.cluster.name`: The name of the cluster object.
215
215
// * `.random`: A random alphanumeric string, without vowels, of length 5.
216
216
// +optional
217
+ // +kubebuilder:validation:MaxLength=512
217
218
Template * string `json:"template,omitempty"`
218
219
}
219
220
@@ -227,6 +228,7 @@ type InfrastructureNamingStrategy struct {
227
228
// * `.cluster.name`: The name of the cluster object.
228
229
// * `.random`: A random alphanumeric string, without vowels, of length 5.
229
230
// +optional
231
+ // +kubebuilder:validation:MaxLength=512
230
232
Template * string `json:"template,omitempty"`
231
233
}
232
234
@@ -255,6 +257,7 @@ type MachineDeploymentClass struct {
255
257
// class denotes a type of worker node present in the cluster,
256
258
// this name MUST be unique within a ClusterClass and can be referenced
257
259
// in the Cluster to create a managed MachineDeployment.
260
+ // +kubebuilder:validation:MaxLength=256
258
261
Class string `json:"class"`
259
262
260
263
// template is a local struct containing a collection of templates for creation of
@@ -269,6 +272,7 @@ type MachineDeploymentClass struct {
269
272
// Must match a key in the FailureDomains map stored on the cluster object.
270
273
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachineDeploymentClass.
271
274
// +optional
275
+ // +kubebuilder:validation:MaxLength=256
272
276
FailureDomain * string `json:"failureDomain,omitempty"`
273
277
274
278
// namingStrategy allows changing the naming pattern used when creating the MachineDeployment.
@@ -350,6 +354,7 @@ type MachineDeploymentClassNamingStrategy struct {
350
354
// * `.random`: A random alphanumeric string, without vowels, of length 5.
351
355
// * `.machineDeployment.topologyName`: The name of the MachineDeployment topology (Cluster.spec.topology.workers.machineDeployments[].name).
352
356
// +optional
357
+ // +kubebuilder:validation:MaxLength=512
353
358
Template * string `json:"template,omitempty"`
354
359
}
355
360
@@ -377,6 +382,7 @@ type MachineHealthCheckClass struct {
377
382
// (b) there are at most 5 unhealthy machines
378
383
// +optional
379
384
// +kubebuilder:validation:Pattern=^\[[0-9]+-[0-9]+\]$
385
+ // +kubebuilder:validation:MaxLength=32
380
386
UnhealthyRange * string `json:"unhealthyRange,omitempty"`
381
387
382
388
// nodeStartupTimeout allows to set the maximum time for MachineHealthCheck
@@ -410,6 +416,7 @@ type MachinePoolClass struct {
410
416
// class denotes a type of machine pool present in the cluster,
411
417
// this name MUST be unique within a ClusterClass and can be referenced
412
418
// in the Cluster to create a managed MachinePool.
419
+ // +kubebuilder:validation:MaxLength=256
413
420
Class string `json:"class"`
414
421
415
422
// template is a local struct containing a collection of templates for creation of
@@ -421,6 +428,7 @@ type MachinePoolClass struct {
421
428
// NOTE: This value can be overridden while defining a Cluster.Topology using this MachinePoolClass.
422
429
// +optional
423
430
// +kubebuilder:validation:MaxItems=100
431
+ // +kubebuilder:validation:items:MaxLength=256
424
432
FailureDomains []string `json:"failureDomains,omitempty"`
425
433
426
434
// namingStrategy allows changing the naming pattern used when creating the MachinePool.
@@ -483,6 +491,7 @@ type MachinePoolClassNamingStrategy struct {
483
491
// * `.random`: A random alphanumeric string, without vowels, of length 5.
484
492
// * `.machinePool.topologyName`: The name of the MachinePool topology (Cluster.spec.topology.workers.machinePools[].name).
485
493
// +optional
494
+ // +kubebuilder:validation:MaxLength=512
486
495
Template * string `json:"template,omitempty"`
487
496
}
488
497
@@ -495,6 +504,7 @@ func (m MachineHealthCheckClass) IsZero() bool {
495
504
// be configured in the Cluster topology and used in patches.
496
505
type ClusterClassVariable struct {
497
506
// name of the variable.
507
+ // +kubebuilder:validation:MaxLength=256
498
508
Name string `json:"name"`
499
509
500
510
// required specifies if the variable is required.
@@ -549,6 +559,7 @@ type VariableSchema struct {
549
559
// which are not supported in CAPI have been removed.
550
560
type JSONSchemaProps struct {
551
561
// description is a human-readable description of this variable.
562
+ // +kubebuilder:validation:MaxLength=512
552
563
Description string `json:"description,omitempty"`
553
564
554
565
// example is an example for this variable.
@@ -557,6 +568,7 @@ type JSONSchemaProps struct {
557
568
// type is the type of the variable.
558
569
// Valid values are: object, array, string, integer, number or boolean.
559
570
// +optional
571
+ // +kubebuilder:validation:MaxLength=16
560
572
Type string `json:"type,omitempty"`
561
573
562
574
// properties specifies fields of an object.
@@ -593,6 +605,7 @@ type JSONSchemaProps struct {
593
605
// NOTE: Can only be set if type is object.
594
606
// +optional
595
607
// +kubebuilder:validation:MaxItems=1000
608
+ // +kubebuilder:validation:items:MaxLength=256
596
609
Required []string `json:"required,omitempty"`
597
610
598
611
// items specifies fields of an array.
@@ -624,6 +637,7 @@ type JSONSchemaProps struct {
624
637
// https://github.com/kubernetes/apiextensions-apiserver/blob/master/pkg/apiserver/validation/formats.go
625
638
// NOTE: Can only be set if type is string.
626
639
// +optional
640
+ // +kubebuilder:validation:MaxLength=32
627
641
Format string `json:"format,omitempty"`
628
642
629
643
// maxLength is the max length of a string variable.
@@ -639,6 +653,7 @@ type JSONSchemaProps struct {
639
653
// pattern is the regex which a string variable must match.
640
654
// NOTE: Can only be set if type is string.
641
655
// +optional
656
+ // +kubebuilder:validation:MaxLength=512
642
657
Pattern string `json:"pattern,omitempty"`
643
658
644
659
// maximum is the maximum of an integer or number variable.
@@ -809,12 +824,14 @@ type ValidationRule struct {
809
824
// skipped if an old value could not be found.
810
825
//
811
826
// +required
827
+ // +kubebuilder:validation:MaxLength=512
812
828
Rule string `json:"rule"`
813
829
// message represents the message displayed when validation fails. The message is required if the Rule contains
814
830
// line breaks. The message must not contain line breaks.
815
831
// If unset, the message is "failed rule: {Rule}".
816
832
// e.g. "must be a URL with the host matching spec.host"
817
833
// +optional
834
+ // +kubebuilder:validation:MaxLength=512
818
835
Message string `json:"message,omitempty"`
819
836
// messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails.
820
837
// Since messageExpression is used as a failure message, it must evaluate to a string.
@@ -826,6 +843,7 @@ type ValidationRule struct {
826
843
// Example:
827
844
// "x must be less than max ("+string(self.max)+")"
828
845
// +optional
846
+ // +kubebuilder:validation:MaxLength=512
829
847
MessageExpression string `json:"messageExpression,omitempty"`
830
848
// reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule.
831
849
// The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate".
@@ -846,6 +864,7 @@ type ValidationRule struct {
846
864
// For field name which contains special characters, use `['specialName']` to refer the field name.
847
865
// e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']`
848
866
// +optional
867
+ // +kubebuilder:validation:MaxLength=512
849
868
FieldPath string `json:"fieldPath,omitempty"`
850
869
}
851
870
@@ -871,9 +890,11 @@ const (
871
890
// ClusterClassPatch defines a patch which is applied to customize the referenced templates.
872
891
type ClusterClassPatch struct {
873
892
// name of the patch.
893
+ // +kubebuilder:validation:MaxLength=256
874
894
Name string `json:"name"`
875
895
876
896
// description is a human-readable description of this patch.
897
+ // +kubebuilder:validation:MaxLength=512
877
898
Description string `json:"description,omitempty"`
878
899
879
900
// enabledIf is a Go template to be used to calculate if a patch should be enabled.
@@ -882,6 +903,7 @@ type ClusterClassPatch struct {
882
903
// be disabled.
883
904
// If EnabledIf is not set, the patch will be enabled per default.
884
905
// +optional
906
+ // +kubebuilder:validation:MaxLength=256
885
907
EnabledIf * string `json:"enabledIf,omitempty"`
886
908
887
909
// definitions define inline patches.
@@ -916,9 +938,11 @@ type PatchDefinition struct {
916
938
// Note: The results of selection based on the individual fields are ANDed.
917
939
type PatchSelector struct {
918
940
// apiVersion filters templates by apiVersion.
941
+ // +kubebuilder:validation:MaxLength=512
919
942
APIVersion string `json:"apiVersion"`
920
943
921
944
// kind filters templates by kind.
945
+ // +kubebuilder:validation:MaxLength=256
922
946
Kind string `json:"kind"`
923
947
924
948
// matchResources selects templates based on where they are referenced.
@@ -956,6 +980,7 @@ type PatchSelectorMatchMachineDeploymentClass struct {
956
980
// names selects templates by class names.
957
981
// +optional
958
982
// +kubebuilder:validation:MaxItems=100
983
+ // +kubebuilder:validation:items:MaxLength=256
959
984
Names []string `json:"names,omitempty"`
960
985
}
961
986
@@ -965,20 +990,23 @@ type PatchSelectorMatchMachinePoolClass struct {
965
990
// names selects templates by class names.
966
991
// +optional
967
992
// +kubebuilder:validation:MaxItems=100
993
+ // +kubebuilder:validation:items:MaxLength=256
968
994
Names []string `json:"names,omitempty"`
969
995
}
970
996
971
997
// JSONPatch defines a JSON patch.
972
998
type JSONPatch struct {
973
999
// op defines the operation of the patch.
974
1000
// Note: Only `add`, `replace` and `remove` are supported.
1001
+ // +kubebuilder:validation:MaxLength=8
975
1002
Op string `json:"op"`
976
1003
977
1004
// path defines the path of the patch.
978
1005
// Note: Only the spec of a template can be patched, thus the path has to start with /spec/.
979
1006
// Note: For now the only allowed array modifications are `append` and `prepend`, i.e.:
980
1007
// * for op: `add`: only index 0 (prepend) and - (append) are allowed
981
1008
// * for op: `replace` or `remove`: no indexes are allowed
1009
+ // +kubebuilder:validation:MaxLength=512
982
1010
Path string `json:"path"`
983
1011
984
1012
// value defines the value of the patch.
@@ -1004,12 +1032,14 @@ type JSONPatchValue struct {
1004
1032
// variable is the variable to be used as value.
1005
1033
// Variable can be one of the variables defined in .spec.variables or a builtin variable.
1006
1034
// +optional
1035
+ // +kubebuilder:validation:MaxLength=256
1007
1036
Variable * string `json:"variable,omitempty"`
1008
1037
1009
1038
// template is the Go template to be used to calculate the value.
1010
1039
// A template can reference variables defined in .spec.variables and builtin variables.
1011
1040
// Note: The template must evaluate to a valid YAML or JSON value.
1012
1041
// +optional
1042
+ // +kubebuilder:validation:MaxLength=512
1013
1043
Template * string `json:"template,omitempty"`
1014
1044
}
1015
1045
@@ -1018,14 +1048,17 @@ type JSONPatchValue struct {
1018
1048
type ExternalPatchDefinition struct {
1019
1049
// generateExtension references an extension which is called to generate patches.
1020
1050
// +optional
1051
+ // +kubebuilder:validation:MaxLength=512
1021
1052
GenerateExtension * string `json:"generateExtension,omitempty"`
1022
1053
1023
1054
// validateExtension references an extension which is called to validate the topology.
1024
1055
// +optional
1056
+ // +kubebuilder:validation:MaxLength=512
1025
1057
ValidateExtension * string `json:"validateExtension,omitempty"`
1026
1058
1027
1059
// discoverVariablesExtension references an extension which is called to discover variables.
1028
1060
// +optional
1061
+ // +kubebuilder:validation:MaxLength=512
1029
1062
DiscoverVariablesExtension * string `json:"discoverVariablesExtension,omitempty"`
1030
1063
1031
1064
// settings defines key value pairs to be passed to the extensions.
@@ -1079,6 +1112,7 @@ type ClusterClassV1Beta2Status struct {
1079
1112
// ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass.
1080
1113
type ClusterClassStatusVariable struct {
1081
1114
// name is the name of the variable.
1115
+ // +kubebuilder:validation:MaxLength=256
1082
1116
Name string `json:"name"`
1083
1117
1084
1118
// definitionsConflict specifies whether or not there are conflicting definitions for a single variable name.
@@ -1095,6 +1129,7 @@ type ClusterClassStatusVariableDefinition struct {
1095
1129
// from specifies the origin of the variable definition.
1096
1130
// This will be `inline` for variables defined in the ClusterClass or the name of a patch defined in the ClusterClass
1097
1131
// for variables discovered from a DiscoverVariables runtime extensions.
1132
+ // +kubebuilder:validation:MaxLength=256
1098
1133
From string `json:"from"`
1099
1134
1100
1135
// required specifies if the variable is required.
0 commit comments