common

package
v0.1.111 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RefResource creates a tuple describing a related resource
	RefResource = T.MakeTuple3[string, string, *metav1.LabelSelector]

	// CreateRelatedResourceRules constructs an array of related resources and filter out thoe that do not have a selector
	CreateRelatedResourceRules = F.Flow2(
		A.Filter(isValidRelatedResource),
		A.Map(createRelatedResourceRule),
	)
)

Functions

func EnvFromConfigMapsOrSecrets added in v0.0.4

func EnvFromConfigMapsOrSecrets(data map[string]any) env.Environment

EnvFromConfigMapsOrSecrets merges all config maps into one

func ResourceStatusToResponse

func ResourceStatusToResponse(state *ResourceStatus) gin.H

func Transcode

func Transcode[T any](value any) (T, error)

Types

type AnnotationSelector

type AnnotationSelector struct {
	MatchAnnotations map[string]string                 `json:"matchAnnotations,omitempty"`
	MatchExpressions []metav1.LabelSelectorRequirement `json:"matchExpressions,omitempty"`
}

type ChildUpdateMethod

type ChildUpdateMethod string

+kubebuilder:validation:Enum={"OnDelete","Recreate","InPlace","RollingRecreate","RollingInPlace"}

const (
	ChildUpdateOnDelete        ChildUpdateMethod = "OnDelete"
	ChildUpdateRecreate        ChildUpdateMethod = "Recreate"
	ChildUpdateInPlace         ChildUpdateMethod = "InPlace"
	ChildUpdateRollingRecreate ChildUpdateMethod = "RollingRecreate"
	ChildUpdateRollingInPlace  ChildUpdateMethod = "RollingInPlace"
)

type ChildUpdateStatusChecks

type ChildUpdateStatusChecks struct {
	Conditions []StatusConditionCheck `json:"conditions,omitempty"`
}

type CompositeController

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

	Spec   CompositeControllerSpec   `json:"spec"`
	Status CompositeControllerStatus `json:"status,omitempty"`
}

CompositeController +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:path=compositecontrollers,scope=Cluster,shortName=cc;cctl

func (*CompositeController) GetCustomizeHook

func (cc *CompositeController) GetCustomizeHook() *Hook

type CompositeControllerChildResourceRule

type CompositeControllerChildResourceRule struct {
	ResourceRule   `json:",inline"`
	UpdateStrategy *CompositeControllerChildUpdateStrategy `json:"updateStrategy,omitempty"`
}

type CompositeControllerChildUpdateStrategy

type CompositeControllerChildUpdateStrategy struct {
	Method       ChildUpdateMethod       `json:"method,omitempty"`
	StatusChecks ChildUpdateStatusChecks `json:"statusChecks,omitempty"`
}

type CompositeControllerHooks

type CompositeControllerHooks struct {
	Customize *Hook `json:"customize,omitempty"`
	Sync      *Hook `json:"sync,omitempty"`
	Finalize  *Hook `json:"finalize,omitempty"`

	PreUpdateChild  *Hook `json:"preUpdateChild,omitempty"`
	PostUpdateChild *Hook `json:"postUpdateChild,omitempty"`
}

type CompositeControllerList

type CompositeControllerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []CompositeController `json:"items"`
}

CompositeControllerList +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type CompositeControllerParentResourceRule

type CompositeControllerParentResourceRule struct {
	ResourceRule    `json:",inline"`
	RevisionHistory *CompositeControllerRevisionHistory `json:"revisionHistory,omitempty"`
	LabelSelector   *metav1.LabelSelector               `json:"labelSelector,omitempty"`
}

type CompositeControllerRevisionHistory

type CompositeControllerRevisionHistory struct {
	FieldPaths []string `json:"fieldPaths,omitempty"`
}

type CompositeControllerSpec

type CompositeControllerSpec struct {
	ParentResource CompositeControllerParentResourceRule  `json:"parentResource"`
	ChildResources []CompositeControllerChildResourceRule `json:"childResources,omitempty"`

	Hooks *CompositeControllerHooks `json:"hooks,omitempty"`

	ResyncPeriodSeconds *int32 `json:"resyncPeriodSeconds,omitempty"`
	GenerateSelector    *bool  `json:"generateSelector,omitempty"`
}

type CompositeControllerStatus

type CompositeControllerStatus struct{}

type ControllerRevision

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

	ParentPatch runtime.RawExtension         `json:"parentPatch"`
	Children    []ControllerRevisionChildren `json:"children,omitempty"`
}

ControllerRevision +genclient +genclient:noStatus +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:path=controllerrevisions,scope=Namespaced

type ControllerRevisionChildren

type ControllerRevisionChildren struct {
	APIGroup string   `json:"apiGroup"`
	Kind     string   `json:"kind"`
	Names    []string `json:"names"`
}

type ControllerRevisionList

type ControllerRevisionList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []ControllerRevision `json:"items"`
}

ControllerRevisionList +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type CustomizableController

type CustomizableController interface {

	// GetCustomizeHook return v1alpha1.Hook or nil if not defined
	GetCustomizeHook() *Hook
}

CustomizableController is an interface representing Controller exposing customize hook

type CustomizeHookRequest

type CustomizeHookRequest struct {
	Controller CustomizableController     `json:"controller"`
	Parent     *unstructured.Unstructured `json:"parent"`
}

CustomizeHookRequest is a request send to customize hook

type CustomizeHookResponse

type CustomizeHookResponse struct {
	RelatedResourceRules []*RelatedResourceRule `json:"relatedResources,omitempty"`
}

CustomizeHookResponse is a response from customize hook

type DecoratorController

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

	Spec   DecoratorControllerSpec   `json:"spec"`
	Status DecoratorControllerStatus `json:"status,omitempty"`
}

DecoratorController +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:subresource:status +kubebuilder:resource:path=decoratorcontrollers,scope=Cluster,shortName=dec;decorators

func (*DecoratorController) GetCustomizeHook

func (dc *DecoratorController) GetCustomizeHook() *Hook

type DecoratorControllerAttachmentRule

type DecoratorControllerAttachmentRule struct {
	ResourceRule   `json:",inline"`
	UpdateStrategy *DecoratorControllerAttachmentUpdateStrategy `json:"updateStrategy,omitempty"`
}

type DecoratorControllerAttachmentUpdateStrategy

type DecoratorControllerAttachmentUpdateStrategy struct {
	Method ChildUpdateMethod `json:"method,omitempty"`
}

type DecoratorControllerHooks

type DecoratorControllerHooks struct {
	Customize *Hook `json:"customize,omitempty"`
	Sync      *Hook `json:"sync,omitempty"`
	Finalize  *Hook `json:"finalize,omitempty"`
}

type DecoratorControllerList

type DecoratorControllerList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata"`
	Items           []DecoratorController `json:"items"`
}

DecoratorControllerList +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

type DecoratorControllerResourceRule

type DecoratorControllerResourceRule struct {
	ResourceRule       `json:",inline"`
	LabelSelector      *metav1.LabelSelector `json:"labelSelector,omitempty"`
	AnnotationSelector *AnnotationSelector   `json:"annotationSelector,omitempty"`
}

type DecoratorControllerSpec

type DecoratorControllerSpec struct {
	Resources   []DecoratorControllerResourceRule   `json:"resources"`
	Attachments []DecoratorControllerAttachmentRule `json:"attachments,omitempty"`

	Hooks *DecoratorControllerHooks `json:"hooks,omitempty"`

	ResyncPeriodSeconds *int32 `json:"resyncPeriodSeconds,omitempty"`
}

type DecoratorControllerStatus

type DecoratorControllerStatus struct{}

type Hook

type Hook struct {
	// +kubebuilder:default:="v1"
	Version *HookVersion `json:"version,omitempty"`
	Webhook *Webhook     `json:"webhook,omitempty"`
}

type HookVersion

type HookVersion string

+kubebuilder:validation:Enum={"v1","v2"}

const (
	HookVersionV1 HookVersion = "v1"
	HookVersionV2 HookVersion = "v2"
)

type RelatedResource added in v0.0.19

type RelatedResource = T.Tuple3[string, string, *metav1.LabelSelector]

version, name selector

func RefConfigMaps added in v0.0.19

func RefConfigMaps(labels *metav1.LabelSelector) RelatedResource

RefConfigMaps references a config map as related resource

func RefSecrets added in v0.0.19

func RefSecrets(labels *metav1.LabelSelector) RelatedResource

RefSecrets references a secret as related resource

type RelatedResourceRule

type RelatedResourceRule struct {
	ResourceRule          `json:",inline"`
	*metav1.LabelSelector `json:"labelSelector"`
	Namespace             string   `json:"namespace,omitempty"`
	Names                 []string `json:"names"`
}

type ResourceRule

type ResourceRule struct {
	APIVersion string `json:"apiVersion"`
	Resource   string `json:"resource"`
}

type ResourceStatus

type ResourceStatus struct {
	Status      Status
	Description string
	Error       error
	Metadata    C.RawMap
}

func CreateAction added in v0.1.22

func CreateAction(status *ResourceStatus) (*ResourceStatus, error)

func CreateErrorAction

func CreateErrorAction(err error) (*ResourceStatus, error)

func CreateReadyAction

func CreateReadyAction() (*ResourceStatus, error)

func CreateStatusAction

func CreateStatusAction(status Status) (*ResourceStatus, error)

func CreateWaitingAction

func CreateWaitingAction() (*ResourceStatus, error)

type ResponseUnmarshallMode

type ResponseUnmarshallMode string

+kubebuilder:validation:Enum:={"loose","strict"}

const (
	ResponseUnmarshallModeLoose  ResponseUnmarshallMode = "loose"
	ResponseUnmarshallModeStrict ResponseUnmarshallMode = "strict"
)

type ServiceReference

type ServiceReference struct {
	Name      string  `json:"name"`
	Namespace string  `json:"namespace"`
	Port      *int32  `json:"port,omitempty"`
	Protocol  *string `json:"protocol,omitempty"`
}

type Status

type Status int
const (
	Waiting Status = iota
	Ready
	Error
)

type StatusConditionCheck

type StatusConditionCheck struct {
	Type   string  `json:"type"`
	Status *string `json:"status,omitempty"`
	Reason *string `json:"reason,omitempty"`
}

type Webhook

type Webhook struct {
	URL *string `json:"url,omitempty"`
	// +kubebuilder:validation:Format:="duration"
	Timeout *metav1.Duration `json:"timeout,omitempty"`

	Etag    *WebhookEtagConfig `json:"etag,omitempty"`
	Path    *string            `json:"path,omitempty"`
	Service *ServiceReference  `json:"service,omitempty"`
	// Sets the json unmarshall mode. One of the 'loose' or 'strict'. In 'strict'
	// mode additional checks are performed to detect unknown and duplicated fields.
	ResponseUnmarshallMode *ResponseUnmarshallMode `json:"responseUnMarshallMode,omitempty"`
}

type WebhookEtagConfig

type WebhookEtagConfig struct {
	Enabled             *bool  `json:"enabled,omitempty"`
	CacheTimeoutSeconds *int32 `json:"cacheTimeoutSeconds,omitempty"`
	CacheCleanupSeconds *int32 `json:"cacheCleanupSeconds,omitempty"`
}

Jump to

Keyboard shortcuts

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