Skip to content

Commit 26b9f53

Browse files
committed
fix doc, line feed and ignore extra properties for the FileCredentials fileRef
1 parent e09164c commit 26b9f53

4 files changed

Lines changed: 471 additions & 440 deletions

File tree

docs/cluster-connection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The referenced secret must be of type `kubernetes.io/basic-auth` and contain the
3535

3636
Use this option when the credentials are mounted as a file instead of a Kubernetes Secret.
3737

38-
### File format
38+
#### File format
3939

4040
The file must contain JSON with the following fields:
4141

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
package it.aboutbits.postgresql.core;
2-
3-
import io.fabric8.generator.annotation.Required;
4-
import io.fabric8.generator.annotation.ValidationRule;
5-
import lombok.Getter;
6-
import lombok.Setter;
7-
import org.jspecify.annotations.NullMarked;
8-
9-
/// A reference to a file inside the operator container.
10-
///
11-
/// This class is used wherever a CRD spec needs to point to a specific file
12-
/// The [#path] field identifies the file location within the container.
13-
///
14-
/// ### Example usage in a CR manifest
15-
///
16-
/// ```yaml
17-
/// spec:
18-
/// adminSecretFileRef:
19-
/// path: "/mnt/secrets/db-credentials.json"
20-
/// ```
21-
@Getter
22-
@Setter
23-
@NullMarked
24-
public class FileRef {
25-
/// The path to the file.
26-
/// Must not be blank.
27-
@Required
28-
@ValidationRule(
29-
value = "self.trim().size() > 0",
30-
message = "The path must not be empty."
31-
)
32-
private String path = "";
33-
}
1+
package it.aboutbits.postgresql.core;
2+
3+
import io.fabric8.generator.annotation.Required;
4+
import io.fabric8.generator.annotation.ValidationRule;
5+
import lombok.Getter;
6+
import lombok.Setter;
7+
import org.jspecify.annotations.NullMarked;
8+
9+
/// A reference to a file inside the operator container.
10+
///
11+
/// This class is used wherever a CRD spec needs to point to a specific file
12+
/// The [#path] field identifies the file location within the container.
13+
///
14+
/// ### Example usage in a CR manifest
15+
///
16+
/// ```yaml
17+
/// spec:
18+
/// adminSecretFileRef:
19+
/// path: "/mnt/secrets/db-credentials.json"
20+
/// ```
21+
@Getter
22+
@Setter
23+
@NullMarked
24+
public class FileRef {
25+
/// The path to the file.
26+
/// Must not be blank.
27+
@Required
28+
@ValidationRule(
29+
value = "self.trim().size() > 0",
30+
message = "The path must not be empty."
31+
)
32+
private String path = "";
33+
}

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

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

3+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
34
import com.fasterxml.jackson.databind.ObjectMapper;
45
import io.fabric8.kubernetes.client.KubernetesClient;
56
import it.aboutbits.postgresql.crd.clusterconnection.ClusterConnection;
@@ -21,6 +22,9 @@
2122
public final class KubernetesService {
2223
private final ObjectMapper objectMapper;
2324

25+
/// The JSON file may carry more keys than we need, for example, the AWS Secrets Manager
26+
/// format also has `engine`, `host`, `port` and `dbname`. Unknown keys are ignored.
27+
@JsonIgnoreProperties(ignoreUnknown = true)
2428
private record FileCredentials(
2529
@Nullable String username,
2630
@Nullable String password

0 commit comments

Comments
 (0)