mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-18 10:39:43 +02:00
allow empty resources when defaults are empty (#2524)
* allow empty resources when defaults are empty * update codegen * add more unit tests and remove internal resources defaults * a unit test for min limit and raising to request * uncomment defaults in example configmap * simplifying pooler pod generation unit test
This commit is contained in:
@@ -153,10 +153,10 @@ type PostgresqlParam struct {
|
||||
|
||||
// ResourceDescription describes CPU and memory resources defined for a cluster.
|
||||
type ResourceDescription struct {
|
||||
CPU string `json:"cpu"`
|
||||
Memory string `json:"memory"`
|
||||
HugePages2Mi *string `json:"hugepages-2Mi"`
|
||||
HugePages1Gi *string `json:"hugepages-1Gi"`
|
||||
CPU *string `json:"cpu,omitempty"`
|
||||
Memory *string `json:"memory,omitempty"`
|
||||
HugePages2Mi *string `json:"hugepages-2Mi,omitempty"`
|
||||
HugePages1Gi *string `json:"hugepages-1Gi,omitempty"`
|
||||
}
|
||||
|
||||
// Resources describes requests and limits for the cluster resouces.
|
||||
@@ -260,7 +260,7 @@ type Stream struct {
|
||||
// StreamTable defines properties of outbox tables for FabricEventStreams
|
||||
type StreamTable struct {
|
||||
EventType string `json:"eventType"`
|
||||
RecoveryEventType string `json:"recoveryEventType"`
|
||||
RecoveryEventType string `json:"recoveryEventType,omitempty"`
|
||||
IdColumn *string `json:"idColumn,omitempty"`
|
||||
PayloadColumn *string `json:"payloadColumn,omitempty"`
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ var parseTimeTests = []struct {
|
||||
{"expect error as minute is out of range", "23:69", metav1.Now(), errors.New(`parsing time "23:69": minute out of range`)},
|
||||
}
|
||||
|
||||
func stringToPointer(str string) *string {
|
||||
return &str
|
||||
}
|
||||
|
||||
var parseWeekdayTests = []struct {
|
||||
about string
|
||||
in string
|
||||
@@ -301,8 +305,8 @@ var unmarshalCluster = []struct {
|
||||
Slots: map[string]map[string]string{"permanent_logical_1": {"type": "logical", "database": "foo", "plugin": "pgoutput"}},
|
||||
},
|
||||
Resources: &Resources{
|
||||
ResourceRequests: ResourceDescription{CPU: "10m", Memory: "50Mi"},
|
||||
ResourceLimits: ResourceDescription{CPU: "300m", Memory: "3000Mi"},
|
||||
ResourceRequests: ResourceDescription{CPU: stringToPointer("10m"), Memory: stringToPointer("50Mi")},
|
||||
ResourceLimits: ResourceDescription{CPU: stringToPointer("300m"), Memory: stringToPointer("3000Mi")},
|
||||
},
|
||||
|
||||
TeamID: "acid",
|
||||
|
||||
@@ -1165,6 +1165,16 @@ func (in *PreparedSchema) DeepCopy() *PreparedSchema {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceDescription) DeepCopyInto(out *ResourceDescription) {
|
||||
*out = *in
|
||||
if in.CPU != nil {
|
||||
in, out := &in.CPU, &out.CPU
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Memory != nil {
|
||||
in, out := &in.Memory, &out.Memory
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.HugePages2Mi != nil {
|
||||
in, out := &in.HugePages2Mi, &out.HugePages2Mi
|
||||
*out = new(string)
|
||||
|
||||
Reference in New Issue
Block a user