v1alpha1

package
v0.6.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: AGPL-3.0 Imports: 10 Imported by: 4

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the extensions v1alpha1 API group +kubebuilder:object:generate=true +groupName=extensions.kubeblocks.io

Index

Constants

View Source
const (
	// condition types
	ConditionTypeProgressing = "Progressing"
	ConditionTypeChecked     = "InstallableChecked"
	ConditionTypeSucceed     = "Succeed"
	ConditionTypeFailed      = "Failed"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "extensions.kubeblocks.io", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type Addon

type Addon struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   AddonSpec   `json:"spec,omitempty"`
	Status AddonStatus `json:"status,omitempty"`
}

Addon is the Schema for the addons API

func (*Addon) GetExtraNames

func (r *Addon) GetExtraNames() []string

GetExtraNames exacter extra items' name.

type AddonDefaultInstallSpecItem

type AddonDefaultInstallSpecItem struct {
	AddonInstallSpec `json:",inline"`

	// Addon default install parameters selectors. If multiple selectors are provided
	// that all selectors must evaluate to true.
	// +optional
	Selectors []SelectorRequirement `json:"selectors,omitempty"`
}

func (AddonDefaultInstallSpecItem) GetSelectorsStrings

func (r AddonDefaultInstallSpecItem) GetSelectorsStrings() []string

GetSelectorsStrings extract selectors to string representations.

type AddonInstallExtraItem

type AddonInstallExtraItem struct {
	AddonInstallSpecItem `json:",inline"`

	// Name of the item.
	// +kubebuilder:validation:Required
	Name string `json:"name"`
}

type AddonInstallSpec

type AddonInstallSpec struct {
	AddonInstallSpecItem `json:",inline"`

	// enabled can be set if there are no specific installation attributes to be set.
	// +optional
	Enabled bool `json:"enabled,omitempty"`

	// Install spec. for extra items.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ExtraItems []AddonInstallExtraItem `json:"extras,omitempty"`
}

func (*AddonInstallSpec) GetEnabled

func (r *AddonInstallSpec) GetEnabled() bool

GetEnabled provides Enabled property getter.

func (*AddonInstallSpec) HasSetValues

func (r *AddonInstallSpec) HasSetValues() bool

func (*AddonInstallSpec) IsDisabled

func (r *AddonInstallSpec) IsDisabled() bool

type AddonInstallSpecItem

type AddonInstallSpecItem struct {
	// Replicas value.
	// +optional
	Replicas *int32 `json:"replicas,omitempty"`

	// Persistent Volume Enabled value.
	// +optional
	PVEnabled *bool `json:"persistentVolumeEnabled,omitempty"`

	// Storage class name.
	// +optional
	StorageClass string `json:"storageClass,omitempty"`

	// Tolerations JSON array string value.
	// +optional
	Tolerations string `json:"tolerations,omitempty"`

	// Resource requirements.
	// +optional
	Resources ResourceRequirements `json:"resources,omitempty"`
}

func NewAddonInstallSpecItem

func NewAddonInstallSpecItem() AddonInstallSpecItem

NewAddonInstallSpecItem creates an initialized AddonInstallSpecItem object

func (AddonInstallSpecItem) IsEmpty

func (r AddonInstallSpecItem) IsEmpty() bool

type AddonList

type AddonList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Addon `json:"items"`
}

AddonList contains a list of Addon

type AddonPhase

type AddonPhase string

AddonPhase defines addon phases. +enum

const (
	AddonDisabled  AddonPhase = "Disabled"
	AddonEnabled   AddonPhase = "Enabled"
	AddonFailed    AddonPhase = "Failed"
	AddonEnabling  AddonPhase = "Enabling"
	AddonDisabling AddonPhase = "Disabling"
)

type AddonSelectorKey

type AddonSelectorKey string

AddonSelectorKey are selector requirement key types. +enum +kubebuilder:validation:Enum={KubeGitVersion,KubeVersion}

const (
	KubeGitVersion AddonSelectorKey = "KubeGitVersion"
	KubeVersion    AddonSelectorKey = "KubeVersion"
)

type AddonSpec

type AddonSpec struct {
	// Addon description.
	// +optional
	Description string `json:"description,omitempty"`

	// Addon type, valid value is helm.
	// +unionDiscriminator
	// +kubebuilder:validation:Required
	Type AddonType `json:"type"`

	// Helm installation spec., it's only being processed if type=helm.
	// +optional
	Helm *HelmTypeInstallSpec `json:"helm,omitempty"`

	// Default installation parameters.
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	DefaultInstallValues []AddonDefaultInstallSpecItem `json:"defaultInstallValues"`

	// Installation parameters.
	// +optional
	InstallSpec *AddonInstallSpec `json:"install,omitempty"`

	// Addon installable spec., provide selector and auto-install settings.
	// +optional
	Installable *InstallableSpec `json:"installable,omitempty"`

	// Plugin installation spec.
	// +optional
	CliPlugins []CliPlugin `json:"cliPlugins,omitempty"`
}

AddonSpec defines the desired state of Addon +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'Helm' ? has(self.helm) : !has(self.helm)",message="spec.helm is required when spec.type is Helm, and forbidden otherwise"

func (AddonSpec) GetSortedDefaultInstallValues

func (r AddonSpec) GetSortedDefaultInstallValues() []AddonDefaultInstallSpecItem

GetSortedDefaultInstallValues return DefaultInstallValues items with items that has provided selector first.

type AddonStatus

type AddonStatus struct {
	// Addon installation phases. Valid values are Disabled, Enabled, Failed, Enabling, Disabling.
	// +kubebuilder:validation:Enum={Disabled,Enabled,Failed,Enabling,Disabling}
	Phase AddonPhase `json:"phase,omitempty"`

	// Describe current state of Addon API installation conditions.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// observedGeneration is the most recent generation observed for this
	// Addon. It corresponds to the Addon's generation, which is
	// updated on mutation by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

AddonStatus defines the observed state of Addon

type AddonType

type AddonType string

AddonType defines the addon types. +enum +kubebuilder:validation:Enum={Helm}

const (
	HelmType AddonType = "Helm"
)

type CliPlugin added in v0.6.0

type CliPlugin struct {
	// Name of the plugin.
	// +kubebuilder:validation:Required
	Name string `json:"name"`

	// The index repository of the plugin.
	// +kubebuilder:validation:Required
	IndexRepository string `json:"indexRepository"`

	// The description of the plugin.
	// +optional
	Description string `json:"description,omitempty"`
}

type DataObjectKeySelector

type DataObjectKeySelector struct {
	// Object name of the referent.
	// +kubebuilder:validation:Required
	Name string `json:"name"` // need corev1.LocalObjectReference

	// The key to select.
	// +kubebuilder:validation:Required
	Key string `json:"key"`
}

type HelmInstallOptions

type HelmInstallOptions map[string]string

type HelmInstallValues

type HelmInstallValues struct {
	// +optional
	URLs []string `json:"urls,omitempty"`

	// Selects a key of a ConfigMap item list, the value of ConfigMap can be
	// a JSON or YAML string content, use key name with ".json" or ".yaml" or ".yml"
	// extension name to specify content type.
	// +optional
	ConfigMapRefs []DataObjectKeySelector `json:"configMapRefs,omitempty"`

	// Selects a key of a Secrets item list, the value of Secrets can be
	// a JSON or YAML string content, use key name with ".json" or ".yaml" or ".yml"
	// extension name to specify content type.
	// +optional
	SecretRefs []DataObjectKeySelector `json:"secretRefs,omitempty"`

	// Helm install set values, can specify multiple or separate values with commas(key1=val1,key2=val2).
	// +optional
	SetValues []string `json:"setValues,omitempty"`

	// Helm install set JSON values, can specify multiple or separate values with commas(key1=jsonval1,key2=jsonval2).
	// +optional
	SetJSONValues []string `json:"setJSONValues,omitempty"`
}

type HelmJSONValueMapType

type HelmJSONValueMapType struct {
	// tolerations sets toleration mapping key.
	// +optional
	Tolerations string `json:"tolerations,omitempty"`
}

type HelmTypeInstallSpec

type HelmTypeInstallSpec struct {
	// A Helm Chart location URL.
	// +kubebuilder:validation:Required
	ChartLocationURL string `json:"chartLocationURL"`

	// installOptions defines Helm release install options.
	// +optional
	InstallOptions HelmInstallOptions `json:"installOptions,omitempty"`

	// HelmInstallValues defines Helm release install set values.
	// +optional
	InstallValues HelmInstallValues `json:"installValues,omitempty"`

	// valuesMapping defines addon normalized resources parameters mapped to Helm values' keys.
	// +optional
	ValuesMapping HelmValuesMapping `json:"valuesMapping,omitempty"`
}

func (*HelmTypeInstallSpec) BuildContainerArgs

func (r *HelmTypeInstallSpec) BuildContainerArgs(helmContainer *corev1.Container, installValues HelmInstallValues) error

BuildContainerArgs derive helm container args

func (*HelmTypeInstallSpec) BuildMergedValues

func (r *HelmTypeInstallSpec) BuildMergedValues(installSpec *AddonInstallSpec) HelmInstallValues

BuildMergedValues merge values from a AddonInstallSpec and pre-set values.

type HelmValueMapType

type HelmValueMapType struct {
	// replicaCount sets replicaCount value mapping key.
	// +optional
	ReplicaCount string `json:"replicaCount,omitempty"`

	// persistentVolumeEnabled persistent volume enabled mapping key.
	// +optional
	PVEnabled string `json:"persistentVolumeEnabled,omitempty"`

	// storageClass sets storageClass mapping key.
	// +optional
	StorageClass string `json:"storageClass,omitempty"`
}

type HelmValuesMapping

type HelmValuesMapping struct {
	HelmValuesMappingItem `json:",inline"`

	// Helm value mapping items for extra items.
	// +patchMergeKey=name
	// +patchStrategy=merge,retainKeys
	// +listType=map
	// +listMapKey=name
	// +optional
	ExtraItems []HelmValuesMappingExtraItem `json:"extras,omitempty"`
}

type HelmValuesMappingExtraItem

type HelmValuesMappingExtraItem struct {
	HelmValuesMappingItem `json:",inline"`

	// Name of the item.
	// +kubebuilder:validation:Required
	Name string `json:"name"`
}

type HelmValuesMappingItem

type HelmValuesMappingItem struct {
	// valueMap define the "key" mapping values, valid keys are replicaCount,
	// persistentVolumeEnabled, and storageClass. Enum values explained:
	// `"replicaCount"` sets replicaCount value mapping key
	// `"persistentVolumeEnabled"` sets persistent volume enabled mapping key
	// `"storageClass"` sets storageClass mapping key
	// +optional
	HelmValueMap HelmValueMapType `json:"valueMap,omitempty"`

	// jsonMap define the "key" mapping values, valid keys are tolerations.
	// Enum values explained:
	// `"tolerations"` sets toleration mapping key
	// +optional
	HelmJSONMap HelmJSONValueMapType `json:"jsonMap,omitempty"`

	// resources sets resources related mapping keys.
	// +optional
	ResourcesMapping *ResourceMappingItem `json:"resources,omitempty"`
}

type InstallableSpec

type InstallableSpec struct {
	// Addon installable selectors. If multiple selectors are provided
	// that all selectors must evaluate to true.
	// +optional
	Selectors []SelectorRequirement `json:"selectors,omitempty"`

	// autoInstall defines an addon should auto installed
	// +kubebuilder:default=false
	AutoInstall bool `json:"autoInstall"`
}

func (*InstallableSpec) GetSelectorsStrings

func (r *InstallableSpec) GetSelectorsStrings() []string

GetSelectorsStrings extract selectors to string representations.

type LineSelectorOperator

type LineSelectorOperator string

LineSelectorOperator defines line selector operators. +enum +kubebuilder:validation:Enum={Contains,DoesNotContain,MatchRegex,DoesNotMatchRegex}

const (
	Contains          LineSelectorOperator = "Contains"
	DoesNotContain    LineSelectorOperator = "DoesNotContain"
	MatchRegex        LineSelectorOperator = "MatchRegex"
	DoesNotMatchRegex LineSelectorOperator = "DoesNotMatchRegex"
)

type ResourceMappingItem

type ResourceMappingItem struct {

	// storage sets storage size value mapping key.
	// +optional
	Storage string `json:"storage,omitempty"`

	// cpu sets CPU requests and limits mapping keys.
	// +optional
	CPU *ResourceReqLimItem `json:"cpu,omitempty"`

	// memory sets Memory requests and limits mapping keys.
	// +optional
	Memory *ResourceReqLimItem `json:"memory,omitempty"`
}

func (*ResourceMappingItem) HasCPULimMapping

func (r *ResourceMappingItem) HasCPULimMapping() bool

func (*ResourceMappingItem) HasCPUReqMapping

func (r *ResourceMappingItem) HasCPUReqMapping() bool

func (*ResourceMappingItem) HasMemLimMapping

func (r *ResourceMappingItem) HasMemLimMapping() bool

func (*ResourceMappingItem) HasMemReqMapping

func (r *ResourceMappingItem) HasMemReqMapping() bool

func (*ResourceMappingItem) HasStorageMapping

func (r *ResourceMappingItem) HasStorageMapping() bool

type ResourceReqLimItem

type ResourceReqLimItem struct {
	// Requests value mapping key.
	// +optional
	Requests string `json:"requests,omitempty"`

	// Limits value mapping key.
	// +optional
	Limits string `json:"limits,omitempty"`
}

type ResourceRequirements

type ResourceRequirements struct {
	// Limits describes the maximum amount of compute resources allowed.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	// +optional
	Limits corev1.ResourceList `json:"limits,omitempty"`
	// Requests describes the minimum amount of compute resources required.
	// If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
	// otherwise to an implementation-defined value.
	// More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
	// +optional
	Requests corev1.ResourceList `json:"requests,omitempty"`
}

type SelectorRequirement

type SelectorRequirement struct {
	// The selector key, valid values are KubeVersion, KubeGitVersion.
	// "KubeVersion" the semver expression of Kubernetes versions, i.e., v1.24.
	// "KubeGitVersion" may contain distro. info., i.e., v1.24.4+eks.
	// +kubebuilder:validation:Required
	Key AddonSelectorKey `json:"key"`

	// Represents a key's relationship to a set of values.
	// Valid operators are Contains, NotIn, DoesNotContain, MatchRegex, and DoesNoteMatchRegex.
	//
	// Possible enum values:
	// `"Contains"` line contains string
	// `"DoesNotContain"` line does not contain string
	// `"MatchRegex"` line contains a match to the regular expression
	// `"DoesNotMatchRegex"` line does not contain a match to the regular expression
	// +kubebuilder:validation:Required
	Operator LineSelectorOperator `json:"operator"`

	// An array of string values. Server as "OR" expression to the operator.
	// +optional
	Values []string `json:"values,omitempty" protobuf:"bytes,3,rep,name=values"`
}

func (SelectorRequirement) MatchesFromConfig

func (r SelectorRequirement) MatchesFromConfig() bool

MatchesFromConfig matches selector requirement value.

func (SelectorRequirement) String

func (r SelectorRequirement) String() string

Jump to

Keyboard shortcuts

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