Skip to content

Commit 3940cd2

Browse files
jmckulkJonathan S. Katz
authored andcommitted
Several cleanups to the custom resource definitions
This helps to ensure that the struct definitions match Kubernetes expectaions when transcoding between formats.
1 parent f555a59 commit 3940cd2

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

pkg/apis/crunchydata.com/v1/cluster.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ type PgclusterSpec struct {
6060
Exporter bool `json:"exporter"`
6161
ExporterPort string `json:"exporterport"`
6262

63-
PrimaryStorage PgStorageSpec
64-
WALStorage PgStorageSpec
65-
ReplicaStorage PgStorageSpec
66-
BackrestStorage PgStorageSpec
67-
PGAdminStorage PgStorageSpec
63+
PrimaryStorage PgStorageSpec `json:"PrimaryStorage"`
64+
WALStorage PgStorageSpec `json:"WALStorage"`
65+
ReplicaStorage PgStorageSpec `json:"ReplicaStorage"`
66+
BackrestStorage PgStorageSpec `json:"BackrestStorage"`
67+
PGAdminStorage PgStorageSpec `json:"PGAdminStorage"`
6868

6969
// Resources behaves just like the "Requests" section of a Kubernetes
7070
// container definition. You can set individual items such as "cpu" and
@@ -120,8 +120,8 @@ type PgclusterSpec struct {
120120
UserLabels map[string]string `json:"userlabels"`
121121
NodeAffinity NodeAffinitySpec `json:"nodeAffinity"`
122122
PodAntiAffinity PodAntiAffinitySpec `json:"podAntiAffinity"`
123-
SyncReplication *bool `json:"syncReplication"`
124-
BackrestConfig []v1.VolumeProjection `json:"backrestConfig"`
123+
SyncReplication *bool `json:"syncReplication,omitempty"`
124+
BackrestConfig []v1.VolumeProjection `json:"backrestConfig,omitempty"`
125125
BackrestGCSBucket string `json:"backrestGCSBucket"`
126126
BackrestGCSEndpoint string `json:"backrestGCSEndpoint"`
127127
BackrestGCSKeyType string `json:"backrestGCSKeyType"`
@@ -275,7 +275,7 @@ const NodeAffinityDefaultWeight int32 = 10
275275
//
276276
// All of these are optional, so one must ensure they check for nils.
277277
type NodeAffinitySpec struct {
278-
Default *v1.NodeAffinity `json:"default"`
278+
Default *v1.NodeAffinity `json:"default,omitempty"`
279279
}
280280

281281
// NodeAffinityType indicates the type of node affinity that the request seeks

pkg/apis/crunchydata.com/v1/register.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// +kubebuilder:object:generate=true
2+
// +kubebuilder:validation:Optional
3+
// +groupName=crunchydata.com
14
package v1
25

36
/*

pkg/apis/crunchydata.com/v1/replica.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type PgreplicaSpec struct {
4747
UserLabels map[string]string `json:"userlabels"`
4848
// NodeAffinity is an optional structure that dictates how an instance should
4949
// be deployed in an environment
50-
NodeAffinity *v1.NodeAffinity `json:"nodeAffinity"`
50+
NodeAffinity *v1.NodeAffinity `json:"nodeAffinity,omitempty"`
5151
// Tolerations are an optional list of Pod toleration rules that are applied
5252
// to the PostgreSQL instance.
5353
Tolerations []v1.Toleration `json:"tolerations"`

0 commit comments

Comments
 (0)