Documentation ¶
Index ¶
- Constants
- Variables
- type AddEnvFromSourceToContainer
- type AddTemplateVolumeToContainer
- type AddVolumeToContainer
- type ConfigurableContainer
- type ConfigurablePod
- type ConfigurableReplicas
- type Converged
- type ConvergedGroup
- type ConvergedGroupInterface
- type FormationStatus
- type FormationStatusInterface
- type LinkVolumeData
- type ProbeConfiguration
- type Reconcile
- type Resource
- type ResourceState
- type ResourceStatus
- type ResourcesName
- type StorageConfigType
- type ToResource
- type Update
Constants ¶
const ( //HashKey conation the hash of the resource in the annotations HashKey = "formation/hash" //UpdateKey if is set to "disabled", the resource will not be updated. //Once this is set on a resource, it will not be updated unless the annotation is removed. UpdateKey = "formation/update" )
Variables ¶
var (
ErrWrongResourceType = errors.New("wrong resource type")
)
Functions ¶
This section is empty.
Types ¶
type AddEnvFromSourceToContainer ¶
type AddEnvFromSourceToContainer interface {
AddEnvFromSourceToContainer(containerName string, envFromSource v1.EnvFromSource)
}
type AddTemplateVolumeToContainer ¶
type AddTemplateVolumeToContainer interface {
AddVolumeToContainer(containerName string, containerVolume v1.VolumeMount, template v1.PersistentVolumeClaimSpec)
}
AddTemplateVolumeToContainer is the interface that adds a Volume Template to the builder and which container it belongs to
type AddVolumeToContainer ¶
type AddVolumeToContainer interface {
AddVolumeToContainer(containerName string, containerVolume v1.VolumeMount, volume v1.VolumeSource)
}
AddVolumeToContainer is the interface that adds a Volume to a Container
type ConfigurableContainer ¶
type ConfigurableContainer interface { // AddResourceRequirements Add resource requirements to the container AddResourceRequirements(containerName string, requirements v1.ResourceRequirements) //AddEnv Add environment variables to the container AddEnv(containerName string, env ...v1.EnvVar) SetImage(containerName string, image string) SetImagePullPolicy(containerName string, policy v1.PullPolicy) // SetStartupProbeConfiguration Set the startup probe configuration for the container SetStartupProbeConfiguration(containerName string, probe ProbeConfiguration) // SetReadinessProbeConfiguration Set the readiness probe configuration for the container SetReadinessProbeConfiguration(containerName string, probe ProbeConfiguration) // SetLivenessProbeConfiguration Set the liveness probe configuration for the container SetLivenessProbeConfiguration(containerName string, probe ProbeConfiguration) }
ConfigurableContainer is the interface that allows the user to customize the resource
type ConfigurablePod ¶
type ConfigurablePod interface { // AddAffinity Add affinity to the pod AddAffinity(affinity v1.Affinity) // AddTolerations Add tolerations to the pod AddTolerations(toleration ...v1.Toleration) // AddTopologySpreadConstraints Add Pod Topology Spread Constraints AddTopologySpreadConstraints(topologySpreadConstraint ...v1.TopologySpreadConstraint) // AddNodeSelector Add node selector to the pod AddNodeSelector(name, value string) AddImagePullSecrets(secretNames ...string) SetServiceAccountName(name string) }
ConfigurablePod is the interface that allows the user to customize the Pod
type ConfigurableReplicas ¶
type ConfigurableReplicas interface {
SetReplicas(replica int32)
}
ConfigurableReplicas is the interface that allows the user to customize the number of replicas
type Converged ¶
type Converged interface {
Converged(ctx context.Context, client client.Client, namespace string) (bool, error)
}
Converged The default implementation for a list of resources once it is created is to move on to the next one, if the controller need to wait for this resource to be ready, it can implement this interface
type ConvergedGroup ¶
type ConvergedGroup struct {
// contains filtered or unexported fields
}
func (*ConvergedGroup) GetConvergedGroupID ¶
func (c *ConvergedGroup) GetConvergedGroupID() int
func (*ConvergedGroup) SetConvergedGroupID ¶
func (c *ConvergedGroup) SetConvergedGroupID(id int)
type ConvergedGroupInterface ¶
type ConvergedGroupInterface interface { // SetConvergedGroupID set the group id for the resource. ID must be greater than 0 // ID of 0 means the resource is not part of any group and must be converged before the next resource will be checked SetConvergedGroupID(uid int) // GetConvergedGroupID get the group id for the resource GetConvergedGroupID() int }
ConvergedGroup group of resources that need to be converged together but not necessarily in order
type FormationStatus ¶
type FormationStatus struct {
Resources []*ResourceStatus `json:"resources,omitempty" yaml:"resources"`
}
func (*FormationStatus) DeepCopy ¶
func (in *FormationStatus) DeepCopy() *FormationStatus
func (*FormationStatus) DeepCopyInto ¶
func (in *FormationStatus) DeepCopyInto(t *FormationStatus)
type FormationStatusInterface ¶
type FormationStatusInterface interface {
GetStatus() *FormationStatus
}
type LinkVolumeData ¶
type LinkVolumeData struct { //The name of the container that this volume is mounted to // Format is <PodName>.<ContainerName> // Wildcard is supported, e.g. <PodName>.* will mount to all containers in the pod // Regex is not supported Visibility []string `json:"visibility,omitempty" yaml:"visibility"` VolumeMount v1.VolumeMount `json:"volumeMount,omitempty" yaml:"volumeMount"` //If the Volume is pre-created, or was created by the Formation, what is the reference to it VolumeSource *v1.VolumeSource `json:"volumeSource,omitempty" yaml:"volumeSource"` // If Template is set, the volume will be created by the template Template *v1.PersistentVolumeClaimSpec `json:"template,omitempty" yaml:"template"` // The sources to populate environment variables in the container. // The keys defined within a source must be a C_IDENTIFIER. All invalid keys // will be reported as an event when the container is starting. When a key exists in multiple // sources, the value associated with the last source will take precedence. // Values defined by an Env with a duplicate key will take precedence. EnvFromSource *v1.EnvFromSource `json:"envFromSource,omitempty" yaml:"envFromSource"` }
type ProbeConfiguration ¶
type ProbeConfiguration struct { // Enable specifies whether the probe is enabled. // The default value is true. // +kubebuilder:default=true // +optional Enable bool `json:"enable" yaml:"enable"` // Number of seconds after the container has started before liveness probes are initiated. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty" protobuf:"varint,2,opt,name=initialDelaySeconds"` // Number of seconds after which the probe times out. // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes // +optional TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"` // How often (in seconds) to perform the probe. // +optional PeriodSeconds *int32 `json:"periodSeconds,omitempty" protobuf:"varint,4,opt,name=periodSeconds"` // Minimum consecutive successes for the probe to be considered successful after having failed. // +optional SuccessThreshold *int32 `json:"successThreshold,omitempty" protobuf:"varint,5,opt,name=successThreshold"` // Minimum consecutive failures for the probe to be considered failed after having succeeded. // +optional FailureThreshold *int32 `json:"failureThreshold,omitempty" protobuf:"varint,6,opt,name=failureThreshold"` }
func (*ProbeConfiguration) DeepCopy ¶
func (in *ProbeConfiguration) DeepCopy() *ProbeConfiguration
func (*ProbeConfiguration) DeepCopyInto ¶
func (in *ProbeConfiguration) DeepCopyInto(t *ProbeConfiguration)
type Reconcile ¶
type Reconcile interface {
Reconcile(ctx context.Context, client client.Client, owner v11.Object) (bool, error)
}
Reconcile If the resource need to implement their own reconcile logic, they can implement this interface Optional
type Resource ¶
type Resource interface { //The type of Resource, Ex configmap Type() string //The name of the Resource, this name need to be unique per namespace Name() string //Return an emtpy runtime object of type Resource Runtime() client.Object //Create the Resource structure Create() (client.Object, error) }
type ResourceState ¶
type ResourceState string
const ( Creating ResourceState = "Creating" Ready ResourceState = "Ready" Waiting ResourceState = "Waiting" )
type ResourceStatus ¶
type ResourceStatus struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Group string `json:"group,omitempty"` State ResourceState `json:"state,omitempty"` // +kubebuilder:validation:Type=string // +kubebuilder:validation:Format="date-time" LastUpdate metav1.Time `json:"lastUpdate,omitempty"` }
type ResourcesName ¶
type ResourcesName interface {
ResourcesName() []string
}
ResourcesName is the interface that returns the name of the resources that the builder creates For example, if the resource is a Deployment, it will return the with a list of container name with the format <Pod-Name>/<Container-Name>
type StorageConfigType ¶
type StorageConfigType string
StorageConfigType manages the formation's interpretation of a StorageConfig; each of the types has near-identical specifications but slightly different behavior. +kubebuilder:validation:Enum=template;existing;create;""
const ( // StorageConfigTypeTemplate will typically be templated in to any // StatefulSet managed by the ResourceConfig parent of this StorageConfig. // They will be ignored for any workload object (e.g., Deployment) that // doesn't accept VolumeClaimTemplates. StorageConfigTypeTemplate StorageConfigType = "template" // StorageConfigTypeExisting will typically be inserted in to the Volumes // field of the PodSpec for all workload objects (Deployment, StatefulSet) // managed by this ResourceConfig. StorageConfigTypeExisting StorageConfigType = "existing" // StorageConfigTypeCreate are expected to be created by the controllers and then // inserted in to the Volumes field of workload objects, just as with // Existing. StorageConfigTypeCreate StorageConfigType = "create" )
type ToResource ¶
type ToResource interface {
ToResource() Resource
}
ToResource is the interface that converts a Builder to a Resource