v1alpha1

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the cosmo v1alpha1 API group +kubebuilder:object:generate=true +groupName=cosmo.cosmo-workspace.github.io

Index

Constants

View Source
const (
	// LabelKeyInstance is a instance name label on the each child resources associated with the instance
	LabelKeyInstance = "cosmo/instance"
	// AnnKeyTemplateUpdated is a annotation on instance to notify template updates to reconcile
	AnnKeyTemplateUpdated = "cosmo/template-updated"
)
View Source
const (
	// LabelKeyTemplate is a template name label on the resources created by instance
	LabelKeyTemplate = "cosmo/template"
	// LabelKeyTemplateType is a additional type infomartion on template
	LabelKeyTemplateType = "cosmo/type"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "cosmo.cosmo-workspace.github.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

func EqualInstanceResourceName

func EqualInstanceResourceName(instanceName, a, b string) bool

EqualInstanceResourceName compare child resource names

func ExistInLastApplyed

func ExistInLastApplyed(inst Instance, gvkObj gvkObject) bool

func InstanceResourceName

func InstanceResourceName(instanceName, resourceName string) string

InstanceResourceName is a child resource name created by instance All resources associated with instance has "INSTANCE_NAME-" prefix

func IsGVKEqual

func IsGVKEqual(a, b schema.GroupVersionKind) bool

Types

type IngressOverrideSpec

type IngressOverrideSpec struct {
	TargetName  string              `json:"targetName,omitempty"`
	Annotations map[string]string   `json:"annotations,omitempty"`
	Rules       []netv1.IngressRule `json:"rules,omitempty"`
}

IngressOverrideSpec defines overrides to transform Ingress resources

func (*IngressOverrideSpec) DeepCopy

func (in *IngressOverrideSpec) DeepCopy() *IngressOverrideSpec

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

func (*IngressOverrideSpec) DeepCopyInto

func (in *IngressOverrideSpec) DeepCopyInto(out *IngressOverrideSpec)

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

type Instance

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

	Spec   InstanceSpec   `json:"spec,omitempty"`
	Status InstanceStatus `json:"status,omitempty"`
}

+kubebuilder:object:root=true +kubebuilder:resource:shortName=inst +kubebuilder:subresource:status +kubebuilder:storageversion +kubebuilder:printcolumn:name="Template",type=string,JSONPath=`.status.templateName` +kubebuilder:printcolumn:name="Applied-Resources",type=string,JSONPath=`.status.lastApplied[*].kind` Instance is the Schema for the instances API

func (*Instance) DeepCopy

func (in *Instance) DeepCopy() *Instance

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

func (*Instance) DeepCopyInto

func (in *Instance) DeepCopyInto(out *Instance)

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

func (*Instance) DeepCopyObject

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

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

type InstanceList

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

+kubebuilder:object:root=true InstanceList contains a list of Instance

func (*InstanceList) DeepCopy

func (in *InstanceList) DeepCopy() *InstanceList

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

func (*InstanceList) DeepCopyInto

func (in *InstanceList) DeepCopyInto(out *InstanceList)

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

func (*InstanceList) DeepCopyObject

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

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

type InstanceSpec

type InstanceSpec struct {
	// +kubebuilder:validation:Required
	Template TemplateRef       `json:"template"`
	Vars     map[string]string `json:"vars,omitempty"`
	Override OverrideSpec      `json:"override,omitempty"`
}

InstanceSpec defines the desired state of Instance

func (*InstanceSpec) DeepCopy

func (in *InstanceSpec) DeepCopy() *InstanceSpec

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

func (*InstanceSpec) DeepCopyInto

func (in *InstanceSpec) DeepCopyInto(out *InstanceSpec)

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

type InstanceStatus

type InstanceStatus struct {
	TemplateName string      `json:"templateName,omitempty"`
	LastApplied  []ObjectRef `json:"lastApplied,omitempty"`
}

InstanceStatus has status of Instance

func (*InstanceStatus) DeepCopy

func (in *InstanceStatus) DeepCopy() *InstanceStatus

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

func (*InstanceStatus) DeepCopyInto

func (in *InstanceStatus) DeepCopyInto(out *InstanceStatus)

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

type Json6902

type Json6902 struct {
	Target ObjectRef `json:"target"`
	Patch  string    `json:"patch,omitempty"`
}

Json6902 defines JSONPatch specs.

func (*Json6902) DeepCopy

func (in *Json6902) DeepCopy() *Json6902

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

func (*Json6902) DeepCopyInto

func (in *Json6902) DeepCopyInto(out *Json6902)

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

type NetworkOverrideSpec

type NetworkOverrideSpec struct {
	Ingress []IngressOverrideSpec `json:"ingress,omitempty"`
	Service []ServiceOverrideSpec `json:"service,omitempty"`
}

NetworkOverrideSpec defines overrides to transform network resources

func (*NetworkOverrideSpec) DeepCopy

func (in *NetworkOverrideSpec) DeepCopy() *NetworkOverrideSpec

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

func (*NetworkOverrideSpec) DeepCopyInto

func (in *NetworkOverrideSpec) DeepCopyInto(out *NetworkOverrideSpec)

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

type ObjectRef

type ObjectRef struct {
	corev1.ObjectReference `json:",inline"`
	CreationTimestamp      *metav1.Time `json:"creationTimestamp,omitempty"`
	UpdateTimestamp        *metav1.Time `json:"updateTimestamp,omitempty"`
}

ObjectRef is a reference of resource which is created by the Instance

func UnstructuredToResourceRef

func UnstructuredToResourceRef(obj unstructured.Unstructured, updateTimestamp metav1.Time) ObjectRef

UnstructuredToResourceRef generate ObjectRef by Unstructured object

func (*ObjectRef) DeepCopy

func (in *ObjectRef) DeepCopy() *ObjectRef

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

func (*ObjectRef) DeepCopyInto

func (in *ObjectRef) DeepCopyInto(out *ObjectRef)

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

func (ObjectRef) GetName

func (r ObjectRef) GetName() string

func (ObjectRef) GroupVersionKind

func (r ObjectRef) GroupVersionKind() schema.GroupVersionKind

func (ObjectRef) IsTarget

func (r ObjectRef) IsTarget(instanceName string, obj gvkObject) bool

func (*ObjectRef) SetGroupVersionKind

func (r *ObjectRef) SetGroupVersionKind(gvk schema.GroupVersionKind)

func (*ObjectRef) SetName

func (r *ObjectRef) SetName(name string)

type OverrideSpec

type OverrideSpec struct {
	Scale           []ScalingOverrideSpec `json:"scale,omitempty"`
	Network         *NetworkOverrideSpec  `json:"network,omitempty"`
	PatchesJson6902 []Json6902            `json:"patchesJson6902,omitempty"`
}

OverrideSpec defines overrides to transform built objects

func (*OverrideSpec) DeepCopy

func (in *OverrideSpec) DeepCopy() *OverrideSpec

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

func (*OverrideSpec) DeepCopyInto

func (in *OverrideSpec) DeepCopyInto(out *OverrideSpec)

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

type RequiredVarSpec

type RequiredVarSpec struct {
	Var     string `json:"var"`
	Default string `json:"default,omitempty"`
}

RequiredVarSpec defines a required var spec for template

func (*RequiredVarSpec) DeepCopy

func (in *RequiredVarSpec) DeepCopy() *RequiredVarSpec

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

func (*RequiredVarSpec) DeepCopyInto

func (in *RequiredVarSpec) DeepCopyInto(out *RequiredVarSpec)

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

type ScalingOverrideSpec

type ScalingOverrideSpec struct {
	Target   ObjectRef `json:"target"`
	Replicas int64     `json:"replicas"`
}

ScalingOverrideSpec defines workload scales.

func (*ScalingOverrideSpec) DeepCopy

func (in *ScalingOverrideSpec) DeepCopy() *ScalingOverrideSpec

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

func (*ScalingOverrideSpec) DeepCopyInto

func (in *ScalingOverrideSpec) DeepCopyInto(out *ScalingOverrideSpec)

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

type ServiceOverrideSpec

type ServiceOverrideSpec struct {
	TargetName string               `json:"targetName,omitempty"`
	Ports      []corev1.ServicePort `json:"ports,omitempty"`
}

ServiceOverrideSpec defines overrides to transform Service resources

func (*ServiceOverrideSpec) DeepCopy

func (in *ServiceOverrideSpec) DeepCopy() *ServiceOverrideSpec

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

func (*ServiceOverrideSpec) DeepCopyInto

func (in *ServiceOverrideSpec) DeepCopyInto(out *ServiceOverrideSpec)

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

type Template

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

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

+kubebuilder:object:root=true +kubebuilder:resource:scope="Cluster",shortName=tmpl +kubebuilder:storageversion +kubebuilder:printcolumn:name="Required-Vars",type=string,JSONPath=`.spec.requiredVars` Template is the Schema for the Templates API

func (*Template) DeepCopy

func (in *Template) DeepCopy() *Template

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

func (*Template) DeepCopyInto

func (in *Template) DeepCopyInto(out *Template)

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

func (*Template) DeepCopyObject

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

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

type TemplateList

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

+kubebuilder:object:root=true TemplateList contains a list of Template

func (*TemplateList) DeepCopy

func (in *TemplateList) DeepCopy() *TemplateList

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

func (*TemplateList) DeepCopyInto

func (in *TemplateList) DeepCopyInto(out *TemplateList)

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

func (*TemplateList) DeepCopyObject

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

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

type TemplateRef

type TemplateRef struct {
	// +kubebuilder:validation:Required
	Name string `json:"name"`
}

TemplateRef defines template to use in Instance creation

func (*TemplateRef) DeepCopy

func (in *TemplateRef) DeepCopy() *TemplateRef

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

func (*TemplateRef) DeepCopyInto

func (in *TemplateRef) DeepCopyInto(out *TemplateRef)

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

type TemplateSpec

type TemplateSpec struct {
	Description  string            `json:"description,omitempty"`
	RequiredVars []RequiredVarSpec `json:"requiredVars,omitempty"`
	RawYaml      string            `json:"rawYaml,omitempty"`
}

TemplateSpec defines the desired state of Template

func (*TemplateSpec) DeepCopy

func (in *TemplateSpec) DeepCopy() *TemplateSpec

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

func (*TemplateSpec) DeepCopyInto

func (in *TemplateSpec) DeepCopyInto(out *TemplateSpec)

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