Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
sklarsa committed Aug 6, 2023
commit 54da94d3e528228d55bcbffe3727bc9530beac5d
7 changes: 1 addition & 6 deletions api/v1beta1/questdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ const (
AnnotationQuestDBSecretType = "questdb.crd.questdb.io/secret-type"
)

type QuestDBResourcesSpec struct {
Limits v1.ResourceList `json:"limits,omitempty"`
Requests v1.ResourceList `json:"requests,omitempty"`
}

type QuestDBVolumeSpec struct {
Selector *metav1.LabelSelector `json:"selector,omitempty"`
Size resource.Quantity `json:"size,omitempty"`
Expand Down Expand Up @@ -62,7 +57,7 @@ type QuestDBSpec struct {
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
PodAnnotations map[string]string `json:"podAnnotations,omitempty"`
PodSecurityContext v1.PodSecurityContext `json:"podSecurityContext,omitempty"`
Resources QuestDBResourcesSpec `json:"resources,omitempty"`
Resources v1.ResourceRequirements `json:"resources,omitempty"`
StatefulSetAnnotations map[string]string `json:"statefulSetAnnotations,omitempty"`
Tolerations []v1.Toleration `json:"tolerations,omitempty"`
}
Expand Down
47 changes: 9 additions & 38 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 28 additions & 4 deletions config/crd/bases/crd.questdb.io_questdbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2781,16 +2781,38 @@ spec:
type: object
type: object
resources:
description: ResourceRequirements describes the compute resource requirements.
properties:
claims:
description: "Claims lists the names of resources, defined in
spec.resourceClaims, that are used by this container. \n This
is an alpha field and requires enabling the DynamicResourceAllocation
feature gate. \n This field is immutable. It can only be set
for containers."
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one entry in pod.spec.resourceClaims
of the Pod where this field is used. It makes that resource
available inside a container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: ResourceList is a set of (resource name, quantity)
pairs.
description: 'Limits describes the maximum amount of compute resources
allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
requests:
additionalProperties:
Expand All @@ -2799,8 +2821,10 @@ spec:
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: ResourceList is a set of (resource name, quantity)
pairs.
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
statefulSetAnnotations:
Expand Down
17 changes: 1 addition & 16 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ _Appears in:_



#### QuestDBResourcesSpec





_Appears in:_
- [QuestDBSpec](#questdbspec)

| Field | Description |
| --- | --- |
| `limits` _object (keys:[ResourceName](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#resourcename-v1-core), values:[Quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/))_ | |
| `requests` _object (keys:[ResourceName](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#resourcename-v1-core), values:[Quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/))_ | |


#### QuestDBSnapshot


Expand Down Expand Up @@ -183,7 +168,7 @@ _Appears in:_
| `nodeSelector` _object (keys:string, values:string)_ | |
| `podAnnotations` _object (keys:string, values:string)_ | |
| `podSecurityContext` _[PodSecurityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#podsecuritycontext-v1-core)_ | |
| `resources` _[QuestDBResourcesSpec](#questdbresourcesspec)_ | |
| `resources` _[ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#resourcerequirements-v1-core)_ | |
| `statefulSetAnnotations` _object (keys:string, values:string)_ | |
| `tolerations` _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#toleration-v1-core) array_ | |

Expand Down
5 changes: 1 addition & 4 deletions internal/controller/questdb_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,7 @@ func (r *QuestDBReconciler) buildStatefulSet(q *crdv1beta1.QuestDB, s secrets.Qu
Protocol: v1.ProtocolTCP,
},
},
Resources: v1.ResourceRequirements{
Limits: q.Spec.Resources.Limits,
Requests: q.Spec.Resources.Requests,
},
Resources: q.Spec.Resources,
LivenessProbe: &v1.Probe{
FailureThreshold: 5,
InitialDelaySeconds: 5,
Expand Down
14 changes: 14 additions & 0 deletions internal/controller/questdb_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,20 @@ var _ = Describe("QuestDB Controller", func() {
}, timeout, interval).Should(Succeed())
})

It("should update the statefulset on image pull policy change", func() {
By("Changing the image pull policy")
Eventually(func(g Gomega) {
g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(q), q)).To(Succeed())
q.Spec.ImagePullPolicy = "Always"
g.Expect(k8sClient.Update(ctx, q)).To(Succeed())
}, timeout, interval).Should(Succeed())

By("Verifying the statefulset has been updated")
Eventually(func(g Gomega) {
g.Expect(k8sClient.Get(ctx, client.ObjectKey{Name: q.Name, Namespace: q.Namespace}, sts)).To(Succeed())
g.Expect(sts.Spec.Template.Spec.Containers[0].ImagePullPolicy).To(Equal("Always"))
}, timeout, interval).Should(Succeed())
})
})

Context("pgauth updates", Ordered, func() {
Expand Down