Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package := github.com/inditextech/$(name)
# Image URL to use for building/pushing image targets when using `pro` deployment profile.
IMG ?= redkey-operator:$(VERSION)
IMG_WEBHOOK ?= redkey-operator-webhook:$(VERSION)
IMG_ROBIN ?= redkey-robin:$(VERSION)

# CN for the webhook certificate
CN ?= inditex.dev
Expand Down Expand Up @@ -376,11 +377,19 @@ delete-operator: ## Delete the operator pod (redkey-operator) in order to have

apply-rkcl: ## Apply the sample RedKey Cluster manifest.
$(info $(M) creating sample RedKey cluster)
$(KUSTOMIZE) build config/samples | $(SED) 's/namespace: redkey-operator/namespace: ${NAMESPACE}/' | kubectl apply -f -
$(KUSTOMIZE) build config/samples/ephemeral | $(SED) 's/namespace: redkey-operator/namespace: ${NAMESPACE}/' | $(SED) 's,image: redkey-robin:0.1.0,image: ${IMG_ROBIN},' | kubectl apply -f -

delete-rkcl: ## Delete the sample RedKey Cluster manifest.
$(info $(M) deleting sample RedKey cluster)
$(KUSTOMIZE) build config/samples | $(SED) 's/namespace: redkey-operator/namespace: ${NAMESPACE}/' | kubectl delete -f -
$(KUSTOMIZE) build config/samples/ephemeral | $(SED) 's/namespace: redkey-operator/namespace: ${NAMESPACE}/' | $(SED) 's,image: redkey-robin:0.1.0,image: ${IMG_ROBIN},' | kubectl delete -f -

apply-debug-rkcl: ## Apply the sample RedKey Cluster manifest for Robin debugging.
$(info $(M) creating sample RedKey cluster)
$(KUSTOMIZE) build config/samples/robin-debug | $(SED) 's/namespace: redkey-operator/namespace: ${NAMESPACE}/' | $(SED) 's,image: redkey-robin:0.1.0,image: ${IMG_DEBUG},' | kubectl apply -f -

delete-debug-rkcl: ## Delete the sample RedKey Cluster manifest for Robin debugging.
$(info $(M) deleting sample RedKey cluster)
$(KUSTOMIZE) build config/samples/robin-debug | $(SED) 's/namespace: redkey-operator/namespace: ${NAMESPACE}/' | $(SED) 's,image: redkey-robin:0.1.0,image: ${IMG_DEBUG},' | kubectl delete -f -

apply-all: docker-build docker-push process-manifests install deploy apply-rkcl

Expand Down
142 changes: 142 additions & 0 deletions config/samples/ephemeral/redis_v1_redkeycluster-ephemeral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
apiVersion: redis.inditex.dev/v1
kind: RedKeyCluster
metadata:
labels:
app.kubernetes.io/name: redkey-cluster-operator
app.kubernetes.io/managed-by: kustomize
name: redis-cluster-ephemeral
spec:
replicas: 3
ephemeral: true
accessModes:
- ReadWriteOnce
deletePVC: false
image: redis:8-bookworm
purgeKeysOnRebalance: true
labels:
team: team-a
custom: labels
config: |
maxmemory 90mb
maxmemory-samples 5
maxmemory-policy allkeys-lru
protected-mode no
appendonly no
save ""
resources:
limits:
cpu: 100m
memory: 128Mi
robin:
config: |
metadata:
namespace: redkey-operator
redis:
standalone: false
reconciler:
interval_seconds: 30
operation_cleanup_interval_seconds: 30
cluster:
namespace: redkey-operator
name: redis-cluster-ephemeral
replicas: 3
replicas_per_master: 0
status: 'Unknown'
ephemeral: true
health_probe_interval_seconds: 60
healing_time_seconds: 60
max_retries: 10
back_off: 10s
metrics:
interval_seconds: 60
redis_info_keys:
- keyspace_hits
- evicted_keys
- connected_clients
- total_commands_processed
- keyspace_misses
- expired_keys
- redis_version
- used_memory_rss
- maxmemory
- used_cpu_sys
- used_cpu_sys_children
- used_cpu_user
- used_cpu_user_children
- total_net_input_bytes
- total_net_output_bytes
- aof_base_size
- aof_current_size
- mem_aof_buffer
template:
spec:
containers:
- image: redkey-robin:0.1.0
name: robin
imagePullPolicy: Always
ports:
- containerPort: 8080
name: prometheus
protocol: TCP
volumeMounts:
- mountPath: /opt/conf/configmap
name: redis-cluster-ephemeral-robin-config
resources:
requests:
cpu: 500m
memory: 100Mi
limits:
cpu: 1
memory: 200Mi
volumes:
- configMap:
defaultMode: 420
name: redis-cluster-ephemeral-robin
name: redis-cluster-ephemeral-robin-config
# override:
# service:
# metadata:
# annotations:
# traffic.inditex.dev/weight: "101"
# labels:
# inditex.dev/test: "test"
# spec:
# ports:
# - name: prometheus
# port: 9090
# targetPort: 9090
# protocol: TCP
# selector:
# inditex.dev/test: "test"
# statefulSet:
# metadata:
# annotations:
# traffic.inditex.dev/weight: "10"
# spec:
# template:
# metadata:
# labels:
# inditex.dev/test: "test"
# spec:
# tolerations:
# - key: "test"
# operator: "Equal"
# value: "test"
# effect: "NoSchedule"
# topologySpreadConstraints:
# - maxSkew: 1
# topologyKey: kubernetes.io/hostname
# whenUnsatisfiable: DoNotSchedule
# labelSelector:
# matchLabels:
# app: foo
# matchLabelKeys:
# - pod-template-hash
# containers:
# - name: nginx
# image: nginx
# - name: redis
# env:
# - name: test
# value: test
# terminationGracePeriodSeconds: 10
13 changes: 13 additions & 0 deletions config/samples/robin-debug/kustomization.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

patches:
- path: ./robin-patch.yaml
target:
kind: RedKeyCluster
name: redis-cluster-ephemeral

resources:
- ../ephemeral

namespace: redkey-operator
17 changes: 17 additions & 0 deletions config/samples/robin-debug/robin-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- op: add
path: /spec/robin/template/spec/containers/0/command
value:
- "sleep"
- "18000"
- op: replace
path: /spec/robin/template/spec/containers/0/imagePullPolicy
value: Always
- op: add
path: /spec/robin/template/spec/containers/0/ports
value:
- containerPort: 8080
name: prometheus
protocol: TCP
- containerPort: 40000
name: debug
protocol: TCP
3 changes: 3 additions & 0 deletions debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ FROM golang:1.24.6

RUN go install github.com/go-delve/delve/cmd/dlv@v1.25

# Install redis-cli by adding the redis package (required to debug Redkey Robin)
RUN apt update -y && apt install -y redis-tools curl procps

WORKDIR /
EXPOSE 40000