From a321aafb165ece5a4c7bd8673a16db52757a352a Mon Sep 17 00:00:00 2001 From: Ori Hoch Date: Sat, 27 Jan 2024 21:55:18 +0200 Subject: [PATCH] add operator-redis --- README.md | 14 ++++----- bin/ci.sh | 14 --------- helm/templates/operator-redis-deployment.yaml | 31 +++++++++++++++++++ helm/templates/operator-redis-service.yaml | 13 ++++++++ helm/values.yaml | 12 +++++++ 5 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 helm/templates/operator-redis-deployment.yaml create mode 100644 helm/templates/operator-redis-service.yaml diff --git a/README.md b/README.md index 242ec46..ecb449c 100644 --- a/README.md +++ b/README.md @@ -53,31 +53,31 @@ 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` @@ -85,7 +85,7 @@ 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` diff --git a/bin/ci.sh b/bin/ci.sh index 7c69840..08cdf9f 100755 --- a/bin/ci.sh +++ b/bin/ci.sh @@ -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 diff --git a/helm/templates/operator-redis-deployment.yaml b/helm/templates/operator-redis-deployment.yaml new file mode 100644 index 0000000..f15bc63 --- /dev/null +++ b/helm/templates/operator-redis-deployment.yaml @@ -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 }} diff --git a/helm/templates/operator-redis-service.yaml b/helm/templates/operator-redis-service.yaml new file mode 100644 index 0000000..535dcf0 --- /dev/null +++ b/helm/templates/operator-redis-service.yaml @@ -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 }} diff --git a/helm/values.yaml b/helm/values.yaml index 0ada092..0768e09 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -68,3 +68,15 @@ redis: service: enabled: true + +operatorRedis: + enabled: false + # nodeSelector: {} + # tolerations: [] + imagePullPolicy: IfNotPresent + resources: + requests: + cpu: .05 + memory: 50Mi + limits: + memory: 200Mi