Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add short options for kernel and os versions #255

Closed
wants to merge 1 commit into from

Conversation

Callisto13
Copy link
Member

@Callisto13 Callisto13 commented Jan 9, 2023

This change makes it easier/lazier for people to configure their kernel
and os images. If users do not care about the specifics, and do not need
to bring custom images, they can simply set the following:

In the manifest:

---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: MicrovmMachineTemplate
spec:
  template:
    spec:
      kernelVersion: "${KERNEL_VERSION}"
      osVersion: "${OS_VERSION}"
      ...

Via the command line:

export KERNEL_VERSION=5.10.77
export OS_VERSION="${KUBERNETES_VERSION#*v}" # they already set this anyway

And we work out the rest. Long form, this is:

---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: MicrovmMachineTemplate
spec:
  template:
    spec:
      rootVolume:
        id: root
        image: "${MVM_ROOT_IMAGE:=ghcr.io/weaveworks-liquidmetal/capmvm-kubernetes:1.23.5}"
      kernel:
        filename: "boot/vmlinux"
        image: "${MVM_KERNEL_IMAGE:=ghcr.io/weaveworks-liquidmetal/kernel-bin:5.10.77}"
      additionalVolumes:
      - id: modules
        image: "${MVM_KERNEL_MODULES_IMAGE:=ghcr.io/weaveworks-liquidmetal/kernel-modules:5.10.77}"
        mountPoint: /lib/modules

Or via env vars:

export MVM_ROOT_IMAGE=docker.io/richardcase/ubuntu-bionic-test:cloudimage_v0.0.1
export MVM_KERNEL_IMAGE=docker.io/richardcase/ubuntu-bionic-kernel:0.0.11
export MVM_KERNEL_MODULES_IMAGE=ghcr.io/weaveworks-liquidmetal/kernel-modules:5.10.77

The previously existing fields will continue to exist and can be used if desired.

If both the short form options and the long-form fields are set, the
short-form values are what will be used. (Or I can make it the long-form
whichever people prefer.)

The previously required kernel and root volume fields are now optional so, the machine webhook has been updated to ensure that at least one of the options are provided.

Part of liquidmetal-dev/image-builder#49

Depends on liquidmetal-dev/controller-pkg#3 and liquidmetal-dev/controller-pkg#2 requiring a mod bump here after those 2 are merged.

The previous commit made these fields optional, but we need to verify
that at least some kernel and root volume information is set.

This validation will check whether the short syntax for kernel and root
volume config are set, and if not, will validate that long syntax fields
are provided. Errors are returned if not.

Also add new `OS_VERSION` and `KERNEL_VERSION` fields to templates.
@Callisto13
Copy link
Member Author

Closing as I changed my mind liquidmetal-dev/controller-pkg#3

@Callisto13 Callisto13 closed this May 31, 2023
@Callisto13 Callisto13 deleted the nice-image-names branch May 31, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to give shorter image/version names for flintlock spec
1 participant