v1alpha1

package
v0.6.0-alpha.24 Latest Latest
Warning

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

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

Documentation

Overview

+k8s:deepcopy-gen=package,register +k8s:openapi-gen=true +groupName=extensions.kubeblocks.io

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
)
View Source
var SchemeGroupVersion = GroupVersion

SchemeGroupVersion is group version used to register these objects.

Functions

func Resource added in v0.6.0

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

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 add-ons API.

func (*Addon) GetExtraNames

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

GetExtraNames extracts extra items' name.

type AddonDefaultInstallSpecItem

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

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

func (AddonDefaultInstallSpecItem) GetSelectorsStrings

func (r AddonDefaultInstallSpecItem) GetSelectorsStrings() []string

GetSelectorsStrings extracts 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"`

	// Installs 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 the 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 add-ons.

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"`

	// Add-on type. The valid value is helm.
	// +unionDiscriminator
	// +kubebuilder:validation:Required
	Type AddonType `json:"type"`

	// Helm installation spec. It's processed only when 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. It provides 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 an add-on. +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 returns DefaultInstallValues items with items that have a provided selector first.

type AddonStatus

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

	// Describes the current state of add-on API installation conditions.
	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

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

AddonStatus defines the observed state of an add-on.

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 a key name with ".json" or ".yaml" or ".yml"
	// extension name to specify a 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 a key name with ".json" or ".yaml" or ".yml"
	// extension name to specify a content type.
	// +optional
	SecretRefs []DataObjectKeySelector `json:"secretRefs,omitempty"`

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

	// Helm install set JSON values. It 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 the 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 installation options.
	// +optional
	InstallOptions HelmInstallOptions `json:"installOptions,omitempty"`

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

	// valuesMapping defines add-on 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 derives helm container args.

func (*HelmTypeInstallSpec) BuildMergedValues

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

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

type HelmValueMapType

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

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

	// storageClass sets the 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 the replicaCount value mapping key.
	// `"persistentVolumeEnabled"` sets the persistent volume enabled mapping key.
	// `"storageClass"` sets the storageClass mapping key.
	// +optional
	HelmValueMap HelmValueMapType `json:"valueMap,omitempty"`

	// jsonMap defines the "key" mapping values. The valid key is tolerations.
	// Enum values explained:
	// `"tolerations"` sets the 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 {
	// Add-on installable selectors. If multiple selectors are provided,
	// all selectors must evaluate to true.
	// +optional
	Selectors []SelectorRequirement `json:"selectors,omitempty"`

	// autoInstall defines an add-on should be installed automatically.
	// +kubebuilder:default=false
	AutoInstall bool `json:"autoInstall"`
}

func (*InstallableSpec) GetSelectorsStrings

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

GetSelectorsStrings extracts 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 the 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, it defaults 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 a string.
	// `"DoesNotContain"` line does not contain a 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. It serves as an "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 the 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