Documentation ¶
Overview ¶
Copyright DataStax, Inc. Please see the included license file for details.
Index ¶
- Constants
- Variables
- func FilterPodListByCassNodeState(pods []*corev1.Pod, state string) []*corev1.Pod
- func FilterPodListByLabel(pods []*corev1.Pod, labelName string, labelVal string) []*corev1.Pod
- func FilterPodListByLabels(pods []*corev1.Pod, labelMap map[string]string) []*corev1.Pod
- func FindIpForHostId(endpointData httphelper.CassMetadataEndpoints, hostId string) (string, error)
- func ListAllStartedPods(pods []*corev1.Pod) []*corev1.Pod
- func MockSetControllerReference() func()
- func NewReconciler(mgr manager.Manager) reconcile.Reconciler
- func PodPtrsFromPodList(podList *corev1.PodList) []*corev1.Pod
- type Annotated
- type RackInformation
- type ReconcileCassandraDatacenter
- type ReconciliationContext
- func (rc *ReconciliationContext) CalculateRackInformation() error
- func (rc *ReconciliationContext) CheckCassandraNodeStatuses() result.ReconcileResult
- func (rc *ReconciliationContext) CheckClearActionConditions() result.ReconcileResult
- func (rc *ReconciliationContext) CheckConditionInitializedAndReady() result.ReconcileResult
- func (rc *ReconciliationContext) CheckDcPodDisruptionBudget() result.ReconcileResult
- func (rc *ReconciliationContext) CheckHeadlessServices() result.ReconcileResult
- func (rc *ReconciliationContext) CheckPodsReady(endpointData httphelper.CassMetadataEndpoints) result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackCreation() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackForceUpgrade() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackLabels() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackPodLabels() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackPodTemplate() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackScale() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRackStoppedState() result.ReconcileResult
- func (rc *ReconciliationContext) CheckReaperSchemaInitialized() result.ReconcileResult
- func (rc *ReconciliationContext) CheckReaperService() result.ReconcileResult
- func (rc *ReconciliationContext) CheckRollingRestart() result.ReconcileResult
- func (rc *ReconciliationContext) CheckSuperuserSecretCreation() result.ReconcileResult
- func (rc *ReconciliationContext) CreateHeadlessServices() result.ReconcileResult
- func (rc *ReconciliationContext) CreateUsers() result.ReconcileResult
- func (rc *ReconciliationContext) GetStatefulSetForRack(nextRack *RackInformation) (*appsv1.StatefulSet, bool, error)
- func (rc *ReconciliationContext) GetUsers() []api.CassandraUser
- func (rc *ReconciliationContext) ProcessDeletion() result.ReconcileResult
- func (rc *ReconciliationContext) ReconcileAllRacks() (reconcile.Result, error)
- func (rc *ReconciliationContext) ReconcileNextRack(statefulSet *appsv1.StatefulSet) error
- func (rc *ReconciliationContext) ReconcilePods(statefulSet *appsv1.StatefulSet) error
- func (rc *ReconciliationContext) UpdateCassandraNodeStatus() error
- func (rc *ReconciliationContext) UpdateRackNodeCount(statefulSet *appsv1.StatefulSet, newNodeCount int32) error
- func (rc *ReconciliationContext) UpdateSecretWatches() error
- func (rc *ReconciliationContext) UpdateStatus() result.ReconcileResult
- func (rc *ReconciliationContext) UpdateStatusForUserActions() error
Constants ¶
const ( ReaperUIPort = 7080 ReaperAdminPort = 7081 ReaperDefaultImage = "thelastpickle/cassandra-reaper:2.0.5" ReaperDefaultPullPolicy = corev1.PullIfNotPresent ReaperContainerName = "reaper" ReaperHealthCheckPath = "/healthcheck" ReaperKeyspace = "reaper_db" ReaperSchemaInitJob = "ReaperSchemaInitJob" // This code currently lives at https://github.com/jsanda/create_keyspace. ReaperSchemaInitJobImage = "jsanda/reaper-init-keyspace:latest" )
Variables ¶
var ( ResultShouldNotRequeue reconcile.Result = reconcile.Result{Requeue: false} ResultShouldRequeueNow reconcile.Result = reconcile.Result{Requeue: true} ResultShouldRequeueSoon reconcile.Result = reconcile.Result{Requeue: true, RequeueAfter: 2 * time.Second} ResultShouldRequeueTenSecs reconcile.Result = reconcile.Result{Requeue: true, RequeueAfter: 10 * time.Second} )
Functions ¶
func FilterPodListByLabel ¶
func FilterPodListByLabels ¶
Takes a list of *Pod and filters down to only the pods that match every label/val in the provided label map.
func FindIpForHostId ¶
func FindIpForHostId(endpointData httphelper.CassMetadataEndpoints, hostId string) (string, error)
func MockSetControllerReference ¶
func MockSetControllerReference() func()
MockSetControllerReference returns a method that will automatically reverse the mock
func NewReconciler ¶
func NewReconciler(mgr manager.Manager) reconcile.Reconciler
NewReconciler returns a new reconcile.Reconciler
Types ¶
type RackInformation ¶
RackInformation contains an identifying name and a node count for a logical rack
type ReconcileCassandraDatacenter ¶
type ReconcileCassandraDatacenter struct { // SecretWatches is used in the controller when setting up the watches and // during reconciliation where we update the mappings for the watches. // Putting it here allows us to get it to both places. SecretWatches dynamicwatch.DynamicWatches // contains filtered or unexported fields }
ReconcileCassandraDatacenter reconciles a cassandraDatacenter object This is placed here to avoid a circular dependency
func (*ReconcileCassandraDatacenter) Reconcile ¶
func (r *ReconcileCassandraDatacenter) Reconcile(request reconcile.Request) (reconcile.Result, error)
Reconcile reads that state of the cluster for a Datacenter object and makes changes based on the state read and what is in the cassandraDatacenter.Spec Note: The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue. See: https://godoc.org/sigs.k8s.io/controller-runtime/pkg/reconcile#Result
type ReconciliationContext ¶
type ReconciliationContext struct { Request *reconcile.Request Client runtimeClient.Client Scheme *runtime.Scheme Datacenter *api.CassandraDatacenter NodeMgmtClient httphelper.NodeMgmtClient Recorder record.EventRecorder ReqLogger logr.Logger SecretWatches dynamicwatch.DynamicWatches // According to golang recommendations the context should not be stored in a struct but given that // this is passed around as a parameter we feel that its a fair compromise. For further discussion // see: golang/go#22602 Ctx context.Context Services []*corev1.Service // contains filtered or unexported fields }
ReconciliationContext contains all of the input necessary to calculate a list of ReconciliationActions
func CreateMockReconciliationContext ¶
func CreateMockReconciliationContext( reqLogger logr.Logger) *ReconciliationContext
CreateMockReconciliationContext ...
func CreateReconciliationContext ¶
func CreateReconciliationContext( req *reconcile.Request, cli runtimeClient.Client, scheme *runtime.Scheme, rec record.EventRecorder, secretWatches dynamicwatch.DynamicWatches, reqLogger logr.Logger) (*ReconciliationContext, error)
CreateReconciliationContext gathers all information needed for computeReconciliationActions into a struct.
func (*ReconciliationContext) CalculateRackInformation ¶
func (rc *ReconciliationContext) CalculateRackInformation() error
CalculateRackInformation determine how many nodes per rack are needed
func (*ReconciliationContext) CheckCassandraNodeStatuses ¶ added in v1.3.0
func (rc *ReconciliationContext) CheckCassandraNodeStatuses() result.ReconcileResult
func (*ReconciliationContext) CheckClearActionConditions ¶
func (rc *ReconciliationContext) CheckClearActionConditions() result.ReconcileResult
func (*ReconciliationContext) CheckConditionInitializedAndReady ¶
func (rc *ReconciliationContext) CheckConditionInitializedAndReady() result.ReconcileResult
func (*ReconciliationContext) CheckDcPodDisruptionBudget ¶
func (rc *ReconciliationContext) CheckDcPodDisruptionBudget() result.ReconcileResult
func (*ReconciliationContext) CheckHeadlessServices ¶
func (rc *ReconciliationContext) CheckHeadlessServices() result.ReconcileResult
ReconcileHeadlessService ...
func (*ReconciliationContext) CheckPodsReady ¶
func (rc *ReconciliationContext) CheckPodsReady(endpointData httphelper.CassMetadataEndpoints) result.ReconcileResult
CheckPodsReady loops over all the server pods and starts them
func (*ReconciliationContext) CheckRackCreation ¶
func (rc *ReconciliationContext) CheckRackCreation() result.ReconcileResult
func (*ReconciliationContext) CheckRackForceUpgrade ¶
func (rc *ReconciliationContext) CheckRackForceUpgrade() result.ReconcileResult
func (*ReconciliationContext) CheckRackLabels ¶
func (rc *ReconciliationContext) CheckRackLabels() result.ReconcileResult
func (*ReconciliationContext) CheckRackPodLabels ¶
func (rc *ReconciliationContext) CheckRackPodLabels() result.ReconcileResult
CheckRackPodLabels checks each pod and its volume(s) and makes sure they have the proper labels
func (*ReconciliationContext) CheckRackPodTemplate ¶
func (rc *ReconciliationContext) CheckRackPodTemplate() result.ReconcileResult
func (*ReconciliationContext) CheckRackScale ¶
func (rc *ReconciliationContext) CheckRackScale() result.ReconcileResult
CheckRackScale loops over each statefulset and makes sure that it has the right amount of desired replicas. At this time we can only increase the amount of replicas.
func (*ReconciliationContext) CheckRackStoppedState ¶
func (rc *ReconciliationContext) CheckRackStoppedState() result.ReconcileResult
func (*ReconciliationContext) CheckReaperSchemaInitialized ¶ added in v1.3.0
func (rc *ReconciliationContext) CheckReaperSchemaInitialized() result.ReconcileResult
func (*ReconciliationContext) CheckReaperService ¶ added in v1.3.0
func (rc *ReconciliationContext) CheckReaperService() result.ReconcileResult
func (*ReconciliationContext) CheckRollingRestart ¶
func (rc *ReconciliationContext) CheckRollingRestart() result.ReconcileResult
func (*ReconciliationContext) CheckSuperuserSecretCreation ¶
func (rc *ReconciliationContext) CheckSuperuserSecretCreation() result.ReconcileResult
func (*ReconciliationContext) CreateHeadlessServices ¶
func (rc *ReconciliationContext) CreateHeadlessServices() result.ReconcileResult
func (*ReconciliationContext) CreateUsers ¶ added in v1.3.0
func (rc *ReconciliationContext) CreateUsers() result.ReconcileResult
func (*ReconciliationContext) GetStatefulSetForRack ¶
func (rc *ReconciliationContext) GetStatefulSetForRack( nextRack *RackInformation) (*appsv1.StatefulSet, bool, error)
GetStatefulSetForRack returns the statefulset for the rack and whether it currently exists and whether an error occured
func (*ReconciliationContext) GetUsers ¶ added in v1.3.0
func (rc *ReconciliationContext) GetUsers() []api.CassandraUser
func (*ReconciliationContext) ProcessDeletion ¶
func (rc *ReconciliationContext) ProcessDeletion() result.ReconcileResult
ProcessDeletion ...
func (*ReconciliationContext) ReconcileAllRacks ¶
func (rc *ReconciliationContext) ReconcileAllRacks() (reconcile.Result, error)
ReconcileAllRacks determines if a rack needs to be reconciled.
func (*ReconciliationContext) ReconcileNextRack ¶
func (rc *ReconciliationContext) ReconcileNextRack(statefulSet *appsv1.StatefulSet) error
ReconcileNextRack ensures that the resources for a rack have been properly created
func (*ReconciliationContext) ReconcilePods ¶
func (rc *ReconciliationContext) ReconcilePods(statefulSet *appsv1.StatefulSet) error
ReconcilePods ...
func (*ReconciliationContext) UpdateCassandraNodeStatus ¶
func (rc *ReconciliationContext) UpdateCassandraNodeStatus() error
func (*ReconciliationContext) UpdateRackNodeCount ¶
func (rc *ReconciliationContext) UpdateRackNodeCount(statefulSet *appsv1.StatefulSet, newNodeCount int32) error
UpdateRackNodeCount ...
func (*ReconciliationContext) UpdateSecretWatches ¶ added in v1.3.0
func (rc *ReconciliationContext) UpdateSecretWatches() error
func (*ReconciliationContext) UpdateStatus ¶
func (rc *ReconciliationContext) UpdateStatus() result.ReconcileResult
func (*ReconciliationContext) UpdateStatusForUserActions ¶
func (rc *ReconciliationContext) UpdateStatusForUserActions() error