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, component string) 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 label on the template and updates the pod anti-affinity term to include that label.
func NewController ¶
func NewController(instanceName, operatorNamespace, targetNamespace, targetOperandVersion, operandNamePrefix, conditionsPrefix string, operatorClient v1helpers.OperatorClient, kubeClient kubernetes.Interface, podLister corev1listers.PodLister, informers []factory.Informer, tagetNamespaceInformers []factory.Informer, delegate Delegate, openshiftClusterConfigClient openshiftconfigclientv1.ClusterOperatorInterface, eventRecorder events.Recorder, versionRecorder status.VersionGetter, ) factory.Controller
NewController creates a brand new Controller instance.
the "instanceName" 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)
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.
type Delegate ¶
type Delegate interface { // Sync a method that will be used for delegation. It should bring the desired workload into operation. Sync(ctx context.Context, controllerContext factory.SyncContext) (*appsv1.Deployment, bool, []error) // PreconditionFulfilled a method that indicates whether all prerequisites are met and we can Sync. // // missing preconditions will be reported in the operator's status // operator will be degraded, not available and not progressing // returned errors (if any) will be added to the Message field PreconditionFulfilled(ctx context.Context) (bool, error) }
Delegate captures a set of methods that hold a custom logic