Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions assets/components/lvms/topolvm-configmap_lvms-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: lvms-version
namespace: kube-public
data:
version: v4.14.0-10
14 changes: 14 additions & 0 deletions docs/contributor/storage/default_csi_plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
8 changes: 8 additions & 0 deletions docs/user/debugging_tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions pkg/components/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/auto-rebase/lvms_assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
61 changes: 58 additions & 3 deletions scripts/auto-rebase/rebase-lvms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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
Expand All @@ -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 <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: ${name}
namespace: ${namespace}
data:
version: ${version}
EOF
}

# LVMS is not integrated into the ocp release image, so the work flow does not fit with core component rebase. LVMS'
# operator bundle is the authoritative source for manifest and image digests.
download_lvms_operator_bundle_manifest(){
Expand All @@ -104,6 +147,15 @@ download_lvms_operator_bundle_manifest(){
rm -rf "${LVMS_STAGING}"
mkdir -p "${LVMS_STAGING}"

# Persist the version of the LVMS operator bundle for use in manifest steps
local version
version="$(parse_version "${bundle_manifest}")"
dump_version "${version}"

# Push the configMap to the kube-public namespace so that it is available to all users/apps
generate_version_config_map "${version}" "lvms-version" "kube-public"\
> "${REPOROOT}/assets/components/lvms/topolvm-configmap_lvms-version.yaml"

authentication=""
if [ -f "${PULL_SECRET_FILE}" ]; then
authentication="--registry-config ${PULL_SECRET_FILE}"
Expand Down Expand Up @@ -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() {
Expand Down