Skip to content

Commit 7c634d5

Browse files
committed
Tolerations, nodeSelector and cluster-preferred-endpoint-type
1 parent ac1137e commit 7c634d5

File tree

5 files changed

+77
-1
lines changed

5 files changed

+77
-1
lines changed

api/v1/valkey_types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ type ValkeySpec struct {
8282

8383
// Service Password
8484
ServicePassword *corev1.SecretKeySelector `json:"servicePassword,omitempty"`
85+
86+
// Tolerations
87+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
88+
89+
// Node Selector
90+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
91+
92+
// Which endpoint is shown as the preferred endpoint valid values are 'ip', 'hostname', or 'unknown-endpoint'.
93+
// +kubebuilder:default:="hostname"
94+
ClusterPreferredEndpointType string `json:"clusterPreferredEndpointType,omitempty"`
8595
}
8696

8797
// ExternalAccess defines the external access configuration

api/v1/zz_generated.deepcopy.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/hyperspike.io_valkeys.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ spec:
8080
default: cluster.local
8181
description: Cluster Domain - used for DNS
8282
type: string
83+
clusterPreferredEndpointType:
84+
default: hostname
85+
description: Which endpoint is shown as the preferred endpoint valid
86+
values are 'ip', 'hostname', or 'unknown-endpoint'.
87+
type: string
8388
exporterImage:
8489
description: Exporter Image to use
8590
type: string
@@ -211,6 +216,11 @@ spec:
211216
image:
212217
description: Image to use
213218
type: string
219+
nodeSelector:
220+
additionalProperties:
221+
type: string
222+
description: Node Selector
223+
type: object
214224
nodes:
215225
default: 3
216226
description: Number of shards
@@ -722,6 +732,45 @@ spec:
722732
default: false
723733
description: TLS Support
724734
type: boolean
735+
tolerations:
736+
description: Tolerations
737+
items:
738+
description: |-
739+
The pod this Toleration is attached to tolerates any taint that matches
740+
the triple <key,value,effect> using the matching operator <operator>.
741+
properties:
742+
effect:
743+
description: |-
744+
Effect indicates the taint effect to match. Empty means match all taint effects.
745+
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
746+
type: string
747+
key:
748+
description: |-
749+
Key is the taint key that the toleration applies to. Empty means match all taint keys.
750+
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
751+
type: string
752+
operator:
753+
description: |-
754+
Operator represents a key's relationship to the value.
755+
Valid operators are Exists and Equal. Defaults to Equal.
756+
Exists is equivalent to wildcard for value, so that a pod can
757+
tolerate all taints of a particular category.
758+
type: string
759+
tolerationSeconds:
760+
description: |-
761+
TolerationSeconds represents the period of time the toleration (which must be
762+
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
763+
it is not set, which means tolerate the taint forever (do not evict). Zero and
764+
negative values will be treated as 0 (evict immediately) by the system.
765+
format: int64
766+
type: integer
767+
value:
768+
description: |-
769+
Value is the taint value the toleration matches to.
770+
If the operator is Exists, the value should be empty, otherwise just a regular string.
771+
type: string
772+
type: object
773+
type: array
725774
volumePermissions:
726775
default: false
727776
description: Turn on an init container to set permissions on the persistent

internal/controller/scripts/valkey.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,8 @@ cluster-config-file /data/nodes.conf
17461746
# the client to reach out on the same endpoint it used for making the last request, but use
17471747
# the port provided in the response.
17481748

1749-
cluster-preferred-endpoint-type hostname
1749+
cluster-preferred-endpoint-type {{ .Spec.ClusterPreferredEndpointType }}
1750+
17501751

17511752
########################## CLUSTER DOCKER/NAT support ########################
17521753

internal/controller/valkey_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,6 +2102,8 @@ func (r *ValkeyReconciler) upsertStatefulSet(ctx context.Context, valkey *hyperv
21022102
},
21032103
},
21042104
},
2105+
Tolerations: valkey.Spec.Tolerations,
2106+
NodeSelector: valkey.Spec.NodeSelector,
21052107
Containers: []corev1.Container{
21062108
{
21072109
Image: image,

0 commit comments

Comments
 (0)