Skip to content

Commit

Permalink
fix redis
Browse files Browse the repository at this point in the history
  • Loading branch information
Sispheor committed Dec 11, 2023
1 parent b93724b commit 57ff740
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 11 deletions.
23 changes: 12 additions & 11 deletions k8s/inventory/group_vars/all/squest.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# Kubernetes
k8s_kubeconfig_path: "/home/nico/Documents/tools4ocp-clusters/talos-test.k8s.glabs.hpecorp.net/kubeconfig"
k8s_cluster_fqdn: "talos-test.k8s.glabs.hpecorp.net"
#k8s_kubeconfig_path: "/path/to/kubeconfig"
#k8s_cluster_fqdn: k8s.domain.local
k8s_kubeconfig_path: "/path/to/kubeconfig"
k8s_cluster_fqdn: "k8s.domain.local"
squest_namespace: "squest"
k8s_storage_class: "thin"


# DATABASE
squest_db:
database: "squest_db"
Expand Down Expand Up @@ -36,9 +33,12 @@ squest_rabbitmq:
user: rabbitmq
password: rabbitmq

squest_redis:
password: redis_secret_password

# Django
squest_django:
image: "quay.io/hewlettpackardenterprise/squest:dev"
image: "quay.io/hewlettpackardenterprise/squest:latest"
ingress:
enabled: true
host: "squest.{{ k8s_cluster_fqdn }}"
Expand All @@ -52,17 +52,18 @@ squest_django:
TZ: "Europe/Paris"
DB_HOST: "mariadb"
DB_PORT: "3306"
REDIS_CACHE_HOST: "redis"
REDIS_CACHE_HOST: "rfrm-redis"
DEBUG: "true"
DB_USER: "{{ squest_db.user }}"
DB_PASSWORD: "{{ squest_db.password }}"
WAIT_HOSTS: "mariadb:3306,rabbitmq:5672"
backup:
enabled: true
enabled: false
crontab: "0 1 * * *"
externalize_backup_via_rsync:
enabled: true
enabled: false
crontab: "30 1 * * *"
private_ssh_key: "{{ lookup('file', '/home/nico/Desktop/id_ed25519_squest_k8s_dev') + '\n' }}"
private_ssh_key: "{{ lookup('file', '/path/to/id_ed25519_squest_k8s_dev') + '\n' }}"
ssh_user: "squest_k8s_dev"
ssh_server: "siam017.gre.hpecorp.net"
ssh_server: "remote.server.ssh.net"
remote_path: "/backup/squest_k8s_dev/"
15 changes: 15 additions & 0 deletions k8s/squest_k8s/tasks/02-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@
periodSeconds: 10
timeoutSeconds: 5

- name: Wait until MariaDB deployment available
kubernetes.core.k8s_info:
kubeconfig: "{{ k8s_kubeconfig_path }}"
api_version: "mariadb.mmontes.io/v1alpha1"
kind: "MariaDB"
name: "mariadb"
namespace: "{{ squest_namespace }}"
wait: yes
wait_sleep: 10
wait_timeout: 600
wait_condition:
type: Ready
status: "True"


- when: squest_phpmyadmin.enabled
block:
- name: Deploy PHPMyAdmin configmap environment
Expand Down
27 changes: 27 additions & 0 deletions k8s/squest_k8s/tasks/04-redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@
type: Available
status: "True"

- name: Redis password secret
kubernetes.core.k8s:
kubeconfig: "{{ k8s_kubeconfig_path }}"
state: present
namespace: "{{ squest_namespace }}"
definition:
apiVersion: v1
kind: Secret
metadata:
name: redis-password
labels:
app: squest
service: redis
type: Opaque
stringData:
password: "{{ squest_redis.password }}"

- name: Deploy Redis
kubernetes.core.k8s:
kubeconfig: "{{ k8s_kubeconfig_path }}"
Expand All @@ -52,6 +69,8 @@
app: squest
service: redis
spec:
auth:
secretPath: redis-password
sentinel:
replicas: 3
resources:
Expand All @@ -60,7 +79,15 @@
limits:
memory: 100Mi
redis:
# env:
# - name: REDIS_PASSWORD
# value: "{{ squest_redis.password }}"
replicas: 3
# extraVolumes:
# - name: redis-password
# secret:
# secretName: redis-user-secret
# optional: false
resources:
requests:
cpu: 100m
Expand Down
14 changes: 14 additions & 0 deletions k8s/squest_k8s/tasks/05-django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@
persistentVolumeClaim:
claimName: django-static

- name: Wait until migration job done
kubernetes.core.k8s_info:
kubeconfig: "{{ k8s_kubeconfig_path }}"
api_version: "batch/v1"
kind: Job
name: "django-migrations"
namespace: "{{ squest_namespace }}"
wait: yes
wait_sleep: 10
wait_timeout: 600
wait_condition:
type: Complete
status: "True"

- name: Nginx config
kubernetes.core.k8s:
kubeconfig: "{{ k8s_kubeconfig_path }}"
Expand Down
1 change: 1 addition & 0 deletions k8s/squest_k8s/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
kind: Namespace
metadata:
name: "{{ squest_namespace }}"
tags: ["namespace"]

- name: K8S utils
ansible.builtin.include_tasks:
Expand Down

0 comments on commit 57ff740

Please sign in to comment.