Documentation ¶
Overview ¶
Copyright DataStax, Inc. Please see the included license file for details.
Index ¶
- Constants
- Variables
- func DatacentersForNode(nodeName string) []types.NamespacedName
- 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 HasStartedDecommissioning(pod *v1.Pod, epData httphelper.CassMetadataEndpoints) bool
- func IsDoneDecommissioning(pod *v1.Pod, epData httphelper.CassMetadataEndpoints) bool
- func ListAllStartedPods(pods []*corev1.Pod) []*corev1.Pod
- func MapPodsToEndpointDataByName(pods []*v1.Pod, epData httphelper.CassMetadataEndpoints) map[string]httphelper.EndpointState
- func MockSetControllerReference() func()
- func NewReconciler(mgr manager.Manager) reconcile.Reconciler
- func PodPtrsFromPodList(podList *corev1.PodList) []*corev1.Pod
- type RackInformation
- type ReconcileCassandraDatacenter
- type ReconciliationContext
- func (rc *ReconciliationContext) CalculateRackInfoForDecomm(currentSize int) ([]*RackInformation, error)
- func (rc *ReconciliationContext) CalculateRackInformation() error
- func (rc *ReconciliationContext) CheckAdditionalSeedEndpoints() result.ReconcileResult
- 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) CheckDecommissioningNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
- func (rc *ReconciliationContext) CheckForInvalidState() result.ReconcileResult
- func (rc *ReconciliationContext) CheckHeadlessServices() result.ReconcileResult
- func (rc *ReconciliationContext) CheckInternodeCredentialCreation() 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) CheckStatefulSetControllerCaughtUp() result.ReconcileResult
- func (rc *ReconciliationContext) CheckSuperuserSecretCreation() result.ReconcileResult
- func (rc *ReconciliationContext) CreateEndpointsForAdditionalSeedService() result.ReconcileResult
- func (rc *ReconciliationContext) CreateHeadlessServices() result.ReconcileResult
- func (rc *ReconciliationContext) CreateUsers() result.ReconcileResult
- func (rc *ReconciliationContext) DecommissionNodeOnRack(rackName string, epData httphelper.CassMetadataEndpoints, lastPodSuffix string) error
- func (rc *ReconciliationContext) DecommissionNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
- func (rc *ReconciliationContext) DeletePodPvcs(pod *v1.Pod) error
- func (rc *ReconciliationContext) EnsurePodsCanAbsorbDecommData(decommPod *v1.Pod, epData httphelper.CassMetadataEndpoints) error
- func (rc *ReconciliationContext) GetAllNodes() ([]*corev1.Node, error)
- func (rc *ReconciliationContext) GetAllNodesInDC() ([]*corev1.Node, error)
- func (rc *ReconciliationContext) GetAllPodsNotReadyInDC() []*corev1.Pod
- func (rc *ReconciliationContext) GetClient() runtimeClient.Client
- func (rc *ReconciliationContext) GetContext() context.Context
- func (rc *ReconciliationContext) GetDCPods() []*corev1.Pod
- func (rc *ReconciliationContext) GetDatacenter() *api.CassandraDatacenter
- func (rc *ReconciliationContext) GetInProgressNodeReplacements() []string
- func (rc *ReconciliationContext) GetLogger() logr.Logger
- func (rc *ReconciliationContext) GetNotReadyPodsBootstrappedInDC() []*corev1.Pod
- func (rc *ReconciliationContext) GetPodPVC(podNamespace string, podName string) (*corev1.PersistentVolumeClaim, error)
- func (rc *ReconciliationContext) GetPodPVCs(pod *corev1.Pod) ([]*corev1.PersistentVolumeClaim, error)
- func (rc *ReconciliationContext) GetStatefulSetForRack(nextRack *RackInformation) (*appsv1.StatefulSet, bool, error)
- func (rc *ReconciliationContext) GetUsedStorageForPods(epData httphelper.CassMetadataEndpoints) (map[string]float64, error)
- func (rc *ReconciliationContext) GetUsers() []api.CassandraUser
- func (rc *ReconciliationContext) IsInitialized() bool
- func (rc *ReconciliationContext) IsStopped() bool
- 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) RemoveDcFromNodeToDcMap(dcToRemove types.NamespacedName)
- func (rc *ReconciliationContext) RemoveDecommissionedPodFromSts(pod *v1.Pod) error
- func (rc *ReconciliationContext) RemovePod(pod *corev1.Pod) error
- func (rc *ReconciliationContext) SetDatacenterAsOwner(controlled metav1.Object) error
- func (rc *ReconciliationContext) StartNodeReplace(podName string) error
- func (rc *ReconciliationContext) UpdateCassandraNodeStatus() error
- func (rc *ReconciliationContext) UpdatePod(pod *corev1.Pod) 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 ( DefaultTerminationGracePeriodSeconds = 120 ServerConfigContainerName = "server-config-init" CassandraContainerName = "cassandra" PvcName = "server-data" SystemLoggerContainerName = "server-system-logger" )
const ( ReaperUIPort = 7080 ReaperAdminPort = 7081 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 ( // Provides reasonable defaults for the logger container. DefaultsLoggerContainer = buildResourceRequirements(100, 64) // Provides reasonable defaults for the configuration container. DefaultsConfigInitContainer = buildResourceRequirements(1000, 256) // Provides reasonable defaults for the reaper sidecar container. DefaultsReaperContainer = buildResourceRequirements(2000, 512) )
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 DatacentersForNode ¶ added in v1.5.0
func DatacentersForNode(nodeName string) []types.NamespacedName
Get the dcNames and dcNamespaces for a node
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 HasStartedDecommissioning ¶ added in v1.5.1
func HasStartedDecommissioning(pod *v1.Pod, epData httphelper.CassMetadataEndpoints) bool
func IsDoneDecommissioning ¶ added in v1.5.0
func IsDoneDecommissioning(pod *v1.Pod, epData httphelper.CassMetadataEndpoints) bool
func MapPodsToEndpointDataByName ¶ added in v1.5.0
func MapPodsToEndpointDataByName(pods []*v1.Pod, epData httphelper.CassMetadataEndpoints) map[string]httphelper.EndpointState
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 PSPHealthUpdater psp.HealthStatusUpdater 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 Endpoints *corev1.Endpoints // 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) CalculateRackInfoForDecomm ¶ added in v1.5.0
func (rc *ReconciliationContext) CalculateRackInfoForDecomm(currentSize int) ([]*RackInformation, error)
func (*ReconciliationContext) CalculateRackInformation ¶
func (rc *ReconciliationContext) CalculateRackInformation() error
CalculateRackInformation determine how many nodes per rack are needed
func (*ReconciliationContext) CheckAdditionalSeedEndpoints ¶ added in v1.4.0
func (rc *ReconciliationContext) CheckAdditionalSeedEndpoints() result.ReconcileResult
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) CheckDecommissioningNodes ¶ added in v1.5.0
func (rc *ReconciliationContext) CheckDecommissioningNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
Wait for decommissioning nodes to finish before continuing to reconcile
func (*ReconciliationContext) CheckForInvalidState ¶ added in v1.5.0
func (rc *ReconciliationContext) CheckForInvalidState() result.ReconcileResult
func (*ReconciliationContext) CheckHeadlessServices ¶
func (rc *ReconciliationContext) CheckHeadlessServices() result.ReconcileResult
ReconcileHeadlessService ...
func (*ReconciliationContext) CheckInternodeCredentialCreation ¶ added in v1.4.0
func (rc *ReconciliationContext) CheckInternodeCredentialCreation() result.ReconcileResult
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) CheckStatefulSetControllerCaughtUp ¶ added in v1.5.0
func (rc *ReconciliationContext) CheckStatefulSetControllerCaughtUp() result.ReconcileResult
func (*ReconciliationContext) CheckSuperuserSecretCreation ¶
func (rc *ReconciliationContext) CheckSuperuserSecretCreation() result.ReconcileResult
func (*ReconciliationContext) CreateEndpointsForAdditionalSeedService ¶ added in v1.4.0
func (rc *ReconciliationContext) CreateEndpointsForAdditionalSeedService() 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) DecommissionNodeOnRack ¶ added in v1.5.0
func (rc *ReconciliationContext) DecommissionNodeOnRack(rackName string, epData httphelper.CassMetadataEndpoints, lastPodSuffix string) error
func (*ReconciliationContext) DecommissionNodes ¶ added in v1.5.0
func (rc *ReconciliationContext) DecommissionNodes(epData httphelper.CassMetadataEndpoints) result.ReconcileResult
func (*ReconciliationContext) DeletePodPvcs ¶ added in v1.5.0
func (rc *ReconciliationContext) DeletePodPvcs(pod *v1.Pod) error
func (*ReconciliationContext) EnsurePodsCanAbsorbDecommData ¶ added in v1.5.0
func (rc *ReconciliationContext) EnsurePodsCanAbsorbDecommData(decommPod *v1.Pod, epData httphelper.CassMetadataEndpoints) error
func (*ReconciliationContext) GetAllNodes ¶ added in v1.5.1
func (rc *ReconciliationContext) GetAllNodes() ([]*corev1.Node, error)
func (*ReconciliationContext) GetAllNodesInDC ¶ added in v1.5.0
func (rc *ReconciliationContext) GetAllNodesInDC() ([]*corev1.Node, error)
func (*ReconciliationContext) GetAllPodsNotReadyInDC ¶ added in v1.5.0
func (rc *ReconciliationContext) GetAllPodsNotReadyInDC() []*corev1.Pod
func (*ReconciliationContext) GetClient ¶ added in v1.5.0
func (rc *ReconciliationContext) GetClient() runtimeClient.Client
func (*ReconciliationContext) GetContext ¶ added in v1.5.0
func (rc *ReconciliationContext) GetContext() context.Context
func (*ReconciliationContext) GetDCPods ¶ added in v1.5.0
func (rc *ReconciliationContext) GetDCPods() []*corev1.Pod
func (*ReconciliationContext) GetDatacenter ¶ added in v1.5.0
func (rc *ReconciliationContext) GetDatacenter() *api.CassandraDatacenter
func (*ReconciliationContext) GetInProgressNodeReplacements ¶ added in v1.5.0
func (rc *ReconciliationContext) GetInProgressNodeReplacements() []string
func (*ReconciliationContext) GetLogger ¶ added in v1.5.0
func (rc *ReconciliationContext) GetLogger() logr.Logger
func (*ReconciliationContext) GetNotReadyPodsBootstrappedInDC ¶ added in v1.5.0
func (rc *ReconciliationContext) GetNotReadyPodsBootstrappedInDC() []*corev1.Pod
func (*ReconciliationContext) GetPodPVC ¶ added in v1.5.0
func (rc *ReconciliationContext) GetPodPVC(podNamespace string, podName string) (*corev1.PersistentVolumeClaim, error)
func (*ReconciliationContext) GetPodPVCs ¶ added in v1.5.0
func (rc *ReconciliationContext) GetPodPVCs(pod *corev1.Pod) ([]*corev1.PersistentVolumeClaim, error)
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 occurred
func (*ReconciliationContext) GetUsedStorageForPods ¶ added in v1.5.0
func (rc *ReconciliationContext) GetUsedStorageForPods(epData httphelper.CassMetadataEndpoints) (map[string]float64, error)
func (*ReconciliationContext) GetUsers ¶ added in v1.3.0
func (rc *ReconciliationContext) GetUsers() []api.CassandraUser
func (*ReconciliationContext) IsInitialized ¶ added in v1.5.0
func (rc *ReconciliationContext) IsInitialized() bool
func (*ReconciliationContext) IsStopped ¶ added in v1.5.0
func (rc *ReconciliationContext) IsStopped() bool
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) RemoveDcFromNodeToDcMap ¶ added in v1.5.0
func (rc *ReconciliationContext) RemoveDcFromNodeToDcMap(dcToRemove types.NamespacedName)
func (*ReconciliationContext) RemoveDecommissionedPodFromSts ¶ added in v1.5.0
func (rc *ReconciliationContext) RemoveDecommissionedPodFromSts(pod *v1.Pod) error
func (*ReconciliationContext) RemovePod ¶ added in v1.5.0
func (rc *ReconciliationContext) RemovePod(pod *corev1.Pod) error
func (*ReconciliationContext) SetDatacenterAsOwner ¶ added in v1.5.0
func (rc *ReconciliationContext) SetDatacenterAsOwner(controlled metav1.Object) error
func (*ReconciliationContext) StartNodeReplace ¶ added in v1.5.0
func (rc *ReconciliationContext) StartNodeReplace(podName string) error
func (*ReconciliationContext) UpdateCassandraNodeStatus ¶
func (rc *ReconciliationContext) UpdateCassandraNodeStatus() error
func (*ReconciliationContext) UpdatePod ¶ added in v1.5.0
func (rc *ReconciliationContext) UpdatePod(pod *corev1.Pod) error
func (*ReconciliationContext) UpdateRackNodeCount ¶
func (rc *ReconciliationContext) UpdateRackNodeCount(statefulSet *appsv1.StatefulSet, newNodeCount int32) error
Updates the node count on a rack (statefulset)
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
Source Files ¶
- check_nodes.go
- construct_podtemplatespec.go
- construct_service.go
- construct_statefulset.go
- constructor.go
- context.go
- decommission_node.go
- defaults.go
- handler.go
- rackinformation.go
- reconcile_datacenter.go
- reconcile_endpoints.go
- reconcile_racks.go
- reconcile_racks_helpers.go
- reconcile_reaper.go
- reconcile_services.go
- secrets.go
- testing.go
- utils.go