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

LVMCluster CRD changes #115

Merged
merged 3 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 8 additions & 2 deletions api/v1alpha1/lvmcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ type LVMClusterSpec struct {
// Tolerations to apply to nodes to act on
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// DeviceClasses are a rules that assign local storage devices to volumegroups that are used for creating lvm based PVs
// Storage describes the deviceClass configuration for local storage devices

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep it future-ready, should we update the description of the Storage field to be more generic or less aligned with DeviceClass; Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good point. How about "Storage describes the configuration for local storage devices" ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds Great!

// +Optional
DeviceClasses []DeviceClass `json:"deviceClasses,omitempty"`
Storage Storage `json:"storage,omitempty"`
}

type DeviceClass struct {
Expand Down Expand Up @@ -94,6 +94,12 @@ type DeviceClassStatus struct {
NodeStatus []NodeStatus `json:"nodeStatus,omitempty"`
}

type Storage struct {
// DeviceClasses are a rules that assign local storage devices to volumegroups that are used for creating lvm based PVs
// +Optional
DeviceClasses []DeviceClass `json:"deviceClasses,omitempty"`
}

// NodeStatus defines the observed state of the deviceclass on the node
type NodeStatus struct {
// Node is the name of the node
Expand Down
30 changes: 23 additions & 7 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

216 changes: 113 additions & 103 deletions config/crd/bases/lvm.topolvm.io_lvmclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,111 +36,121 @@ spec:
spec:
description: LVMClusterSpec defines the desired state of LVMCluster
properties:
deviceClasses:
description: DeviceClasses are a rules that assign local storage devices
to volumegroups that are used for creating lvm based PVs
items:
properties:
deviceSelector:
description: DeviceSelector is a set of rules that should match
for a device to be included in the LVMCluster
type: object
name:
description: 'Name of the class, the VG and possibly the storageclass.
Validations to confirm that this field can be used as metadata.name
field in storageclass ref: https://github.com/kubernetes/apimachinery/blob/de7147/pkg/util/validation/validation.go#L209'
maxLength: 245
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
nodeSelector:
description: NodeSelector chooses nodes on which to create the
deviceclass
storage:
description: Storage describes the deviceClass configuration for local
storage devices
properties:
deviceClasses:
description: DeviceClasses are a rules that assign local storage
devices to volumegroups that are used for creating lvm based
PVs
items:
properties:
nodeSelectorTerms:
description: Required. A list of node selector terms. The
terms are ORed.
items:
description: A null or empty node selector term matches
no objects. The requirements of them are ANDed. The
TopologySelectorTerm type implements a subset of the
NodeSelectorTerm.
properties:
matchExpressions:
description: A list of node selector requirements
by node's labels.
items:
description: A node selector requirement is a selector
that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: The label key that the selector
applies to.
type: string
operator:
description: Represents a key's relationship
to a set of values. Valid operators are In,
NotIn, Exists, DoesNotExist. Gt, and Lt.
type: string
values:
description: An array of string values. If the
operator is In or NotIn, the values array
must be non-empty. If the operator is Exists
or DoesNotExist, the values array must be
empty. If the operator is Gt or Lt, the values
array must have a single element, which will
be interpreted as an integer. This array is
replaced during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchFields:
description: A list of node selector requirements
by node's fields.
items:
description: A node selector requirement is a selector
that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: The label key that the selector
applies to.
type: string
operator:
description: Represents a key's relationship
to a set of values. Valid operators are In,
NotIn, Exists, DoesNotExist. Gt, and Lt.
type: string
values:
description: An array of string values. If the
operator is In or NotIn, the values array
must be non-empty. If the operator is Exists
or DoesNotExist, the values array must be
empty. If the operator is Gt or Lt, the values
array must have a single element, which will
be interpreted as an integer. This array is
replaced during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
type: object
type: array
required:
- nodeSelectorTerms
deviceSelector:
description: DeviceSelector is a set of rules that should
match for a device to be included in the LVMCluster
type: object
name:
description: 'Name of the class, the VG and possibly the
storageclass. Validations to confirm that this field can
be used as metadata.name field in storageclass ref: https://github.com/kubernetes/apimachinery/blob/de7147/pkg/util/validation/validation.go#L209'
maxLength: 245
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
nodeSelector:
description: NodeSelector chooses nodes on which to create
the deviceclass
properties:
nodeSelectorTerms:
description: Required. A list of node selector terms.
The terms are ORed.
items:
description: A null or empty node selector term matches
no objects. The requirements of them are ANDed.
The TopologySelectorTerm type implements a subset
of the NodeSelectorTerm.
properties:
matchExpressions:
description: A list of node selector requirements
by node's labels.
items:
description: A node selector requirement is
a selector that contains values, a key, and
an operator that relates the key and values.
properties:
key:
description: The label key that the selector
applies to.
type: string
operator:
description: Represents a key's relationship
to a set of values. Valid operators are
In, NotIn, Exists, DoesNotExist. Gt, and
Lt.
type: string
values:
description: An array of string values.
If the operator is In or NotIn, the values
array must be non-empty. If the operator
is Exists or DoesNotExist, the values
array must be empty. If the operator is
Gt or Lt, the values array must have a
single element, which will be interpreted
as an integer. This array is replaced
during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchFields:
description: A list of node selector requirements
by node's fields.
items:
description: A node selector requirement is
a selector that contains values, a key, and
an operator that relates the key and values.
properties:
key:
description: The label key that the selector
applies to.
type: string
operator:
description: Represents a key's relationship
to a set of values. Valid operators are
In, NotIn, Exists, DoesNotExist. Gt, and
Lt.
type: string
values:
description: An array of string values.
If the operator is In or NotIn, the values
array must be non-empty. If the operator
is Exists or DoesNotExist, the values
array must be empty. If the operator is
Gt or Lt, the values array must have a
single element, which will be interpreted
as an integer. This array is replaced
during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
type: object
type: array
required:
- nodeSelectorTerms
type: object
type: object
type: object
type: array
type: array
type: object
tolerations:
description: Tolerations to apply to nodes to act on
items:
Expand Down
5 changes: 3 additions & 2 deletions config/samples/lvm_v1alpha1_lvmcluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ kind: LVMCluster
metadata:
name: lvmcluster-sample
spec:
deviceClasses:
- name: vg1
storage:
deviceClasses:
- name: vg1