v1alpha1

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package v1alpha1 contains types required for v1alpha1 +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:defaulter-gen=TypeMeta +groupName=prism.oam.dev

Index

Constants

View Source
const (
	// ClusterLocalName name for the hub cluster
	ClusterLocalName = "local"
	// CredentialTypeInternal identifies the cluster from internal kubevela system
	CredentialTypeInternal v1alpha1.CredentialType = "Internal"
	// CredentialTypeOCMManagedCluster identifies the ocm cluster
	CredentialTypeOCMManagedCluster v1alpha1.CredentialType = "ManagedCluster"
	// ClusterBlankEndpoint identifies the endpoint of a cluster as blank (not available)
	ClusterBlankEndpoint = "-"
)
View Source
const (
	// Group the group for the apiextensions
	Group = "prism.oam.dev"
	// Version the version for the v1alpha1 apiextensions
	Version = "v1alpha1"
)

Variables

View Source
var (
	// AnnotationClusterAlias the annotation key for cluster alias
	AnnotationClusterAlias = config.MetaApiGroupName + "/cluster-alias"

	// LabelClusterControlPlane identifies whether the cluster is the control plane
	LabelClusterControlPlane = config.MetaApiGroupName + "/control-plane"
)
View Source
var (
	// ClusterResource resource name for Cluster
	ClusterResource = "clusters"
	// ClusterKind kind name for Cluster
	ClusterKind = "Cluster"
	// ClusterGroupResource GroupResource for Cluster
	ClusterGroupResource = schema.GroupResource{Group: Group, Resource: ClusterResource}
	// ClusterGroupVersionKind GroupVersionKind for Cluster
	ClusterGroupVersionKind = GroupVersion.WithKind(ClusterKind)
)

AddToScheme add virtual cluster scheme

GroupVersion the apiextensions v1alpha1 group version

View Source
var StorageNamespace = "vela-system"

StorageNamespace refers to the namespace of cluster secret, usually same as the core kubevela system namespace

Functions

func AddClusterFlags

func AddClusterFlags(set *pflag.FlagSet)

AddClusterFlags add flags for cluster api

func IsInvalidClusterSecretError

func IsInvalidClusterSecretError(err error) bool

IsInvalidClusterSecretError check if an error is an invalid cluster secret error

func IsInvalidManagedClusterError

func IsInvalidManagedClusterError(err error) bool

IsInvalidManagedClusterError check if an error is an invalid managed cluster error

func NewEmptyCredentialTypeClusterSecretError

func NewEmptyCredentialTypeClusterSecretError() error

NewEmptyCredentialTypeClusterSecretError create an invalid cluster secret error due to empty credential type

func NewEmptyEndpointClusterSecretError

func NewEmptyEndpointClusterSecretError() error

NewEmptyEndpointClusterSecretError create an invalid cluster secret error due to empty endpoint

func NewInvalidManagedClusterError

func NewInvalidManagedClusterError() error

NewInvalidManagedClusterError create an invalid managed cluster error

Types

type Cluster

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

	Spec ClusterSpec `json:"spec,omitempty"`
}

Cluster is an extension model for cluster underlying secrets/ManagedClusters +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func NewClusterFromManagedCluster

func NewClusterFromManagedCluster(managedCluster *ocmclusterv1.ManagedCluster) (*Cluster, error)

NewClusterFromManagedCluster extract cluster from ocm managed cluster

func NewClusterFromSecret

func NewClusterFromSecret(secret *corev1.Secret) (*Cluster, error)

NewClusterFromSecret extract cluster from cluster secret

func NewLocalCluster

func NewLocalCluster() *Cluster

NewLocalCluster return the local cluster

func (*Cluster) ConvertToTable

func (in *Cluster) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error)

ConvertToTable convert resource to table

func (*Cluster) DeepCopy

func (in *Cluster) DeepCopy() *Cluster

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Cluster.

func (*Cluster) DeepCopyInto

func (in *Cluster) DeepCopyInto(out *Cluster)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Cluster) DeepCopyObject

func (in *Cluster) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Cluster) Destroy

func (in *Cluster) Destroy()

Destroy .

func (*Cluster) Get

func (in *Cluster) Get(ctx context.Context, name string, options *metav1.GetOptions) (runtime.Object, error)

Get finds a resource in the storage by name and returns it.

func (*Cluster) GetFullName

func (in *Cluster) GetFullName() string

GetFullName returns the name with alias

func (*Cluster) GetGroupVersionResource

func (in *Cluster) GetGroupVersionResource() schema.GroupVersionResource

GetGroupVersionResource returns the GroupVersionResource for this resource.

func (*Cluster) GetObjectMeta

func (in *Cluster) GetObjectMeta() *metav1.ObjectMeta

GetObjectMeta returns the object meta reference.

func (*Cluster) IsStorageVersion

func (in *Cluster) IsStorageVersion() bool

IsStorageVersion returns true if the object is also the internal version

func (*Cluster) List

List selects resources in the storage which match to the selector. 'options' can be nil.

func (*Cluster) NamespaceScoped

func (in *Cluster) NamespaceScoped() bool

NamespaceScoped returns if the object must be in a namespace.

func (*Cluster) New

func (in *Cluster) New() runtime.Object

New returns a new instance of the resource

func (*Cluster) NewList

func (in *Cluster) NewList() runtime.Object

NewList return a new list instance of the resource

func (*Cluster) ShortNames

func (in *Cluster) ShortNames() []string

ShortNames delivers a list of short names for a resource.

type ClusterClient

type ClusterClient interface {
	Get(ctx context.Context, name string) (*Cluster, error)
	List(ctx context.Context, options ...client.ListOption) (*ClusterList, error)
}

ClusterClient client for reading cluster information +kubebuilder:object:generate=false

func NewClusterClient

func NewClusterClient(cli client.Client) ClusterClient

NewClusterClient create a client for accessing cluster

type ClusterList

type ClusterList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []Cluster `json:"items"`
}

ClusterList list for Cluster +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

func (*ClusterList) DeepCopy

func (in *ClusterList) DeepCopy() *ClusterList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterList.

func (*ClusterList) DeepCopyInto

func (in *ClusterList) DeepCopyInto(out *ClusterList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterList) DeepCopyObject

func (in *ClusterList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*ClusterList) HasCluster

func (in *ClusterList) HasCluster(name string) bool

HasCluster return if the cluster list contains a cluster with the specified name

type ClusterSpec

type ClusterSpec struct {
	Alias          string                         `json:"alias,omitempty"`
	Accepted       bool                           `json:"accepted,omitempty"`
	Endpoint       string                         `json:"endpoint,omitempty"`
	CredentialType clusterv1alpha1.CredentialType `json:"credential-type,omitempty"`
}

ClusterSpec spec of cluster

func (*ClusterSpec) DeepCopy

func (in *ClusterSpec) DeepCopy() *ClusterSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec.

func (*ClusterSpec) DeepCopyInto

func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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