controller

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

Install go-enum by `go get install github.com/searKing/golang/tools/go-enum`

Index

Constants

View Source
const (
	DisplayNameAnnotation = "openshift.io/display-name"
	DescriptionAnnotation = "openshift.io/description"
)
View Source
const (
	// ConditionTypeAvailable represents the status of the Deployment reconciliation
	ConditionTypeAvailable = "Available"
	// ConditionTypeProgressing represents the status used when the model registry is being deployed.
	ConditionTypeProgressing = "Progressing"
	// ConditionTypeDegraded represents the status used when the model registry is deleted and the finalizer operations must occur.
	ConditionTypeDegraded = "Degraded"

	// ConditionTypeIstio represents the status of base Istio resources configuration.
	ConditionTypeIstio = "IstioAvailable"
	// ConditionTypeGateway represents the status of Istio Gateway configuration.
	ConditionTypeGateway = "GatewayAvailable"

	ReasonDeploymentCreated     = "CreatedDeployment"
	ReasonDeploymentCreating    = "CreatingDeployment"
	ReasonDeploymentUpdating    = "UpdatingDeployment"
	ReasonDeploymentAvailable   = "DeploymentAvailable"
	ReasonDeploymentUnavailable = "DeploymentUnavailable"

	ReasonResourcesCreated     = "CreatedResources"
	ReasonResourcesAvailable   = "ResourcesAvailable"
	ReasonResourcesUnavailable = "ResourcesUnavailable"
)

Definitions to manage status conditions

Variables

This section is empty.

Functions

func IgnoreDeletingErrors

func IgnoreDeletingErrors(err error) error

func OperationResultSliceContains

func OperationResultSliceContains(enums []OperationResult, sunEnums ...OperationResult) bool

OperationResultSliceContains reports whether sunEnums is within enums.

func OperationResultSliceContainsAny

func OperationResultSliceContainsAny(enums []OperationResult, sunEnums ...OperationResult) bool

OperationResultSliceContainsAny reports whether any sunEnum is within enums.

Types

type ModelRegistryParams

type ModelRegistryParams struct {
	Name      string
	Namespace string
	Spec      modelregistryv1alpha1.ModelRegistrySpec

	// gateway route parameters
	Host           string
	IngressService *corev1.Service
	TLS            *modelregistryv1alpha1.TLSServerSettings
}

ModelRegistryParams is a wrapper for template parameters

type ModelRegistryReconciler

type ModelRegistryReconciler struct {
	client.Client
	Scheme                  *runtime.Scheme
	Recorder                record.EventRecorder
	Log                     logr.Logger
	Template                *template.Template
	EnableWebhooks          bool
	IsOpenShift             bool
	HasIstio                bool
	Audiences               []string
	CreateAuthResources     bool
	DefaultDomain           string
	DefaultCert             string
	DefaultAuthProvider     string
	DefaultAuthConfigLabels map[string]string
}

ModelRegistryReconciler reconciles a ModelRegistry object

func (*ModelRegistryReconciler) Apply

func (r *ModelRegistryReconciler) Apply(params *ModelRegistryParams, templateName string, object interface{}) error

Apply executes given template name with params

func (*ModelRegistryReconciler) CheckAuthConfigCondition added in v0.2.2

func (r *ModelRegistryReconciler) CheckAuthConfigCondition(ctx context.Context, name types.NamespacedName, log logr.Logger, message string, available bool, reason string) (string, bool, string)

func (*ModelRegistryReconciler) CheckDeploymentPods added in v0.2.2

func (r *ModelRegistryReconciler) CheckDeploymentPods(ctx context.Context, name types.NamespacedName,
	log logr.Logger, message string, reason string, status metav1.ConditionStatus) (string, string, metav1.ConditionStatus)

func (*ModelRegistryReconciler) CheckGatewayRoutes added in v0.2.2

func (r *ModelRegistryReconciler) CheckGatewayRoutes(ctx context.Context, modelRegistry *modelregistryv1alpha1.ModelRegistry, name types.NamespacedName, log logr.Logger, message string, available bool) (string, bool)

func (*ModelRegistryReconciler) CheckIstioResourcesAvailable added in v0.2.2

func (r *ModelRegistryReconciler) CheckIstioResourcesAvailable(ctx context.Context, name types.NamespacedName,
	log logr.Logger, message string, available bool) (string, bool)

func (*ModelRegistryReconciler) CheckPodStatus added in v0.2.2

func (r *ModelRegistryReconciler) CheckPodStatus(ctx context.Context, req ctrl.Request,
	available bool, reason string, message string, unavailableReplicas int32) (bool, string, string)

func (*ModelRegistryReconciler) CheckRouteIngressConditions added in v0.2.2

func (r *ModelRegistryReconciler) CheckRouteIngressConditions(routes *routev1.RouteList, available bool,
	routeAvailable map[string]bool, routeMessage map[string]string) bool

func (*ModelRegistryReconciler) GetRegistryForRoute added in v0.2.2

func (r *ModelRegistryReconciler) GetRegistryForRoute(ctx context.Context, object client.Object) []reconcile.Request

GetRegistryForRoute maps route name to model registry reconcile request

func (*ModelRegistryReconciler) Reconcile

func (r *ModelRegistryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the ModelRegistry object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.0/pkg/reconcile

func (*ModelRegistryReconciler) SetGatewayCondition added in v0.2.2

func (r *ModelRegistryReconciler) SetGatewayCondition(ctx context.Context, req ctrl.Request,
	modelRegistry *modelregistryv1alpha1.ModelRegistry) bool

func (*ModelRegistryReconciler) SetIstioAndGatewayConditions added in v0.2.2

func (r *ModelRegistryReconciler) SetIstioAndGatewayConditions(ctx context.Context, req ctrl.Request,
	modelRegistry *modelregistryv1alpha1.ModelRegistry,
	status metav1.ConditionStatus, reason string, message string) (metav1.ConditionStatus, string, string)

func (*ModelRegistryReconciler) SetIstioCondition added in v0.2.2

func (r *ModelRegistryReconciler) SetIstioCondition(ctx context.Context, req ctrl.Request,
	modelRegistry *modelregistryv1alpha1.ModelRegistry) bool

func (*ModelRegistryReconciler) SetupWithManager

func (r *ModelRegistryReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type OperationResult

type OperationResult int
const (
	// ResourceUnchanged means that the resource has not been changed.
	ResourceUnchanged OperationResult = iota
	// ResourceCreated means that a new resource is created.
	ResourceCreated
	// ResourceUpdated means that an existing resource is updated.
	ResourceUpdated
)

func OperationResultValues

func OperationResultValues() []OperationResult

OperationResultValues returns all values of the enum

func ParseOperationResultString

func ParseOperationResultString(s string) (OperationResult, error)

ParseOperationResultString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func (OperationResult) MarshalBinary

func (i OperationResult) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface for OperationResult

func (OperationResult) MarshalJSON

func (i OperationResult) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for OperationResult

func (OperationResult) MarshalText

func (i OperationResult) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for OperationResult

func (OperationResult) MarshalYAML

func (i OperationResult) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for OperationResult

func (OperationResult) New

New returns a pointer to a new addr filled with the OperationResult value passed in.

func (OperationResult) Registered

func (i OperationResult) Registered() bool

IsAOperationResult returns "true" if the value is listed in the enum definition. "false" otherwise

func (*OperationResult) Scan

func (i *OperationResult) Scan(value interface{}) error

func (OperationResult) String

func (i OperationResult) String() string

func (*OperationResult) UnmarshalBinary

func (i *OperationResult) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface for OperationResult

func (*OperationResult) UnmarshalJSON

func (i *OperationResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for OperationResult

func (*OperationResult) UnmarshalText

func (i *OperationResult) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for OperationResult

func (*OperationResult) UnmarshalYAML

func (i *OperationResult) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for OperationResult

func (OperationResult) Value

func (i OperationResult) Value() (driver.Value, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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