Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add state flag file in K8s upgrades (#2702) #2766

Merged
merged 8 commits into from
Jan 10, 2022

Conversation

cicharka
Copy link
Contributor

@cicharka cicharka commented Dec 1, 2021

  • it is based on solution under upgrade/tasks/kafka.yml
  • added usage of update flag for masters and nodes - having single
    flag file for both was introducing malfunction (incomplete master
    upgrade flag was removed by tasks in nodes block)
  • 'Switch apiserver address to local' task is now executed before the
    upgrade procedure in order to correctly fetch versions of particular
    masters - without it procedure for some masters could be skipped,
    because fetched version didn't match host it tried to upgrade
  • separate get and set cluster version tasks
  • introduce initial_cluster_version used to evaluate need of
    an upgrade

Tested on cluster (Ubuntu machines) containing:

  1. three k8s masters and three k8s nodes (HA) (upgrade from v1.0.1 to v1.3.0)

@cicharka cicharka changed the title ansible: add state flag file in k8s upgrades add state flag file in k8s upgrades Dec 1, 2021
@cicharka cicharka changed the title add state flag file in k8s upgrades #2702 add state flag file in k8s upgrades Dec 1, 2021
@cicharka cicharka changed the title #2702 add state flag file in k8s upgrades add state flag file in k8s upgrades (#2702) Dec 1, 2021
seriva
seriva previously approved these changes Dec 6, 2021
Copy link
Contributor

@atsikham atsikham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked creation of files for each incremental upgrade?

@atsikham
Copy link
Contributor

atsikham commented Dec 9, 2021

Just FYI, this PR should fix such issue that I met recently.

TASK [upgrade : k8s/install | Install kubeadm 1.20.12 package for Debian family] *************************************************************************
fatal: [ec2-18-212-2-237.compute-1.amazonaws.com]: FAILED! => {"cache_update_time": 1639014589, "cache_updated": true, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'kubeadm=1.20.12-00' 'kubelet=1.20.12-00'' failed: E: Packages were downgraded and -y was used without --allow-downgrades.\n", "rc": 100, "stderr": "E: Packages were downgraded and -y was used without --allow-downgrades.\n", "stderr_lines": ["E: Packages were downgraded and -y was used without --allow-downgrades."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following packages will be DOWNGRADED:\n  kubeadm kubelet\n0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 56 not upgraded.\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following packages will be DOWNGRADED:", "  kubeadm kubelet", "0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 56 not upgraded."]}

@cicharka cicharka marked this pull request as draft December 9, 2021 07:45
@cicharka
Copy link
Contributor Author

cicharka commented Dec 9, 2021

Just FYI, this PR should fix such issue that I met recently.

TASK [upgrade : k8s/install | Install kubeadm 1.20.12 package for Debian family] *************************************************************************
fatal: [ec2-18-212-2-237.compute-1.amazonaws.com]: FAILED! => {"cache_update_time": 1639014589, "cache_updated": true, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'kubeadm=1.20.12-00' 'kubelet=1.20.12-00'' failed: E: Packages were downgraded and -y was used without --allow-downgrades.\n", "rc": 100, "stderr": "E: Packages were downgraded and -y was used without --allow-downgrades.\n", "stderr_lines": ["E: Packages were downgraded and -y was used without --allow-downgrades."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following packages will be DOWNGRADED:\n  kubeadm kubelet\n0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 56 not upgraded.\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following packages will be DOWNGRADED:", "  kubeadm kubelet", "0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 56 not upgraded."]}

@atsikham I have not faced issue like that before, do you remember the way to reproduce it so I will be able to verify?

@atsikham
Copy link
Contributor

atsikham commented Dec 9, 2021

Just FYI, this PR should fix such issue that I met recently.

TASK [upgrade : k8s/install | Install kubeadm 1.20.12 package for Debian family] *************************************************************************
fatal: [ec2-18-212-2-237.compute-1.amazonaws.com]: FAILED! => {"cache_update_time": 1639014589, "cache_updated": true, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'kubeadm=1.20.12-00' 'kubelet=1.20.12-00'' failed: E: Packages were downgraded and -y was used without --allow-downgrades.\n", "rc": 100, "stderr": "E: Packages were downgraded and -y was used without --allow-downgrades.\n", "stderr_lines": ["E: Packages were downgraded and -y was used without --allow-downgrades."], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following packages will be DOWNGRADED:\n  kubeadm kubelet\n0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 56 not upgraded.\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following packages will be DOWNGRADED:", "  kubeadm kubelet", "0 upgraded, 0 newly installed, 2 downgraded, 0 to remove and 56 not upgraded."]}

@atsikham I have not faced issue like that before, do you remember the way to reproduce it so I will be able to verify?

To reproduce that you need to run K8s upgrade on Ubuntu, interrupt that after the new kubeadm package is installed, and then run again.

@cicharka cicharka marked this pull request as ready for review December 10, 2021 07:59
atsikham
atsikham previously approved these changes Dec 17, 2021
@cicharka cicharka force-pushed the feature/k8s_upgrade_flag branch from ba67baa to 33e6a51 Compare December 21, 2021 11:13
@cicharka cicharka marked this pull request as draft December 22, 2021 09:35
@cicharka cicharka marked this pull request as ready for review December 27, 2021 08:24
@cicharka cicharka force-pushed the feature/k8s_upgrade_flag branch from 65450f4 to 3f676ab Compare December 27, 2021 08:31
@cicharka cicharka marked this pull request as draft December 27, 2021 13:09
@cicharka cicharka changed the title add state flag file in k8s upgrades (#2702) add state flag file in K8s upgrades (#2702) Dec 28, 2021
@cicharka cicharka force-pushed the feature/k8s_upgrade_flag branch from 3f676ab to f3641be Compare December 29, 2021 07:06
@cicharka cicharka marked this pull request as ready for review December 29, 2021 07:11
@cicharka cicharka force-pushed the feature/k8s_upgrade_flag branch from f3641be to a82b85b Compare December 29, 2021 07:16
@cicharka cicharka force-pushed the feature/k8s_upgrade_flag branch from a82b85b to 8039af8 Compare December 29, 2021 07:21
@cicharka cicharka requested a review from atsikham December 29, 2021 07:28
@cicharka cicharka requested review from atsikham and to-bar December 29, 2021 14:25
atsikham
atsikham previously approved these changes Dec 29, 2021
* Replace touch module with copy

Signed-off-by: cicharka <[email protected]>
With new approach we are going to check cluster version on
each master, so it will not skip upgrade masters block if first
master was already upgraded.

Signed-off-by: cicharka <[email protected]>
* added usage of update flag for masters and nodes - having single
  flag file for both was introducing malfunction (incomplete master
  upgrade flag was removed by tasks in nodes block)

* 'Switch apiserver address to local' task is now executed before the
  upgrade procedure in order to correctly fetch versions of particular
  masters - without it procedure for some masters could be skipped,
  because fetched version didn't match host it tried to upgrade

Signed-off-by: cicharka <[email protected]>
* introduce initial_cluster_version used to evaluate need of
  an upgrade

Signed-off-by: cicharka <[email protected]>
atsikham
atsikham previously approved these changes Jan 3, 2022
seriva
seriva previously approved these changes Jan 3, 2022
@erzetpe
Copy link
Contributor

erzetpe commented Jan 3, 2022

/azp run

@erzetpe
Copy link
Contributor

erzetpe commented Jan 10, 2022

Tests passed on Ubuntu 18.04 LTS and Red Hat 7.8.

@cicharka cicharka merged commit 5a62ac2 into hitachienergy:develop Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants