Skip to content

Commit

Permalink
chore: use ‹k8s_apply=true› by default
Browse files Browse the repository at this point in the history
• Summary

Initially I wanted to do ‹k8s_apply=false› for postgres, and key-value
databases (such as Redis, Redict, or Valkey), because deploying on prod
with ‹k8s_apply=true› caused redeployment of the postgres which caused
a small outage (~5 minutes).

Right now when I tried to redeploy stage multiple times in a row, none of
the deployed services got redeployed, hence I come to the conclusion that
there were some changes on the production deployment that were applied
back then.

• Context from #360

  · What it actually does?

    In the simple terms, it makes sure that the definition that is to be
    deployed matches the one that is already deployed. The difference has
    already manifested few times, e.g., when @majamassarini was adjusting
    the `/dev/shm` for the postgres deployment (bedef20), the change did
    not get deployed.

  · Why some tasks already use it (e.g., Redis/Redict, Flower secret) and
    others not?

    not sure

  · Would it make sense to default to ‹apply=true›?

    Yes, but at the same time, applying meaningless changes to critical
    services, e.g., postgres or Redis/Redict/Valkey, can cause smaller
    outages.

Fixes #360

Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Oct 2, 2024
1 parent 3da16f2 commit ea14e87
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions playbooks/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
check_vars_template_diff: true
deployment_repo_url: https://github.com/packit/deployment.git
# used by a few tasks below
k8s_apply: false
k8s_apply: true
tokman:
workers: 1
resources:
Expand Down Expand Up @@ -184,8 +184,6 @@
- postgres

- name: Deploy redis
vars:
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/redis.yml.j2') }}"
Expand All @@ -194,8 +192,6 @@
- redis

- name: Deploy redict
vars:
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/redict.yml.j2') }}"
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/deploy/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ check_up_to_date: true # noqa: var-naming[no-role-prefix]
check_vars_template_diff: true # noqa: var-naming[no-role-prefix]
deployment_repo_url: https://github.com/packit/deployment.git # noqa: var-naming[no-role-prefix]
# used by a few tasks below
k8s_apply: false # noqa: var-naming[no-role-prefix]
k8s_apply: true # noqa: var-naming[no-role-prefix]
tokman: # noqa: var-naming[no-role-prefix]
workers: 1
resources:
Expand Down
4 changes: 0 additions & 4 deletions playbooks/roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@
- postgres

- name: Deploy redis
vars:
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/redis.yml.j2') }}"
Expand All @@ -152,8 +150,6 @@
- redis

- name: Deploy redict
vars:
k8s_apply: true
ansible.builtin.include_tasks: tasks/k8s.yml
loop:
- "{{ lookup('template', '{{ project_dir }}/openshift/redict.yml.j2') }}"
Expand Down

0 comments on commit ea14e87

Please sign in to comment.