epiphany icon indicating copy to clipboard operation
epiphany copied to clipboard

[FEATURE REQUEST] Refactor `containerd` role upgrade tasks

Open cicharka opened this issue 2 years ago • 0 comments

Currently containerd upgrade tasks are reusing some of the kubernetes upgrade tasks, also some of them are partially duplicated.

See ansible/playbooks/roles/containerd/tasks/upgrade/main.yml, that's the file where these tasks are imported/included:

- name: Patch stateful apps
  include_tasks: upgrade/patch-statesfulset.yml
...
- name: Drain nodes in preparation for maintenance
  include_tasks: upgrade/drain-nodes.yml
...
- name: Wait for cluster's readiness
  include_role:
    name: upgrade
    tasks_from: kubernetes/utils/wait.yml
...
- name: Uncordon master or node - mark as schedulable
  include_role:
    name: upgrade
    tasks_from: kubernetes/utils/uncordon.yml

As a solution these tasks should be moved to common kubernetes utils that will be used later in both: containerd and kubernetes upgrade roles.

Another point is related to the handlers in containerd role, see ansible/playbooks/roles/containerd/tasks/upgrade/main.yml:

# There are already bandlers responsible for restart of these services however it is required
# to restart them earlier, before uncordoning the hosts
- name: Restart containerd
  systemd:
    name: containerd
    state: restarted
    enabled: true

- name: Restart kubelet
  systemd:
    name: kubelet
    state: restarted
    enabled: true

These handlers/tasks also should be refactored in order to provide better code reusability.

If possible - include also upgrade status flag file that will be used in case of interrupted upgrade procedure.

Additional context This task can be also related to the refactoring of kubernetes upgrade (moving its upgrade from upgrade role to kubernetes role).


DoD checklist

  • Changelog
    • [ ] updated
    • [ ] not needed
  • COMPONENTS.md
    • [ ] updated
    • [ ] not needed
  • Schema
    • [ ] updated
    • [ ] not needed
  • Backport tasks
    • [ ] created
    • [ ] not needed
  • Documentation
    • [ ] added
    • [ ] updated
    • [ ] not needed
  • [ ] Feature has automated tests
  • [ ] Automated tests passed (QA pipelines)
    • [ ] apply
    • [ ] upgrade
    • [ ] backup/restore
  • [ ] Idempotency tested
  • [ ] All conversations in PR resolved
  • [ ] Solution meets requirements and is done according to design doc
  • [ ] Usage compliant with license

cicharka avatar Mar 30 '22 09:03 cicharka