kubernetes-sigs / cluster-api

Home for Cluster API, a subproject of sig-cluster-lifecycle
https://cluster-api.sigs.k8s.io
Apache License 2.0
3.59k stars 1.32k forks source link

Allow diskSetup to include partition layout #8524

Open Xartos opened 1 year ago

Xartos commented 1 year ago

What would you like to be added (User Story)?

As a cluster administrator I would like to be able to setup nodes that has a single disk with multiple partitions

Detailed Description

Currently there's no way to have a single node VM and split its disk into multiple partitions since this field is only a boolean. However, the cloud-init documentation says that this can either be a bool (to set up the disk as a single partition) or a list that describes the partition layout, reference.

So my proposal would be to allow this field to be either a boolean or a list. Alternatively add another field that describes the layout that can be merged with the existing field when generating the cloud-init user-data file.

Anything else you would like to add?

No response

Label(s) to be applied

/kind feature One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.

fabriziopandini commented 1 year ago

/triage accepted defining a field that can be either a list or a boolean requires some work in golang, but it is something that we can explore

/help

k8s-ci-robot commented 1 year ago

@fabriziopandini: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to [this](https://github.com/kubernetes-sigs/cluster-api/issues/8524): >/triage accepted >defining a field that can be either a list or a boolean requires some work in golang, but it is something that we can explore > >/help Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
ansh-wal commented 1 year ago

@fabriziopandini I can pick this up.

sbueringer commented 1 year ago

I'm not sure if we can make this work without a breaking change to our go API structs (which would mean we have to wait until v1beta2)

fabriziopandini commented 7 months ago

/priority backlog

miltalex commented 1 month ago

@fabriziopandini I was curious if that is something that can be done now, or there are still blockers? I would like to have a look into it when I find a bit of time.

sbueringer commented 1 month ago

To the best of my knowledge bool or list is not possible with crds (https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#intorstring cc @JoelSpeed). So I think we have to express this in a different way in our crd

Also seems like the list has different types in it

layout:
- [33,82]
- 66

I think that's also not supported in CRDs

JoelSpeed commented 1 month ago

Yeah that wouldn't be a structural schema, but you could represent the choices in a kube like way using a discriminated union, the yaml version would look something like:

diskLayout:
  type: Unpartitioned | SinglePartition | Custom
  custom:
  - sizePercentage: 0 < int < 100
    partitionType:  int (? Looking at the docs I think this is an int but not sure)