Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountNodesFuncWrapper ¶
func CountNodesFuncWrapper(nodeLister corev1listers.NodeLister) func(nodeSelector map[string]string) (*int32, error)
CountNodesFuncWrapper returns a function that returns the number of nodes that match the given selector. This supports determining the number of master nodes to allow setting the deployment replica count to match.
func EnsureAtMostOnePodPerNode ¶
func EnsureAtMostOnePodPerNode(spec *appsv1.DeploymentSpec) error
EnsureAtMostOnePodPerNode updates the deployment spec to prevent more than one pod of a given replicaset from landing on a node. It accomplishes this by adding a uuid as a label on the template and updates the pod anti-affinity term to include that label. Since the deployment is only written (via ApplyDeployment) when the metadata differs or the generations don't match, the uuid should only be updated in the API when a new replicaset is created.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is a generic workload controller that deals with Deployment resource. Callers must provide a sync function for delegation. It should bring the desired workload into operation. The returned state along with errors will be converted into conditions and persisted in the status field.
func NewController ¶
func NewController(name, operatorNamespace, targetNamespace, targetOperandVersion, operandNamePrefix, conditionsPrefix string, operatorClient v1helpers.OperatorClient, kubeClient kubernetes.Interface, delegate Delegate, openshiftClusterConfigClient openshiftconfigclientv1.ClusterOperatorInterface, eventRecorder events.Recorder, versionRecorder status.VersionGetter) *Controller
NewController creates a brand new Controller instance.
the "name" param will be used to set conditions in the status field. It will be suffixed with "WorkloadController", so it can end up in the condition in the form of "OAuthAPIWorkloadControllerDeploymentAvailable"
the "operatorNamespace" is used to set "version-mapping" in the correct namespace
the "targetNamespace" represent the namespace for the managed resource (DaemonSet)
func (*Controller) AddInformer ¶
func (c *Controller) AddInformer(informer cache.SharedIndexInformer) *Controller
AddInformer queues the given informer to check spec, status and managed resources
func (*Controller) AddNamespaceInformer ¶
func (c *Controller) AddNamespaceInformer(informer cache.SharedIndexInformer) *Controller
AddNamespaceInformer queues the given ns informer for the targetNamespace
type Delegate ¶
type Delegate interface { // Sync a method that will be used for delegation. It should bring the desired workload into operation. Sync() (*appsv1.Deployment, bool, []error) // PreconditionFulfilled a method that indicates whether all prerequisites are met and we can Sync. PreconditionFulfilled() (bool, error) }
Delegate captures a set of methods that hold a custom logic