Jump to: navigation, search

Difference between revisions of "StarlingX/Containers/K8sUpgradesTesting"

Line 8: Line 8:
 
For example, if the release of StarlingX you are testing is currently using kubernetes v1.16.2, you could build a load using kubernetes v1.16.1.
 
For example, if the release of StarlingX you are testing is currently using kubernetes v1.16.2, you could build a load using kubernetes v1.16.1.
  
=== Building a StarlingX load with a previous kubernetes version ===
+
=== Build a StarlingX load with a previous kubernetes version ===
  
 
The following changes must be made and then a load must be built.
 
The following changes must be made and then a load must be built.
Line 14: Line 14:
 
==== Project: config ====
 
==== Project: config ====
 
File: sysinv/sysinv/sysinv/sysinv/common/kubernetes.py
 
File: sysinv/sysinv/sysinv/sysinv/common/kubernetes.py
* Change get_kube_versions function to specify previous version.
+
* Change get_kube_versions function to specify previous version. If the previous version was v1.16.1 it would look like this:
 +
  def get_kube_versions():
 +
      """Provides a list of supported kubernetes versions."""
 +
      return [
 +
          {'version': 'v1.16.1',
 +
          'upgrade_from': [],
 +
          'downgrade_to': [],
 +
          'applied_patches': [],
 +
          'available_patches': [],
 +
          },
 +
      ]
  
 
==== Project: integ ====
 
==== Project: integ ====
Line 27: Line 37:
 
File: puppet-manifests/src/modules/platform/templates/kubeadm.yaml.erb
 
File: puppet-manifests/src/modules/platform/templates/kubeadm.yaml.erb
 
* Change '''kubernetesVersion''' to previous version.
 
* Change '''kubernetesVersion''' to previous version.
 +
 +
=== Build a set of patches for the new kubernetes version ===
 +
 +
Update get_kube_versions in sysinv/common/kubernetes.py:
 +
 +
==== Project: config ====
 +
File: sysinv/sysinv/sysinv/sysinv/common/kubernetes.py
 +
* Change get_kube_versions function to specify both the old and new version and the patches that will be used for the upgrade. If the previous version was v1.16.1 it would look like this:
 +
  def get_kube_versions():
 +
    return [
 +
        {'version': 'v1.16.1',
 +
        'upgrade_from': [],
 +
        'downgrade_to': [],
 +
        'applied_patches': [],
 +
        'available_patches': [],
 +
        },
 +
        {'version': 'v1.16.2',
 +
        'upgrade_from': ['v1.16.1'],
 +
        'downgrade_to': [],
 +
        'applied_patches': ['KUBE.1'],
 +
        'available_patches': ['KUBE.2'],
 +
        },
 +
    ]
 +
 +
File: sysinv/sysinv/centos/build_srpm.data
 +
* Increment the '''TIS_PATCH_VER'''
 +
 +
==== Project: integ ====
 +
File: kubernetes/kubernetes/centos/build_srpm.data
 +
* Undo change to '''VERSION'''
 +
* Increment the '''TIS_PATCH_VER'''
 +
 +
File: kubernetes/kubernetes/centos/kubernetes.spec
 +
* Undo all changes
 +
 +
==== Build the patches ====
 +
 +
The patches are built from the same workspace used to build the load with the previous kubernetes version.
 +
 +
First build the updated RPMS:
 +
  # Build packages
 +
  cd $MY_WORKSPACE
 +
  build-pkgs --no-build-info --no-descendants sysinv
 +
  build-pkgs --no-build-info --no-descendants kubernetes

Revision as of 19:05, 27 January 2020

Testing Kubernetes Upgrades

In order to test a kubernetes upgrade, the recommended approach is to:

  • Build a StarlingX load with a previous kubernetes version
  • Build a set of patches for the new kubernetes version
  • Install the load and perform the upgrade

For example, if the release of StarlingX you are testing is currently using kubernetes v1.16.2, you could build a load using kubernetes v1.16.1.

Build a StarlingX load with a previous kubernetes version

The following changes must be made and then a load must be built.

Project: config

File: sysinv/sysinv/sysinv/sysinv/common/kubernetes.py

  • Change get_kube_versions function to specify previous version. If the previous version was v1.16.1 it would look like this:
 def get_kube_versions():
     """Provides a list of supported kubernetes versions."""
     return [
         {'version': 'v1.16.1',
          'upgrade_from': [],
          'downgrade_to': [],
          'applied_patches': [],
          'available_patches': [],
          },
     ]

Project: integ

File: kubernetes/kubernetes/centos/build_srpm.data

  • Change VERSION to previous version.

File: kubernetes/kubernetes/centos/kubernetes.spec

  • Change %global commit to previous version.
  • Change %global kube_version to previous version.

Project: stx-puppet

File: puppet-manifests/src/modules/platform/templates/kubeadm.yaml.erb

  • Change kubernetesVersion to previous version.

Build a set of patches for the new kubernetes version

Update get_kube_versions in sysinv/common/kubernetes.py:

Project: config

File: sysinv/sysinv/sysinv/sysinv/common/kubernetes.py

  • Change get_kube_versions function to specify both the old and new version and the patches that will be used for the upgrade. If the previous version was v1.16.1 it would look like this:
 def get_kube_versions():
   return [
       {'version': 'v1.16.1',
        'upgrade_from': [],
        'downgrade_to': [],
        'applied_patches': [],
        'available_patches': [],
        },
       {'version': 'v1.16.2',
        'upgrade_from': ['v1.16.1'],
        'downgrade_to': [],
        'applied_patches': ['KUBE.1'],
        'available_patches': ['KUBE.2'],
        },
   ]

File: sysinv/sysinv/centos/build_srpm.data

  • Increment the TIS_PATCH_VER

Project: integ

File: kubernetes/kubernetes/centos/build_srpm.data

  • Undo change to VERSION
  • Increment the TIS_PATCH_VER

File: kubernetes/kubernetes/centos/kubernetes.spec

  • Undo all changes

Build the patches

The patches are built from the same workspace used to build the load with the previous kubernetes version.

First build the updated RPMS:

 # Build packages
 cd $MY_WORKSPACE
 build-pkgs --no-build-info --no-descendants sysinv
 build-pkgs --no-build-info --no-descendants kubernetes