block

package
v1.9.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package block provides block device and volume configuration documents.

Index

Constants

View Source
const VolumeConfigKind = "VolumeConfig"

VolumeConfigKind is a config document kind.

Variables

This section is empty.

Functions

func GetFileDoc

func GetFileDoc() *encoder.FileDoc

GetFileDoc returns documentation for the file block_doc.go.

Types

type ByteSize

type ByteSize struct {
	// contains filtered or unexported fields
}

ByteSize is a byte size which can be convienintly represented as a human readable string with IEC sizes, e.g. 100MB.

func MustByteSize

func MustByteSize(value string) ByteSize

MustByteSize returns a new ByteSize with the given value.

It panics if the value is invalid.

func (ByteSize) IsZero

func (bs ByteSize) IsZero() bool

IsZero implements yaml.IsZeroer.

func (ByteSize) MarshalText

func (bs ByteSize) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*ByteSize) UnmarshalText

func (bs *ByteSize) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (ByteSize) Value

func (bs ByteSize) Value() uint64

Value returns the value.

type DiskSelector

type DiskSelector struct {
	//   description: |
	//     The Common Expression Language (CEL) expression to match the disk.
	//   schema:
	//     type: string
	//   examples:
	//    - value: >
	//        exampleDiskSelector1()
	//      name: match disks with size between 120GB and 1TB
	//    - value: >
	//        exampleDiskSelector2()
	//      name: match SATA disks that are not rotational and not system disks
	Match cel.Expression `yaml:"match,omitempty"`
}

DiskSelector selects a disk for the volume.

func (DiskSelector) Doc

func (DiskSelector) Doc() *encoder.Doc

type ProvisioningSpec

type ProvisioningSpec struct {
	//   description: |
	//     The disk selector expression.
	DiskSelectorSpec DiskSelector `yaml:"diskSelector,omitempty"`
	//   description: |
	//    Should the volume grow to the size of the disk (if possible).
	ProvisioningGrow *bool `yaml:"grow,omitempty"`
	//  description: |
	//    The minimum size of the volume.
	//
	//    Size is specified in bytes, but can be expressed in human readable format, e.g. 100MB.
	//  examples:
	//    - value: >
	//        "2.5GiB"
	//  schema:
	//    type: string
	ProvisioningMinSize ByteSize `yaml:"minSize,omitempty"`
	//  description: |
	//    The maximum size of the volume, if not specified the volume can grow to the size of the
	//    disk.
	//
	//    Size is specified in bytes, but can be expressed in human readable format, e.g. 100MB.
	//  examples:
	//    - value: >
	//        "50GiB"
	//  schema:
	//    type: string
	ProvisioningMaxSize ByteSize `yaml:"maxSize,omitempty"`
}

ProvisioningSpec describes how the volume is provisioned.

func (ProvisioningSpec) DiskSelector

func (s ProvisioningSpec) DiskSelector() optional.Optional[cel.Expression]

DiskSelector implements config.VolumeProvisioningConfig interface.

func (ProvisioningSpec) Doc

func (ProvisioningSpec) Doc() *encoder.Doc

func (ProvisioningSpec) Grow

Grow implements config.VolumeProvisioningConfig interface.

func (ProvisioningSpec) MaxSize

MaxSize implements config.VolumeProvisioningConfig interface.

func (ProvisioningSpec) MinSize

MinSize implements config.VolumeProvisioningConfig interface.

type VolumeConfigV1Alpha1

type VolumeConfigV1Alpha1 struct {
	meta.Meta `yaml:",inline"`
	//   description: |
	//     Name of the volume.
	MetaName string `yaml:"name"`
	//   description: |
	//     The provisioning describes how the volume is provisioned.
	ProvisioningSpec ProvisioningSpec `yaml:"provisioning,omitempty"`
}

VolumeConfigV1Alpha1 is a volume configuration document.

Note: at the moment, only EPHEMERAL volumes are supported.

examples:
  - value: exampleVolumeConfigEphemeralV1Alpha1()
alias: VolumeConfig
schemaRoot: true
schemaMeta: v1alpha1/VolumeConfig

func NewVolumeConfigV1Alpha1

func NewVolumeConfigV1Alpha1() *VolumeConfigV1Alpha1

NewVolumeConfigV1Alpha1 creates a new volume config document.

func (*VolumeConfigV1Alpha1) Clone

Clone implements config.Document interface.

func (*VolumeConfigV1Alpha1) DeepCopy

DeepCopy generates a deep copy of *VolumeConfigV1Alpha1.

func (VolumeConfigV1Alpha1) Doc

func (*VolumeConfigV1Alpha1) Name

func (s *VolumeConfigV1Alpha1) Name() string

Name implements config.NamedDocument interface.

func (*VolumeConfigV1Alpha1) Provisioning

Provisioning implements config.VolumeConfig interface.

func (*VolumeConfigV1Alpha1) Validate

Validate implements config.Validator interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL