zerocapacity

package
v0.0.0-...-46ee869 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateController

func CreateController(name string, reconciler Reconciler, mgr manager.Manager) error

Types

type Controller

type Controller struct {
	client.Client
	Name       string
	Reconciler Reconciler
	Kube       *kube.Kubernetes
	Log        logr.Logger
	Scheme     *runtime.Scheme
}

func (*Controller) Reconcile

func (z *Controller) Reconcile(request reconcile.Request) (reconcile.Result, error)

type Phase

type Phase string
const (
	// ZeroInitializing means the request has been accepted by the system, but the underlying resources are still
	// being initialized.
	ZeroInitializing Phase = "Initializing"
	// ZeroInitialized means that all required resources have been initialized
	ZeroInitialized Phase = "Initialized"
	// ZeroRunning means that the required action has been initiated on the infinispan server.
	ZeroRunning Phase = "Running"
	// ZeroSucceeded means that the action on the server has completed and the zero pod has been terminated.
	ZeroSucceeded Phase = "Succeeded"
	// ZeroFailed means that the action failed on the infinispan server and the zero pod has terminated.
	ZeroFailed Phase = "Failed"
	// ZeroUnknown means that for some reason the state of the action could not be obtained, typically due
	// to an error in communicating with the underlying zero pod.
	ZeroUnknown Phase = "Unknown"
)

type Reconciler

type Reconciler interface {
	// The k8 struct being handled by this controller
	Type() runtime.Object
	// Create a new instance of the zero Resource wrapping the actual k8 type
	ResourceInstance(name types.NamespacedName, ctrl *Controller) (Resource, error)
}

type Resource

type Resource interface {
	// Returns the name of the Infinispan cluster CR that the zero-pod should join
	Cluster() string
	// The current execution phase of the controller
	Phase() Phase
	// Update the current state of the resource to reflect the most recent Phase
	UpdatePhase(phase Phase, phaseErr error) error
	// Transform any CR resources, adding defaults or updating fields for backwards-compatibility if required
	Transform() (bool, error)
	// Ensure that all prerequisite resources are available and create any required resources before returning the zero spec
	Init() (*Spec, error)
	// Perform the operation(s) that are required on the zero-capacity pod
	Exec(client http.HttpClient) error
	// Return true when the operation(s) have completed, otherwise false
	ExecStatus(client http.HttpClient) (Phase, error)
	// Utility method to return a metav1.Object in order to set the controller reference
	AsMeta() metav1.Object
}

Adapter interface that allows the zero-capacity controller to interact with the underlying k8 resource

type Spec

type Spec struct {
	// The VolumeSpec to utilise on the zero-capacity pod
	Volume VolumeSpec
	// The spec to be used by the zero-capacity pod
	Container v1.InfinispanContainerSpec
	// The labels to apply to the zero-capacity pod
	PodLabels map[string]string
}

type VolumeSpec

type VolumeSpec struct {
	// If true a chmod initContainer is added to the pod to update the permissions of the MountPath
	UpdatePermissions bool
	// Path within the container at which the volume should be mounted.
	MountPath string
	// The VolumeSource to utilise on the zero-capacity pod
	VolumeSource corev1.VolumeSource
}

Jump to

Keyboard shortcuts

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