diff --git a/assets/components/lvms/topolvm-configmap_lvms-version.yaml b/assets/components/lvms/topolvm-configmap_lvms-version.yaml new file mode 100644 index 0000000000..2038036e64 --- /dev/null +++ b/assets/components/lvms/topolvm-configmap_lvms-version.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: lvms-version + namespace: kube-public +data: + version: v4.14.0-10 diff --git a/docs/contributor/storage/default_csi_plugin.md b/docs/contributor/storage/default_csi_plugin.md index 8300fafdd1..695950a365 100644 --- a/docs/contributor/storage/default_csi_plugin.md +++ b/docs/contributor/storage/default_csi_plugin.md @@ -270,4 +270,18 @@ Once the new pod enters the Running state, verify that the data we wrote early w ```shell oc exec base -- cat /data/demo.txt FOOBAR +``` + +# LVMS Versioning + +LVMS is released at a different cadence that MicroShift and is not couple to the MicroShift version. This is primarily +because LVMS is a subcomponent of MicroShift and deployed as a workload on the cluster. The version of LVMS is tracked +by image tag, with only the major version correlating the major MicroShift version. + +The LVMS version is not exposed by LVMS itself. For troubleshooting purposes, MicroShift exposes the LVMS version +via a configmap in the `kube-public` namespace. To get the LVMS version, run the following command: + +```shell +$ oc get configmap -n kube-public lvms-version -o jsonpath='{.data.version}' +v4.14.0-10 ``` \ No newline at end of file diff --git a/docs/user/debugging_tips.md b/docs/user/debugging_tips.md index 8ec46295b9..7ac1527833 100644 --- a/docs/user/debugging_tips.md +++ b/docs/user/debugging_tips.md @@ -28,6 +28,14 @@ metadata: namespace: kube-public ``` +## Checking the LVMS Version + +Like the MicroShift version, the LVM version is available via a configmap. To get the version, run: + +```bash +$ oc get configmap -n openshift-storage lvms-version -ojsonpath='{.data.version}' +``` + ## Generating an SOS Report The MicroShift RPMs have an explicit dependency on the `sos` utility allowing to collect diff --git a/pkg/components/storage.go b/pkg/components/storage.go index 44c634770e..8cd4c290af 100644 --- a/pkg/components/storage.go +++ b/pkg/components/storage.go @@ -53,8 +53,9 @@ func startCSIPlugin(ctx context.Context, cfg *config.Config, kubeconfigPath stri cd = []string{ "components/lvms/csi-driver.yaml", } - cm = "components/lvms/topolvm-lvmd-config_configmap_v1.yaml" - ds = []string{ + cm = "components/lvms/topolvm-lvmd-config_configmap_v1.yaml" + cm_ver = "components/lvms/topolvm-configmap_lvms-version.yaml" + ds = []string{ "components/lvms/topolvm-node_daemonset.yaml", } deploy = []string{ @@ -124,6 +125,10 @@ func startCSIPlugin(ctx context.Context, cfg *config.Config, kubeconfigPath stri klog.Warningf("Failed to apply configMap %v: %v", crb, err) return err } + if err := assets.ApplyConfigMaps(ctx, []string{cm_ver}, nil, nil, kubeconfigPath); err != nil { + klog.Warningf("Failed to apply configMap %v: %v", crb, err) + return err + } if err := assets.ApplyDeployments(ctx, deploy, renderTemplate, renderParamsFromConfig(cfg, nil), kubeconfigPath); err != nil { klog.Warningf("Failed to apply deployment %v: %v", deploy, err) return err diff --git a/scripts/auto-rebase/lvms_assets.yaml b/scripts/auto-rebase/lvms_assets.yaml index aec2d8d64a..c9a7e18989 100644 --- a/scripts/auto-rebase/lvms_assets.yaml +++ b/scripts/auto-rebase/lvms_assets.yaml @@ -31,3 +31,5 @@ assets: ignore: "provided by MicroShift" - file: topolvm_default-storage-class.yaml ignore: "provided by MicroShift" + - file: topolvm-configmap_lvms-version.yaml + ignore: "provided by MicroShift" diff --git a/scripts/auto-rebase/rebase-lvms.sh b/scripts/auto-rebase/rebase-lvms.sh index a57466fd49..b2da40172b 100755 --- a/scripts/auto-rebase/rebase-lvms.sh +++ b/scripts/auto-rebase/rebase-lvms.sh @@ -16,6 +16,31 @@ PULL_SECRET_FILE="${HOME}/.pull-secret.json" declare -a ARCHS=("amd64" "arm64") declare -A GOARCH_TO_UNAME_MAP=( ["amd64"]="x86_64" ["arm64"]="aarch64" ) +VER_FILE="${STAGING_DIR}/lvms/version" + +dump_version(){ + local version="${1}" + echo "${version}" > "${VER_FILE}" +} + +load_version(){ + if [ -f "${VER_FILE}" ]; then + cat "${VER_FILE}" + else + >&2 echo "error: version file not found at ${VER_FILE}" + fi +} + +parse_version(){ + local image_tag="$1" + local v + v="${image_tag#*:}" + if [ -z "${v}" ]; then + >&2 echo "error: version not found in image tag ${image_tag}" + return 1 + fi +} + title() { echo -e "\E[34m$1\E[00m"; } @@ -81,7 +106,7 @@ rebase_lvms_to() { echo "No changes in LVMS images." fi - update_lvms_manifests + update_lvms_manifests "${lvms_operator_bundle_manifest}" if [[ -n "$(git status -s assets)" ]]; then title "## Committing changes to assets and pkg/assets" git add assets pkg/assets @@ -94,6 +119,24 @@ rebase_lvms_to() { rm -rf "${STAGING_DIR}" } +# create a function to generate a k8s config map with a key-value pair containing a version string +# shellcheck disable=SC2034 # appears unused +generate_version_config_map() { + local version="$1" + local name="$2" + local namespace="$3" + + cat < "${REPOROOT}/assets/components/lvms/topolvm-configmap_lvms-version.yaml" + authentication="" if [ -f "${PULL_SECRET_FILE}" ]; then authentication="--registry-config ${PULL_SECRET_FILE}" @@ -188,14 +240,17 @@ update_lvms_images(){ update_lvms_manifests() { title "Copying LVMS manifests" - local workdir="${STAGING_DIR}/lvms" [ -d "${workdir}" ] || { >&2 echo 'lvms staging dir not found, aborting asset update' return 1 } - "${REPOROOT}/scripts/auto-rebase/handle_assets.py" ./scripts/auto-rebase/lvms_assets.yaml + + local version + version="$(load_version)" + generate_version_config_map "${version}" "lvms-version" "openshift-storage"\ + > "${REPOROOT}/assets/components/lvms/topolvm-configmap_lvms-version.yaml" } update_last_lvms_rebase() {