Skip to content

Commit

Permalink
add operator-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Jan 27, 2024
1 parent b190a03 commit a321aaf
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 21 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,39 +53,39 @@ Use the following commands to test the Redis data:
Check if domain asked to be initialized (response should be = 1)

```
redis-cli exists "hostname:initialize:${DOMAIN}"
docker exec redis redis-cli exists "hostname:initialize:${DOMAIN}"
```

Set domain available

```
redis-cli set "worker:available:${DOMAIN}" ""
docker exec redis redis-cli set "worker:available:${DOMAIN}" ""
```

Set domain internal host name to cwm-worker-test.com (You should also set an internal IP different then 127.0.0.1 for these domains in /etc/hosts)
Set domain internal host name to cwm-worker-test.com (You should also set an internal IP different from 127.0.0.1 for these domains in /etc/hosts)

```
redis-cli set "worker:ingress:hostname:${DOMAIN}" '{"http":"cwm-worker-test-http.com","https":"cwm-worker-test-https.com"}'
docker exec redis redis-cli set "worker:ingress:hostname:${DOMAIN}" '{"http":"cwm-worker-test-http.com","https":"cwm-worker-test-https.com"}'
```

Set domain error

```
redis-cli set "worker:error:${DOMAIN}" ""
docker exec redis redis-cli set "worker:error:${DOMAIN}" ""
```

Set node healthy

```
redis-cli set "node:healthy:testnode0" ""
docker exec redis redis-cli set "node:healthy:testnode0" ""
```

Check node healthy filename exists: `.node_healthy`

Delete node healthy

```
redis-cli del "node:healthy:testnode0"
docker exec redis redis-cli del "node:healthy:testnode0"
```

Check node healthy filename deleted: `.node_healthy`
Expand Down
14 changes: 0 additions & 14 deletions bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,6 @@ if [ "$(uci github actions get-branch-name)" == "main" ]; then
kubectl logs $POD -c vdns
echo "---------------"
[ "${K8S_TESTS_RES}" != "0" ] && echo "K8S_TESTS_RES=$K8S_TESTS_RES" && exit 1
uci git checkout \
--github-repo-name CloudWebManage/cwm-worker-helm \
--branch-name master \
--ssh-key "${CWM_WORKER_HELM_DEPLOY_KEY}" \
--path cwm-worker-helm \
--config-user-name cwm-worker-ingress-ci
sed -i "s/appVersion: latest/appVersion: ${GITHUB_SHA}/g" helm/Chart.yaml
helm package ./helm --version "0.0.0-$(date +%Y%m%dT%H%M%S)" --destination ./cwm-worker-helm/cwm-worker-ingress
helm repo index --url "https://raw.githubusercontent.com/CloudWebManage/cwm-worker-helm/master/cwm-worker-ingress/" \
./cwm-worker-helm/cwm-worker-ingress
cd cwm-worker-helm
git add cwm-worker-ingress
git commit -m "automatic update of cwm-worker-ingress"
git push origin master
fi

exit 0
31 changes: 31 additions & 0 deletions helm/templates/operator-redis-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{ if .Values.operatorRedis.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: cwm-worker-ingress-operator-redis
{{ if .Values.namespace }}namespace: {{ .Values.namespace | quote }}{{ end }}
spec:
minReadySeconds: 5
selector:
matchLabels:
app: cwm-worker-ingress-operator-redis
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
template:
metadata:
labels:
app: cwm-worker-ingress-operator-redis
spec:
{{ if .Values.operatorRedis.nodeSelector }}
nodeSelector: {{ toYaml .Values.operatorRedis.nodeSelector | nindent 8 }}
{{ end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if $.Values.operatorRedis.tolerations }}
tolerations: {{ toYaml $.Values.operatorRedis.tolerations | nindent 8 }}
{{- end }}
automountServiceAccountToken: false
containers:
- name: redis
image: {{ .Values.redis.image | quote }}
imagePullPolicy: {{ .Values.operatorRedis.imagePullPolicy }}
resources: {{ toYaml .Values.operatorRedis.resources | nindent 10 }}
{{ end }}
13 changes: 13 additions & 0 deletions helm/templates/operator-redis-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{ if .Values.operatorRedis.enabled }}
apiVersion: v1
kind: Service
metadata:
name: cwm-worker-ingress-operator-redis
{{ if .Values.namespace }}namespace: {{ .Values.namespace | quote }}{{ end }}
spec:
ports:
- name: "6379"
port: 6379
selector:
app: cwm-worker-ingress-operator-redis
{{ end }}
12 changes: 12 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@ redis:

service:
enabled: true

operatorRedis:
enabled: false
# nodeSelector: {}
# tolerations: []
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: .05
memory: 50Mi
limits:
memory: 200Mi

0 comments on commit a321aaf

Please sign in to comment.