
This change enables compatibility with the Kubernetes server version when using the remote CLI by matching the kubectl client version accordingly. Currently, the stx-platformclients image includes only the minimum Kubernetes version supported by StarlingX. This enhancement introduces a new script included in the stx-platformclients image during its build process. The script gets the Kubernetes server version every 30 minutes and dynamically selects the appropriate kubectl binary version to execute commands. The script handles any of Kubernetes server versions: - If the server version is lower than the minimum version available in the image, it uses as default the minimum k8s available version. - If the server version is higher than the maximum version available in the image, it uses as default the maximum k8s available version. - If the server version is within the available range, it uses the exact the k8s server version. Examples: - Using a 1.26.1 Kubernetes server with a stx-platformclients image supporting versions from 1.29.2 to 1.32.2 (use the minimum k8s available version): $ kubectl version [WARN] Detected a mismatch between Kubernetes client and server versions. [WARN] Continuing with client version v1.29.2 and server version v1.26.1. Client Version: v1.29.2 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.26.1 WARNING: version difference between client (1.29) and server (1.26) exceeds the supported minor version skew of +/-1 - Using a 1.31.5 Kubernetes server with a stx-platformclients image supporting versions from 1.24.4 to 1.30.6 (use the maximum k8s available version): $ kubectl version [WARN] Detected a mismatch between Kubernetes client and server versions. [WARN] Continuing with client version v1.30.6 and server version v1.31.5. Client Version: v1.30.6 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 Server Version: v1.31.5 - Using a 1.31.5 Kubernetes server with a stx-platformclients image supporting versions from 1.29.2 to 1.32.2 (use the exact k8s server version): $ kubectl version Client Version: v1.31.5 Kustomize Version: v5.4.2 Server Version: v1.31.5 The changes include a new package (vim) to allow using 'kubectl edit' command using remote-cli, which was not possible before because stx-platformclients did not have any text editor. The stable_docker_image file must be updated every time StarlingX updates its supported Kubernetes versions to ensure the user will not see WARN messages when using remote-cli. TEST PLAN: - PASS: Execute kubectl commands - PASS: Check if the script supports to use special characters Notes: - The tests were executed in an environment with the following k8s server versions: 1.24.4, 1.25.4, 1.26.1, 1.27.5, 1.28.4, 1.29.2, 1.30.6 and 1.31.5 - The second test from the test plan (about special characters) was executed using changes in the remote-cli repo to parse the special characters correctly into the Docker image Closes-Bug: 2112129 Change-Id: I2fe1e5b36be0f20862be165c730248d3f22cdecf Signed-off-by: Gustavo Ornaghi Antunes <gustavo.ornaghiantunes@windriver.com>
stx-upstream
StarlingX Upstream Packages
Description
Languages
Python
52.6%
Shell
42.8%
BitBake
4.1%
POV-Ray SDL
0.5%