Browse Source

fix: no need for the field to have a default if it can be omitted (#6453)

* fix: #6398 no need for the field to have a default if it can be omitted

Signed-off-by: Lucas Alves <lucasalves@tremendous.com>

* fix: cty still emits optional enum fields in generated sample YAML

Signed-off-by: Lucas Alves <lucasalves@tremendous.com>

---------

Signed-off-by: Lucas Alves <lucasalves@tremendous.com>
Lucas Severo Alves 4 days ago
parent
commit
fda6430a2d

+ 0 - 2
apis/externalsecrets/v1/externalsecret_types.go

@@ -307,7 +307,6 @@ type ExternalSecretDataRemoteRef struct {
 
 	// +optional
 	// Controls how ESO handles fetched secret data containing NUL bytes for this source.
-	// +kubebuilder:default="Ignore"
 	NullBytePolicy ExternalSecretNullBytePolicy `json:"nullBytePolicy,omitempty"`
 }
 
@@ -497,7 +496,6 @@ type ExternalSecretFind struct {
 
 	// +optional
 	// Controls how ESO handles fetched secret data containing NUL bytes for this find source.
-	// +kubebuilder:default="Ignore"
 	NullBytePolicy ExternalSecretNullBytePolicy `json:"nullBytePolicy,omitempty"`
 }
 

+ 0 - 3
config/crds/bases/external-secrets.io_clusterexternalsecrets.yaml

@@ -120,7 +120,6 @@ spec:
                               - Fetch
                               type: string
                             nullBytePolicy:
-                              default: Ignore
                               description: Controls how ESO handles fetched secret
                                 data containing NUL bytes for this source.
                               enum:
@@ -263,7 +262,6 @@ spec:
                               - Fetch
                               type: string
                             nullBytePolicy:
-                              default: Ignore
                               description: Controls how ESO handles fetched secret
                                 data containing NUL bytes for this source.
                               enum:
@@ -310,7 +308,6 @@ spec:
                                   type: string
                               type: object
                             nullBytePolicy:
-                              default: Ignore
                               description: Controls how ESO handles fetched secret
                                 data containing NUL bytes for this find source.
                               enum:

+ 0 - 3
config/crds/bases/external-secrets.io_externalsecrets.yaml

@@ -106,7 +106,6 @@ spec:
                           - Fetch
                           type: string
                         nullBytePolicy:
-                          default: Ignore
                           description: Controls how ESO handles fetched secret data
                             containing NUL bytes for this source.
                           enum:
@@ -248,7 +247,6 @@ spec:
                           - Fetch
                           type: string
                         nullBytePolicy:
-                          default: Ignore
                           description: Controls how ESO handles fetched secret data
                             containing NUL bytes for this source.
                           enum:
@@ -295,7 +293,6 @@ spec:
                               type: string
                           type: object
                         nullBytePolicy:
-                          default: Ignore
                           description: Controls how ESO handles fetched secret data
                             containing NUL bytes for this find source.
                           enum:

+ 0 - 6
deploy/crds/bundle.yaml

@@ -114,7 +114,6 @@ spec:
                                   - Fetch
                                 type: string
                               nullBytePolicy:
-                                default: Ignore
                                 description: Controls how ESO handles fetched secret data containing NUL bytes for this source.
                                 enum:
                                   - Ignore
@@ -249,7 +248,6 @@ spec:
                                   - Fetch
                                 type: string
                               nullBytePolicy:
-                                default: Ignore
                                 description: Controls how ESO handles fetched secret data containing NUL bytes for this source.
                                 enum:
                                   - Ignore
@@ -293,7 +291,6 @@ spec:
                                     type: string
                                 type: object
                               nullBytePolicy:
-                                default: Ignore
                                 description: Controls how ESO handles fetched secret data containing NUL bytes for this find source.
                                 enum:
                                   - Ignore
@@ -12837,7 +12834,6 @@ spec:
                               - Fetch
                             type: string
                           nullBytePolicy:
-                            default: Ignore
                             description: Controls how ESO handles fetched secret data containing NUL bytes for this source.
                             enum:
                               - Ignore
@@ -12972,7 +12968,6 @@ spec:
                               - Fetch
                             type: string
                           nullBytePolicy:
-                            default: Ignore
                             description: Controls how ESO handles fetched secret data containing NUL bytes for this source.
                             enum:
                               - Ignore
@@ -13016,7 +13011,6 @@ spec:
                                 type: string
                             type: object
                           nullBytePolicy:
-                            default: Ignore
                             description: Controls how ESO handles fetched secret data containing NUL bytes for this find source.
                             enum:
                               - Ignore

+ 3 - 3
tests/__snapshot__/clusterexternalsecret-v1.yaml

@@ -13,7 +13,7 @@ spec:
         decodingStrategy: "None"
         key: string
         metadataPolicy: "None"
-        nullBytePolicy: "Ignore"
+        nullBytePolicy: "Ignore" # "Ignore", "Fail"
         property: string
         version: string
       secretKey: string
@@ -31,7 +31,7 @@ spec:
         decodingStrategy: "None"
         key: string
         metadataPolicy: "None"
-        nullBytePolicy: "Ignore"
+        nullBytePolicy: "Ignore" # "Ignore", "Fail"
         property: string
         version: string
       find:
@@ -39,7 +39,7 @@ spec:
         decodingStrategy: "None"
         name:
           regexp: string
-        nullBytePolicy: "Ignore"
+        nullBytePolicy: "Ignore" # "Ignore", "Fail"
         path: string
         tags: {}
       rewrite:

+ 3 - 3
tests/__snapshot__/externalsecret-v1.yaml

@@ -8,7 +8,7 @@ spec:
       decodingStrategy: "None"
       key: string
       metadataPolicy: "None"
-      nullBytePolicy: "Ignore"
+      nullBytePolicy: "Ignore" # "Ignore", "Fail"
       property: string
       version: string
     secretKey: string
@@ -26,7 +26,7 @@ spec:
       decodingStrategy: "None"
       key: string
       metadataPolicy: "None"
-      nullBytePolicy: "Ignore"
+      nullBytePolicy: "Ignore" # "Ignore", "Fail"
       property: string
       version: string
     find:
@@ -34,7 +34,7 @@ spec:
       decodingStrategy: "None"
       name:
         regexp: string
-      nullBytePolicy: "Ignore"
+      nullBytePolicy: "Ignore" # "Ignore", "Fail"
       path: string
       tags: {}
     rewrite: