Skip to content

Commit 23b6e70

Browse files
committed
add explicit string max length check of 63
1 parent a0f9e2b commit 23b6e70

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

operator/src/main/java/it/aboutbits/postgresql/core/ClusterReference.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package it.aboutbits.postgresql.core;
22

33
import io.fabric8.crdv2.generator.v1.SchemaCustomizer;
4+
import io.fabric8.generator.annotation.Max;
45
import io.fabric8.generator.annotation.Required;
56
import io.fabric8.generator.annotation.ValidationRule;
67
import it.aboutbits.postgresql.core.schema_customizer.KubernetesNameCustomizer;
@@ -15,13 +16,15 @@
1516
@SchemaCustomizer(KubernetesNameCustomizer.class)
1617
public class ClusterReference {
1718
@Required
19+
@Max(63)
1820
@ValidationRule(
1921
value = "self.trim().size() > 0",
2022
message = "The ClusterReference name must not be empty."
2123
)
2224
private String name = "";
2325

2426
@Nullable
27+
@Max(63)
2528
@io.fabric8.generator.annotation.Nullable
2629
private String namespace;
2730
}

operator/src/main/java/it/aboutbits/postgresql/core/SecretRef.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package it.aboutbits.postgresql.core;
22

33
import io.fabric8.crdv2.generator.v1.SchemaCustomizer;
4+
import io.fabric8.generator.annotation.Max;
45
import io.fabric8.generator.annotation.Required;
56
import io.fabric8.generator.annotation.ValidationRule;
67
import it.aboutbits.postgresql.core.schema_customizer.KubernetesNameCustomizer;
@@ -15,6 +16,7 @@
1516
@SchemaCustomizer(KubernetesNameCustomizer.class)
1617
public class SecretRef {
1718
@Required
19+
@Max(63)
1820
@ValidationRule(
1921
value = "self.trim().size() > 0",
2022
message = "The SecretRef name must not be empty."
@@ -26,6 +28,7 @@ public class SecretRef {
2628
* If it is null, it means the Secret is in the same namespace as the resource referencing it.
2729
*/
2830
@Nullable
31+
@Max(63)
2932
@io.fabric8.generator.annotation.Nullable
3033
private String namespace;
3134
}

0 commit comments

Comments
 (0)