App w/ "timing: pre" updating when new version does not support current k8s version

Bug #2069907 reported by Igor Pires Soares
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Undecided
Unassigned

Bug Description

Brief Description
-----------------
When doing a k8s upgrade, an app that has a new version in the /usr/local/share/applications/helm directory is updated in the kube-pre-upgrade-apps step when the new version is not compatible with the current k8s version, before the upgrade.

Severity
-----------------
Minor: System/Feature is usable with minor issue

Steps to Reproduce
-----------------
check current k8s version
[sysadmin@controller-0 ~(keystone_admin)]$ system kube-version-list
+---------+--------+-------------+
| version | target | state       |
+---------+--------+-------------+
| v1.24.4 | False  | unavailable |
| v1.25.3 | False  | unavailable |
| v1.26.1 | True   | active      |
| v1.27.5 | False  | available   |
| v1.28.4 | False  | available   |
| v1.29.2 | False  | available   |
+---------+--------+-------------+
create an app or update the metadata of an available app, e.g : metrics-server:
metadata:
app_name: metrics-server
app_version: 24.09-54
helm_repo: stx-platform
maintain_user_overrides: true
upgrades:
   auto_update: true
k8s_upgrades:
   auto_update: true
   timing: pre
supported_k8s_version:
  minimum: 1.24.4
  maximum: 1.27.5
behavior:
  platform_managed_app: yes

upload and apply the app
create an updated version of the same app with timing: pre in the metadata and the minimum supported_k8s_version is the intended upgrade:
metadata:
app_name: metrics-server
app_version: 24.09-55
helm_repo: stx-platform
maintain_user_overrides: true
upgrades:
  auto_update: true
k8s_upgrades:
  auto_update: true
  timing: pre
supported_k8s_version:
  minimum: 1.27.5
behavior:
  platform_managed_app: yes

start a k8s upgrade to the intended version, 1.27.5 in this scenario
system kube-upgrade-start v1.27.5
system kube-pre-application-update

Expected Behavior
-----------------
app should not update

Actual Behavior
-----------------
app is updated to the newer version

Reproducibility
-----------------
Reproducible

System Configuration
-----------------
AIO-SX

Load info (eg: 2022-03-10_20-00-07)

sysadmin@controller-0:~$ cat /etc/build.info
SW_VERSION="24.09"
BUILD_TARGET="Host Installer"
BUILD_TYPE="Formal"
BUILD_ID="2024-06-04_19-00-21"
SRC_BUILD_ID="2026"JOB="master-debian"
BUILD_BY="jenkins"
BUILD_NUMBER="769"
BUILD_DATE="2024-06-04 23:00:21 +0000"

Last Pass
-----------------
N/A

Timestamp/Logs
-----------------
some upgrade logs:

Every 2.0s: system kube-upgrade-show  controller-0: Fri Jun  7 17:20:18 2024+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| uuid         | 340d8ec6-6d86-4f5b-a64a-4016fa075b9a |
| from_version | v1.26.1                              |
| to_version   | v1.27.5                              |
| state        | pre-updated-apps                     |
| created_at   | 2024-06-07T17:15:54.035101+00:00     |
| updated_at   | 2024-06-07T17:19:39.102865+00:00     |
+--------------+--------------------------------------+

  | metrics-server           | 24.09-55  | metrics-server-fluxcd-manifests
       | fluxcd-manifests | applied  | Application update from version 24.09
-54 to version 24.09-55 completed. |[sysadmin@controller-0 post(keystone_admin)]$ watch system kube-upgrade-show
[sysadmin@controller-0 post(keystone_admin)]$ watch system kube-upgrade-show
[sysadmin@controller-0 post(keystone_admin)]$ system kube-upgrade-abort
+--------------+--------------------------------------+
| Property     | Value                                |
+--------------+--------------------------------------+
| uuid         | 340d8ec6-6d86-4f5b-a64a-4016fa075b9a |
| from_version | v1.26.1                              |
| to_version   | v1.27.5                              |
| state        | upgrade-aborted                      |
| created_at   | 2024-06-07T17:15:54.035101+00:00     |
| updated_at   | 2024-06-07T17:19:39.102865+00:00     |
+--------------+--------------------------------------+

Alarms
-----------------
N/A

Test Activity
-----------------
Feature Testing

Workaround
-----------------
N/A

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.opendev.org/c/starlingx/config/+/922257
Committed: https://opendev.org/starlingx/config/commit/8c3a6a99ed359f637605befac33ea593b681693b
Submitter: "Zuul (22348)"
Branch: master

commit 8c3a6a99ed359f637605befac33ea593b681693b
Author: Igor Soares <email address hidden>
Date: Tue Jun 18 18:47:11 2024 -0300

    Check current k8s version during pre app update

    Prevent apps from being updated to incompatible versions at the
    pre-update step during Kubernetes upgrades.

    This fixes a bug that would allow apps with 'timing: pre' in their
    metadata to be updated even when the running Kubernetes version is
    not supported by the application.

    Test plan:
    PASS: build-pkgs && build-image
    PASS: Kubernetes upgrade with no apps available to be updated.
    PASS: Create two bundles of the snmp app with 'timing: pre', both
          compatible with the current and target Kubernetes versions.
          Upload/apply the first bundle.
          Perform Kubernetes upgrade
          Confirm that app successfully updates during the
          kube-pre-application update step.
    PASS: Create two bundles of the snmp app with 'timing: pre'. The first
          one compatible with the current and target Kubernetes versions,
          the second one incompatible with the current version and
          compatible with the target version.
          Upload/apply the first bundle.
          Confirm that the app does not update during the
          kube-pre-application update step.

    Closes-bug: 2069907

    Change-Id: I9bc451c14cbac888415a2b15b743db20c16847cf
    Signed-off-by: Igor Soares <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.